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 =========================================================================*/
42 #ifndef vtkDiscretizableColorTransferFunction_h
43 #define vtkDiscretizableColorTransferFunction_h
44 
45 #include "vtkRenderingCoreModule.h" // For export macro
47 #include "vtkSmartPointer.h" // for vtkSmartPointer
48 
50 class vtkLookupTable;
52 
54 {
55 public:
58  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
59 
63  int IsOpaque() VTK_OVERRIDE;
64 
72  void SetIndexedColor(unsigned int index, const double rgb[3])
73  { this->SetIndexedColor(index, rgb[0], rgb[1], rgb[2]); }
74  void SetIndexedColor(unsigned int index, double r, double g, double b);
75 
88  void GetIndexedColor(vtkIdType i, double rgba[4]) VTK_OVERRIDE;
89 
91 
96  void SetNumberOfIndexedColors(unsigned int count);
97  unsigned int GetNumberOfIndexedColors();
99 
106  void Build() VTK_OVERRIDE;
107 
109 
115  vtkSetMacro(Discretize, int);
116  vtkGetMacro(Discretize, int);
117  vtkBooleanMacro(Discretize, int);
119 
121 
125  virtual void SetUseLogScale(int useLogScale);
126  vtkGetMacro(UseLogScale, int);
128 
130 
135  vtkSetMacro(NumberOfValues, vtkIdType);
136  vtkGetMacro(NumberOfValues, vtkIdType);
138 
143  unsigned char *MapValue(double v) VTK_OVERRIDE;
144 
149  void GetColor(double v, double rgb[3]) VTK_OVERRIDE;
150 
154  double GetOpacity(double v) VTK_OVERRIDE;
155 
157 
172  vtkUnsignedCharArray *MapScalars(vtkDataArray *scalars, int colorMode,
173  int component) VTK_OVERRIDE;
174  vtkUnsignedCharArray *MapScalars(vtkAbstractArray *scalars, int colorMode,
175  int component) VTK_OVERRIDE;
177 
184  VTK_LEGACY(double* GetRGBPoints());
185 
193  void SetAlpha(double alpha) VTK_OVERRIDE;
194 
196 
201  void SetNanColor(double r, double g, double b) VTK_OVERRIDE;
202  void SetNanColor(double rgb[3]) VTK_OVERRIDE {
203  this->SetNanColor(rgb[0], rgb[1], rgb[2]);
204  }
206 
211  int UsingLogScale() VTK_OVERRIDE
212  { return this->UseLogScale; }
213 
217  vtkIdType GetNumberOfAvailableColors() VTK_OVERRIDE;
218 
220 
223  virtual void SetScalarOpacityFunction(vtkPiecewiseFunction *function);
224  virtual vtkPiecewiseFunction* GetScalarOpacityFunction() const;
226 
228 
231  vtkSetMacro(EnableOpacityMapping, bool)
232  vtkGetMacro(EnableOpacityMapping, bool)
233  vtkBooleanMacro(EnableOpacityMapping, bool)
235 
239  vtkMTimeType GetMTime() VTK_OVERRIDE;
240 
241 protected:
243  ~vtkDiscretizableColorTransferFunction() VTK_OVERRIDE;
244 
248  int Discretize;
249 
253  int UseLogScale;
254 
258  vtkIdType NumberOfValues;
259 
263  vtkLookupTable* LookupTable;
264 
265  vtkTimeStamp LookupTableUpdateTime;
266 
267  bool EnableOpacityMapping;
268  vtkSmartPointer<vtkPiecewiseFunction> ScalarOpacityFunction;
269 
270  void MapDataArrayToOpacity(
271  vtkDataArray *scalars, int component, vtkUnsignedCharArray* colors);
272 
273 private:
274  vtkDiscretizableColorTransferFunction(const vtkDiscretizableColorTransferFunction&) VTK_DELETE_FUNCTION;
275  void operator=(const vtkDiscretizableColorTransferFunction&) VTK_DELETE_FUNCTION;
276 
277  template<typename T, typename VectorGetter>
278  void MapVectorToOpacity (
279  VectorGetter getter, T* scalars, int component,
280  int numberOfComponents, vtkIdType numberOfTuples, unsigned char* colors);
281 
282  template<template<class> class VectorGetter>
283  void AllTypesMapVectorToOpacity (
284  int scalarType,
285  void* scalarsPtr, int component,
286  int numberOfComponents, vtkIdType numberOfTuples, unsigned char* colors);
287 
288  class vtkInternals;
289  vtkInternals* Internals;
290 };
291 
292 #endif
Defines a 1D piecewise function.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
void PrintSelf(ostream &os, vtkIndent indent) override
Print method for vtkColorTransferFunction.
Abstract superclass for all arrays.
void GetIndexedColor(vtkIdType idx, double rgba[4]) override
Return a color given an integer index.
record modification and/or execution time
Definition: vtkTimeStamp.h:32
static vtkColorTransferFunction * New()
map scalar values into colors via a lookup table
Hold a reference to a vtkObjectBase instance.
int vtkIdType
Definition: vtkType.h:345
virtual void SetNanColor(double, double, double)
Set the RGB color to use when a NaN (not a number) is encountered.
virtual int IsOpaque()
Return true if all of the values defining the mapping have an opacity equal to 1. ...
a simple class to control print indentation
Definition: vtkIndent.h:33
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
int UsingLogScale() override
This should return 1 if the subclass is using log scale for mapping scalars to colors.
dynamic, self-adjusting array of unsigned char
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkIdType GetNumberOfAvailableColors() override
Get the number of available colors for mapping to.
a combination of vtkColorTransferFunction and vtkLookupTable.
Defines a transfer function for mapping a property to an RGB color value.
virtual void Build()
Perform any processing required (if any) before processing scalars.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.