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 =========================================================================*/
45 #ifndef vtkDiscretizableColorTransferFunction_h
46 #define vtkDiscretizableColorTransferFunction_h
47 
48 #include "vtkRenderingCoreModule.h" // For export macro
50 #include "vtkSmartPointer.h" // for vtkSmartPointer
51 
53 class vtkLookupTable;
55 
57 {
58 public:
61  void PrintSelf(ostream& os, vtkIndent indent);
62 
66  int IsOpaque();
67 
75  void SetIndexedColor(unsigned int index, const double rgb[3])
76  { this->SetIndexedColor(index, rgb[0], rgb[1], rgb[2]); }
77  void SetIndexedColor(unsigned int index, double r, double g, double b);
78 
91  virtual void GetIndexedColor(vtkIdType i, double rgba[4]);
92 
94 
99  void SetNumberOfIndexedColors(unsigned int count);
100  unsigned int GetNumberOfIndexedColors();
102 
109  virtual void Build();
110 
112 
118  vtkSetMacro(Discretize, int);
119  vtkGetMacro(Discretize, int);
120  vtkBooleanMacro(Discretize, int);
122 
124 
128  virtual void SetUseLogScale(int useLogScale);
129  vtkGetMacro(UseLogScale, int);
131 
133 
138  vtkSetMacro(NumberOfValues, vtkIdType);
139  vtkGetMacro(NumberOfValues, vtkIdType);
141 
146  virtual unsigned char *MapValue(double v);
147 
152  virtual void GetColor(double v, double rgb[3]);
153 
157  virtual double GetOpacity(double v);
158 
160 
175  virtual vtkUnsignedCharArray *MapScalars(vtkDataArray *scalars, int colorMode,
176  int component);
177  virtual vtkUnsignedCharArray *MapScalars(vtkAbstractArray *scalars, int colorMode,
178  int component);
180 
187  VTK_LEGACY(double* GetRGBPoints());
188 
196  virtual void SetAlpha(double alpha);
197 
199 
204  virtual void SetNanColor(double r, double g, double b);
205  virtual void SetNanColor(double rgb[3]) {
206  this->SetNanColor(rgb[0], rgb[1], rgb[2]);
207  }
209 
214  virtual int UsingLogScale()
215  { return this->UseLogScale; }
216 
221 
223 
229 
231 
234  vtkSetMacro(EnableOpacityMapping, bool)
235  vtkGetMacro(EnableOpacityMapping, bool)
236  vtkBooleanMacro(EnableOpacityMapping, bool)
238 
242  virtual vtkMTimeType GetMTime();
243 
244 protected:
247 
251  int Discretize;
252 
256  int UseLogScale;
257 
261  vtkIdType NumberOfValues;
262 
266  vtkLookupTable* LookupTable;
267 
269 
270  bool EnableOpacityMapping;
271  vtkSmartPointer<vtkPiecewiseFunction> ScalarOpacityFunction;
272 
273  void MapDataArrayToOpacity(
274  vtkDataArray *scalars, int component, vtkUnsignedCharArray* colors);
275 
276 private:
278  void operator=(const vtkDiscretizableColorTransferFunction&) VTK_DELETE_FUNCTION;
279 
280  template<typename T, typename VectorGetter>
281  void MapVectorToOpacity (
282  VectorGetter getter, T* scalars, int component,
283  int numberOfComponents, vtkIdType numberOfTuples, unsigned char* colors);
284 
285  template<template<class> class VectorGetter>
286  void AllTypesMapVectorToOpacity (
287  int scalarType,
288  void* scalarsPtr, int component,
289  int numberOfComponents, vtkIdType numberOfTuples, unsigned char* colors);
290 
291  class vtkInternals;
292  vtkInternals* Internals;
293 };
294 
295 #endif
vtkDiscretizableColorTransferFunction::SetIndexedColor
void SetIndexedColor(unsigned int index, double r, double g, double b)
vtkDiscretizableColorTransferFunction::GetNumberOfIndexedColors
unsigned int GetNumberOfIndexedColors()
vtkX3D::alpha
@ alpha
Definition: vtkX3D.h:250
vtkX3D::component
@ component
Definition: vtkX3D.h:175
vtkDiscretizableColorTransferFunction::SetNumberOfIndexedColors
void SetNumberOfIndexedColors(unsigned int count)
Set the number of indexed colors.
vtkDiscretizableColorTransferFunction::GetRGBPoints
double * GetRGBPoints()
Returns the (x, r, g, b) values as an array.
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkDiscretizableColorTransferFunction::SetAlpha
virtual void SetAlpha(double alpha)
Specify an additional opacity (alpha) value to blend with.
vtkDiscretizableColorTransferFunction::UsingLogScale
virtual int UsingLogScale()
This should return 1 if the subclass is using log scale for mapping scalars to colors.
Definition: vtkDiscretizableColorTransferFunction.h:214
vtkDiscretizableColorTransferFunction::GetOpacity
virtual double GetOpacity(double v)
Return the opacity of a given scalar.
vtkColorTransferFunction::SetNanColor
virtual void SetNanColor(double, double, double)
Set the RGB color to use when a NaN (not a number) is encountered.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkDiscretizableColorTransferFunction::IsOpaque
int IsOpaque()
Returns the negation of EnableOpacityMapping.
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:42
vtkSmartPointer
Hold a reference to a vtkObjectBase instance.
Definition: vtkSmartPointer.h:36
vtkDiscretizableColorTransferFunction::GetColor
virtual void GetColor(double v, double rgb[3])
Map one value through the lookup table and return the color as an RGB array of doubles between 0 and ...
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkDiscretizableColorTransferFunction::New
static vtkDiscretizableColorTransferFunction * New()
vtkDiscretizableColorTransferFunction
a combination of vtkColorTransferFunction and vtkLookupTable.
Definition: vtkDiscretizableColorTransferFunction.h:57
vtkColorTransferFunction
Defines a transfer function for mapping a property to an RGB color value.
Definition: vtkColorTransferFunction.h:59
vtkDiscretizableColorTransferFunction::SetNanColor
virtual void SetNanColor(double r, double g, double b)
Set the color to use when a NaN (not a number) is encountered.
vtkMTimeType
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
vtkDiscretizableColorTransferFunction::Build
virtual void Build()
Generate discretized lookup table, if applicable.
vtkColorTransferFunction.h
vtkDiscretizableColorTransferFunction::SetNanColor
virtual void SetNanColor(double rgb[3])
Definition: vtkDiscretizableColorTransferFunction.h:205
vtkDiscretizableColorTransferFunction::MapScalars
virtual vtkUnsignedCharArray * MapScalars(vtkAbstractArray *scalars, int colorMode, int component)
vtkDiscretizableColorTransferFunction::GetNumberOfAvailableColors
virtual vtkIdType GetNumberOfAvailableColors()
Get the number of available colors for mapping to.
vtkDiscretizableColorTransferFunction::GetScalarOpacityFunction
virtual vtkPiecewiseFunction * GetScalarOpacityFunction() const
vtkDiscretizableColorTransferFunction::MapScalars
virtual vtkUnsignedCharArray * MapScalars(vtkDataArray *scalars, int colorMode, int component)
Internal methods that map a data array into a 4-component, unsigned char RGBA array.
vtkDiscretizableColorTransferFunction::SetUseLogScale
virtual void SetUseLogScale(int useLogScale)
Get/Set if log scale must be used while mapping scalars to colors.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkDiscretizableColorTransferFunction::MapValue
virtual unsigned char * MapValue(double v)
Map one value through the lookup table and return a color defined as a RGBA unsigned char tuple (4 by...
vtkSmartPointer.h
vtkPiecewiseFunction
Defines a 1D piecewise function.
Definition: vtkPiecewiseFunction.h:52
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:79
vtkDiscretizableColorTransferFunction::SetScalarOpacityFunction
virtual void SetScalarOpacityFunction(vtkPiecewiseFunction *function)
Set/get the opacity function to use.
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkLookupTable
map scalar values into colors via a lookup table
Definition: vtkLookupTable.h:75
vtkDiscretizableColorTransferFunction::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Print method for vtkColorTransferFunction.
vtkDiscretizableColorTransferFunction::GetIndexedColor
virtual void GetIndexedColor(vtkIdType i, double rgba[4])
Get the "indexed color" assigned to an index.
vtkDiscretizableColorTransferFunction::SetIndexedColor
void SetIndexedColor(unsigned int index, const double rgb[3])
Add colors to use when IndexedLookup is true.
Definition: vtkDiscretizableColorTransferFunction.h:75
vtkX3D::index
@ index
Definition: vtkX3D.h:246
BuildTime
vtkTimeStamp BuildTime
Updates the extensions string.
Definition: vtkOpenGLExtensionManager.h:390