VTK  9.2.6
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=========================================================================*/
68#ifndef vtkDiscretizableColorTransferFunction_h
69#define vtkDiscretizableColorTransferFunction_h
70
72#include "vtkRenderingCoreModule.h" // For export macro
73#include "vtkSmartPointer.h" // for vtkSmartPointer
74
76class vtkLookupTable;
79
80class VTKRENDERINGCORE_EXPORT vtkDiscretizableColorTransferFunction
82{
83public:
86 void PrintSelf(ostream& os, vtkIndent indent) override;
87
89
92 int IsOpaque() override;
93 int IsOpaque(vtkAbstractArray* scalars, int colorMode, int component) override;
94 int IsOpaque(vtkAbstractArray* scalars, int colorMode, int component,
95 vtkUnsignedCharArray* ghosts, unsigned char ghostsToSkip = 0xff) override;
97
105 void SetIndexedColorRGB(unsigned int index, const double rgb[3])
106 {
107 this->SetIndexedColor(index, rgb[0], rgb[1], rgb[2]);
108 }
109 void SetIndexedColorRGBA(unsigned int index, const double rgba[4])
110 {
111 this->SetIndexedColor(index, rgba[0], rgba[1], rgba[2], rgba[3]);
112 }
113 void SetIndexedColor(unsigned int index, double r, double g, double b, double a = 1.0);
114
127 void GetIndexedColor(vtkIdType i, double rgba[4]) override;
128
130
135 void SetNumberOfIndexedColors(unsigned int count);
138
145 void Build() override;
146
148
154 vtkSetMacro(Discretize, vtkTypeBool);
155 vtkGetMacro(Discretize, vtkTypeBool);
156 vtkBooleanMacro(Discretize, vtkTypeBool);
158
160
164 virtual void SetUseLogScale(int useLogScale);
165 vtkGetMacro(UseLogScale, int);
167
169
174 vtkSetMacro(NumberOfValues, vtkIdType);
175 vtkGetMacro(NumberOfValues, vtkIdType);
177
182 const unsigned char* MapValue(double v) override;
183
188 void GetColor(double v, double rgb[3]) override;
189
193 double GetOpacity(double v) override;
194
200 void MapScalarsThroughTable2(void* input, unsigned char* output, int inputDataType,
201 int numberOfValues, int inputIncrement, int outputFormat) override;
202
210 void SetAlpha(double alpha) override;
211
213
218 void SetNanColor(double r, double g, double b) override;
219 void SetNanColor(const double rgb[3]) override { this->SetNanColor(rgb[0], rgb[1], rgb[2]); }
221
227 void SetNanOpacity(double a) override;
228
233 int UsingLogScale() override { return this->UseLogScale; }
234
239
241
247
249
252 vtkSetMacro(EnableOpacityMapping, bool);
253 vtkGetMacro(EnableOpacityMapping, bool);
254 vtkBooleanMacro(EnableOpacityMapping, bool);
256
261
262protected:
265
270
275
280
285
287
290
292
293private:
295 void operator=(const vtkDiscretizableColorTransferFunction&) = delete;
296
297 template <typename T, typename VectorGetter>
298 void MapVectorToOpacity(VectorGetter getter, T* scalars, int component, int numberOfComponents,
299 vtkIdType numberOfTuples, unsigned char* colors);
300
301 template <template <class> class VectorGetter>
302 void AllTypesMapVectorToOpacity(int scalarType, void* scalarsPtr, int component,
303 int numberOfComponents, vtkIdType numberOfTuples, unsigned char* colors);
304
305 class vtkInternals;
306 vtkInternals* Internals;
307};
308
309#endif
Abstract superclass for all arrays.
Defines a transfer function for mapping a property to an RGB color value.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
a combination of vtkColorTransferFunction and vtkLookupTable.
void SetNanColor(const double rgb[3]) override
Set the color to use when a NaN (not a number) is encountered.
unsigned int GetNumberOfIndexedColors()
Set the number of indexed colors.
vtkMTimeType GetMTime() override
Overridden to include the ScalarOpacityFunction's MTime.
vtkIdType NumberOfValues
Number of values to use in discretized color map.
int UseLogScale
Flag indicating whether log scaling is to be used.
void MapDataArrayToOpacity(vtkDataArray *scalars, int component, vtkUnsignedCharArray *colors)
void SetIndexedColorRGBA(unsigned int index, const double rgba[4])
void MapScalarsThroughTable2(void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputFormat) override
Map a set of scalars through the lookup table.
void GetColor(double v, double rgb[3]) override
Map one value through the lookup table and return the color as an RGB array of doubles between 0 and ...
void SetNumberOfIndexedColors(unsigned int count)
Set the number of indexed colors.
void GetIndexedColor(vtkIdType i, double rgba[4]) override
Get the "indexed color" assigned to an index.
const unsigned char * MapValue(double v) override
Map one value through the lookup table and return a color defined as a RGBA unsigned char tuple (4 by...
int IsOpaque(vtkAbstractArray *scalars, int colorMode, int component) override
Returns the negation of EnableOpacityMapping.
vtkTypeBool Discretize
Flag indicating whether transfer function is discretized.
void SetAlpha(double alpha) override
Specify an additional opacity (alpha) value to blend with.
virtual vtkPiecewiseFunction * GetScalarOpacityFunction() const
Set/get the opacity function to use.
vtkIdType GetNumberOfAvailableColors() override
Get the number of available colors for mapping to.
int IsOpaque(vtkAbstractArray *scalars, int colorMode, int component, vtkUnsignedCharArray *ghosts, unsigned char ghostsToSkip=0xff) override
Returns the negation of EnableOpacityMapping.
vtkSmartPointer< vtkPiecewiseFunction > ScalarOpacityFunction
virtual void SetUseLogScale(int useLogScale)
Get/Set if log scale must be used while mapping scalars to colors.
vtkLookupTable * LookupTable
Internal lookup table used for some aspects of the color mapping.
virtual void SetScalarOpacityFunction(vtkPiecewiseFunction *function)
Set/get the opacity function to use.
void SetIndexedColorRGB(unsigned int index, const double rgb[3])
Add colors to use when IndexedLookup is true.
double GetOpacity(double v) override
Return the opacity of a given scalar.
int IsOpaque() override
Returns the negation of EnableOpacityMapping.
void SetIndexedColor(unsigned int index, double r, double g, double b, double a=1.0)
void SetNanColor(double r, double g, double b) override
Set the color to use when a NaN (not a number) is encountered.
static vtkDiscretizableColorTransferFunction * New()
void SetNanOpacity(double a) override
Set the opacity to use when a NaN (not a number) is encountered.
int UsingLogScale() override
This should return 1 if the subclass is using log scale for mapping scalars to colors.
void PrintSelf(ostream &os, vtkIndent indent) override
Print method for vtkColorTransferFunction.
void Build() override
Generate discretized lookup table, if applicable.
a simple class to control print indentation
Definition: vtkIndent.h:119
map scalar values into colors via a lookup table
Defines a 1D piecewise function.
record modification and/or execution time
Definition: vtkTimeStamp.h:55
dynamic, self-adjusting array of unsigned char
@ component
Definition: vtkX3D.h:181
@ function
Definition: vtkX3D.h:255
@ alpha
Definition: vtkX3D.h:256
@ index
Definition: vtkX3D.h:252
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287