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 =========================================================================*/
49 #ifndef vtkDiscretizableColorTransferFunction_h
50 #define vtkDiscretizableColorTransferFunction_h
51 
52 #include "vtkRenderingCoreModule.h" // For export macro
54 #include "vtkSmartPointer.h" // for vtkSmartPointer
55 
57 class vtkLookupTable;
59 
61 {
62 public:
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
70  int IsOpaque() override;
71 
79  void SetIndexedColor(unsigned int index, const double rgb[3])
80  { this->SetIndexedColor(index, rgb[0], rgb[1], rgb[2]); }
81  void SetIndexedColor(unsigned int index, double r, double g, double b);
82 
95  void GetIndexedColor(vtkIdType i, double rgba[4]) override;
96 
98 
103  void SetNumberOfIndexedColors(unsigned int count);
104  unsigned int GetNumberOfIndexedColors();
106 
113  void Build() override;
114 
116 
122  vtkSetMacro(Discretize, int);
123  vtkGetMacro(Discretize, int);
124  vtkBooleanMacro(Discretize, int);
126 
128 
132  virtual void SetUseLogScale(int useLogScale);
133  vtkGetMacro(UseLogScale, int);
135 
137 
142  vtkSetMacro(NumberOfValues, vtkIdType);
143  vtkGetMacro(NumberOfValues, vtkIdType);
145 
150  unsigned char *MapValue(double v) override;
151 
156  void GetColor(double v, double rgb[3]) override;
157 
161  double GetOpacity(double v) override;
162 
168  void MapScalarsThroughTable2(void *input, unsigned char *output,
169  int inputDataType, int numberOfValues,
170  int inputIncrement, int outputFormat) VTK_OVERRIDE;
171 
178  VTK_LEGACY(double* GetRGBPoints());
179 
187  void SetAlpha(double alpha) override;
188 
190 
195  void SetNanColor(double r, double g, double b) override;
196  void SetNanColor(double rgb[3]) override {
197  this->SetNanColor(rgb[0], rgb[1], rgb[2]);
198  }
200 
205  int UsingLogScale() override
206  { return this->UseLogScale; }
207 
211  vtkIdType GetNumberOfAvailableColors() override;
212 
214 
217  virtual void SetScalarOpacityFunction(vtkPiecewiseFunction *function);
218  virtual vtkPiecewiseFunction* GetScalarOpacityFunction() const;
220 
222 
225  vtkSetMacro(EnableOpacityMapping, bool)
226  vtkGetMacro(EnableOpacityMapping, bool)
227  vtkBooleanMacro(EnableOpacityMapping, bool)
229 
233  vtkMTimeType GetMTime() override;
234 
235 protected:
238 
243 
248 
252  vtkIdType NumberOfValues;
253 
258 
260 
263 
264  void MapDataArrayToOpacity(
265  vtkDataArray *scalars, int component, vtkUnsignedCharArray* colors);
266 
267 private:
269  void operator=(const vtkDiscretizableColorTransferFunction&) = delete;
270 
271  template<typename T, typename VectorGetter>
272  void MapVectorToOpacity (
273  VectorGetter getter, T* scalars, int component,
274  int numberOfComponents, vtkIdType numberOfTuples, unsigned char* colors);
275 
276  template<template<class> class VectorGetter>
277  void AllTypesMapVectorToOpacity (
278  int scalarType,
279  void* scalarsPtr, int component,
280  int numberOfComponents, vtkIdType numberOfTuples, unsigned char* colors);
281 
282  class vtkInternals;
283  vtkInternals* Internals;
284 };
285 
286 #endif
int UseLogScale
Flag indicating whether log scaling is to be used.
Defines a 1D piecewise function.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
void PrintSelf(ostream &os, vtkIndent indent) override
Print method for vtkColorTransferFunction.
void GetIndexedColor(vtkIdType idx, double rgba[4]) override
Return a color given an integer index.
record modification and/or execution time
Definition: vtkTimeStamp.h:35
static vtkColorTransferFunction * New()
map scalar values into colors via a lookup table
virtual void SetAlpha(double alpha)
Specify an additional opacity (alpha) value to blend with.
int Discretize
Flag indicating whether transfer function is discretized.
vtkIdType NumberOfValues
Number of values to use in discretized color map.
void MapScalarsThroughTable2(void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputIncrement) override
Map a set of scalars through the lookup table.
virtual void SetNanColor(double, double, double)
Set the RGB color to use when a NaN (not a number) is encountered.
unsigned char * MapValue(double v) override
Map one value through the lookup table.
#define VTK_OVERRIDE
Definition: vtkConfigure.h:158
virtual double GetOpacity(double v)
Map one value through the lookup table and return the alpha value (the opacity) as a double between 0...
virtual int IsOpaque()
Return true if all of the values defining the mapping have an opacity equal to 1.
double * GetColor(double x)
Returns an RGB color for the specified scalar value.
void SetNanColor(double rgb[3]) override
Set the color to use when a NaN (not a number) is encountered.
a simple class to control print indentation
Definition: vtkIndent.h:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
virtual vtkMTimeType GetMTime()
Return this object's modified time.
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.
#define VTKRENDERINGCORE_EXPORT
vtkSmartPointer< vtkPiecewiseFunction > ScalarOpacityFunction
virtual void Build()
Perform any processing required (if any) before processing scalars.
void SetIndexedColor(unsigned int index, const double rgb[3])
Add colors to use when IndexedLookup is true.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkLookupTable * LookupTable
Internal lookup table used for some aspects of the color mapping.