VTK
vtkDiscretizableColorTransferFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDiscretizableColorTransferFunction.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
44 #ifndef vtkDiscretizableColorTransferFunction_h
45 #define vtkDiscretizableColorTransferFunction_h
46 
47 #include "vtkRenderingCoreModule.h" // For export macro
49 #include "vtkSmartPointer.h" // for vtkSmartPointer
50 
52 class vtkLookupTable;
54 
56 {
57 public:
60  void PrintSelf(ostream& os, vtkIndent indent);
61 
63  int IsOpaque();
64 
66 
71  void SetIndexedColor(unsigned int index, const double rgb[3])
72  { this->SetIndexedColor(index, rgb[0], rgb[1], rgb[2]); }
73  void SetIndexedColor(unsigned int index, double r, double g, double b);
75 
86  virtual void GetIndexedColor(vtkIdType i, double rgba[4]);
87 
89 
92  void SetNumberOfIndexedColors(unsigned int count);
93  unsigned int GetNumberOfIndexedColors();
95 
100  virtual void Build();
101 
103 
107  vtkSetMacro(Discretize, int);
108  vtkGetMacro(Discretize, int);
109  vtkBooleanMacro(Discretize, int);
111 
113 
115  virtual void SetUseLogScale(int useLogScale);
116  vtkGetMacro(UseLogScale, int);
118 
120 
123  vtkSetMacro(NumberOfValues, vtkIdType);
124  vtkGetMacro(NumberOfValues, vtkIdType);
126 
129  virtual unsigned char *MapValue(double v);
130 
133  virtual void GetColor(double v, double rgb[3]);
134 
136  virtual double GetOpacity(double v);
137 
139 
150  virtual vtkUnsignedCharArray *MapScalars(vtkDataArray *scalars, int colorMode,
151  int component);
152  virtual vtkUnsignedCharArray *MapScalars(vtkAbstractArray *scalars, int colorMode,
153  int component);
155 
159  VTK_LEGACY(double* GetRGBPoints());
160 
165  virtual void SetAlpha(double alpha);
166 
168 
171  virtual void SetNanColor(double r, double g, double b);
172  virtual void SetNanColor(double rgb[3]) {
173  this->SetNanColor(rgb[0], rgb[1], rgb[2]);
174  }
176 
178 
180  virtual int UsingLogScale()
181  { return this->UseLogScale; }
183 
186 
188 
189  virtual void SetScalarOpacityFunction(vtkPiecewiseFunction *function);
190  virtual vtkPiecewiseFunction* GetScalarOpacityFunction() const;
192 
194 
195  vtkSetMacro(EnableOpacityMapping, bool)
196  vtkGetMacro(EnableOpacityMapping, bool)
197  vtkBooleanMacro(EnableOpacityMapping, bool)
199 
201  virtual unsigned long GetMTime();
202 
203 protected:
205  ~vtkDiscretizableColorTransferFunction();
206 
208  int Discretize;
209 
211  int UseLogScale;
212 
214  vtkIdType NumberOfValues;
215 
217  vtkLookupTable* LookupTable;
218 
220 
221  bool EnableOpacityMapping;
222  vtkSmartPointer<vtkPiecewiseFunction> ScalarOpacityFunction;
223 
224  void MapDataArrayToOpacity(
225  vtkDataArray *scalars, int component, vtkUnsignedCharArray* colors);
226 
227 private:
228  vtkDiscretizableColorTransferFunction(const vtkDiscretizableColorTransferFunction&); // Not implemented.
229  void operator=(const vtkDiscretizableColorTransferFunction&); // Not implemented.
230 
231  template<typename T, typename VectorGetter>
232  void MapVectorToOpacity (
233  VectorGetter getter, T* scalars, int component,
234  int numberOfComponents, vtkIdType numberOfTuples, unsigned char* colors);
235 
236  template<template<class> class VectorGetter>
237  void AllTypesMapVectorToOpacity (
238  int scalarType,
239  void* scalarsPtr, int component,
240  int numberOfComponents, vtkIdType numberOfTuples, unsigned char* colors);
241 
242  class vtkInternals;
243  vtkInternals* Internals;
244 };
245 
246 #endif
vtkTimeStamp BuildTime
virtual vtkIdType GetNumberOfAvailableColors()
Defines a 1D piecewise function.
Abstract superclass for all arrays.
record modification and/or execution time
Definition: vtkTimeStamp.h:34
static vtkColorTransferFunction * New()
map scalar values into colors via a lookup table
virtual void SetAlpha(double alpha)
virtual unsigned char * MapValue(double v)
Hold a reference to a vtkObjectBase instance.
int vtkIdType
Definition: vtkType.h:275
virtual void SetNanColor(double, double, double)
void PrintSelf(ostream &os, vtkIndent indent)
virtual double GetOpacity(double v)
virtual int IsOpaque()
virtual void GetIndexedColor(vtkIdType idx, double rgba[4])
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
dynamic, self-adjusting array of unsigned char
a combination of vtkColorTransferFunction and vtkLookupTable.
virtual vtkUnsignedCharArray * MapScalars(vtkDataArray *scalars, int colorMode, int component)
Defines a transfer function for mapping a property to an RGB color value.
#define VTKRENDERINGCORE_EXPORT
virtual void Build()
void SetIndexedColor(unsigned int index, const double rgb[3])