49 #ifndef vtkScalarsToColors_h
50 #define vtkScalarsToColors_h
52 #include "vtkCommonCoreModule.h"
56 VTK_ABI_NAMESPACE_BEGIN
94 virtual
void SetRange(
double min,
double max);
95 virtual
void SetRange(const
double rng[2]) { this->
SetRange(rng[0], rng[1]); }
116 this->GetColor(v, this->RGB);
135 this->GetColor(x, rgb);
136 return static_cast<double>(rgb[0] * 0.30 + rgb[1] * 0.59 + rgb[2] * 0.11);
147 vtkGetMacro(Alpha,
double);
182 vtkSetMacro(VectorMode,
int);
183 vtkGetMacro(VectorMode,
int);
201 vtkSetMacro(VectorComponent,
int);
202 vtkGetMacro(VectorComponent,
int);
213 vtkSetMacro(VectorSize,
int);
214 vtkGetMacro(VectorSize,
int);
225 int numberOfValues,
int inputIncrement,
int outputFormat,
int vectorComponent,
int vectorSize);
227 int numberOfValues,
int inputIncrement,
int outputFormat)
229 this->MapVectorsThroughTable(
230 input, output, inputDataType, numberOfValues, inputIncrement, outputFormat, -1, -1);
244 this->MapScalarsThroughTable(scalars, output,
VTK_RGBA);
247 int numberOfValues,
int inputIncrement,
int outputFormat)
249 this->MapScalarsThroughTable2(
250 input, output, inputDataType, numberOfValues, inputIncrement, outputFormat);
259 int numberOfValues,
int inputIncrement,
int outputFormat);
389 template <
typename T>
392 return static_cast<unsigned char>(t);
394 template <
typename T>
397 *dest = ColorToUChar(t);
416 void MapColorsToColors(
void* input,
unsigned char* output,
int inputDataType,
int numberOfValues,
417 int numberOfComponents,
int vectorSize,
int outputFormat);
431 int numberOfComponents,
int vectorSize);
449 class vtkInternalAnnotatedValueList;
461 #if !defined(VTK_LEGACY_REMOVE)
466 unsigned char RGBABytes[4];
470 double InputRange[2];
485 double temp = (t * 255.0) + 0.5;
486 return static_cast<unsigned char>(temp);
491 double temp = (t * 255.0) + 0.5;
492 return static_cast<unsigned char>(temp);
496 VTK_ABI_NAMESPACE_END
Abstract superclass for all arrays.
abstract superclass for arrays of numeric data
a simple class to control print indentation
abstract base class for most VTK objects
Superclass for mapping scalar values to colors.
virtual vtkTypeBool UsingLogScale()
This should return 1 if the subclass is using log scale for mapping scalars to colors.
static vtkScalarsToColors * New()
void MapScalarsThroughTable(vtkDataArray *scalars, unsigned char *output)
void MapColorsToColors(void *input, unsigned char *output, int inputDataType, int numberOfValues, int numberOfComponents, int vectorSize, int outputFormat)
An internal method that assumes that the input already has the right colors, and only remaps the rang...
virtual void DeepCopy(vtkScalarsToColors *o)
Copy the contents from another object.
vtkVariant GetAnnotatedValue(vtkIdType idx)
Return the annotated value at a particular index in the list of annotations.
void MapScalarsThroughTable(vtkDataArray *scalars, unsigned char *output, int outputFormat)
Map a set of scalars through the lookup table in a single operation.
virtual void UpdateAnnotatedValueMap()
Update the map from annotated values to indices in the array of annotations.
virtual vtkTypeBool IsOpaque(vtkAbstractArray *scalars, int colorMode, int component)
Return true if all of the values defining the mapping have an opacity equal to 1.
virtual void SetAlpha(double alpha)
Specify an additional opacity (alpha) value to blend with.
double GetLuminance(double x)
Map one value through the lookup table and return the luminance 0.3*red + 0.59*green + 0....
virtual vtkUnsignedCharArray * MapScalars(vtkAbstractArray *scalars, int colorMode, int component, int outputFormat=VTK_RGBA)
Internal methods that map a data array into an unsigned char array.
virtual void SetRange(const double rng[2])
Sets/Gets the range of scalars that will be mapped.
virtual void GetIndexedColor(vtkIdType i, double rgba[4])
Get the "indexed color" assigned to an index.
virtual vtkIdType SetAnnotation(vtkStdString value, vtkStdString annotation)
This variant of SetAnnotation accepts the value as a string so ParaView can treat annotations as stri...
virtual vtkTypeBool IsOpaque()
Return true if all of the values defining the mapping have an opacity equal to 1.
virtual vtkIdType GetNumberOfAvailableColors()
Get the number of available colors for mapping to.
static void ColorToUChar(T t, unsigned char *dest)
Converts a color from numeric type T to uchar.
double * GetColor(double v)
Map one value through the lookup table and return the color as an RGB array of doubles between 0 and ...
void MapScalarsThroughTable(void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputFormat)
virtual vtkUnsignedCharArray * MapScalars(vtkDataArray *scalars, int colorMode, int component, int outputFormat=VTK_RGBA)
Internal methods that map a data array into an unsigned char array.
void MapVectorsThroughTable(void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputFormat, int vectorComponent, int vectorSize)
Map vectors through the lookup table.
virtual bool RemoveAnnotation(vtkVariant value)
Remove an existing entry from the list of annotated values.
vtkTypeBool IndexedLookup
virtual const unsigned char * MapValue(double v)
Map one value through the lookup table and return a color defined as an RGBA unsigned char tuple (4 b...
virtual double GetOpacity(double v)
Map one value through the lookup table and return the alpha value (the opacity) as a double between 0...
void MapVectorsThroughTable(void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputFormat)
~vtkScalarsToColors() override
virtual void ResetAnnotations()
Remove all existing values and their annotations.
virtual vtkTypeBool IsOpaque(vtkAbstractArray *scalars, int colorMode, int component, vtkUnsignedCharArray *ghosts, unsigned char ghostsToSkip=0xff)
Return true if all of the values defining the mapping have an opacity equal to 1.
void SetVectorModeToComponent()
Change mode that maps vectors by magnitude vs.
void SetVectorModeToMagnitude()
Change mode that maps vectors by magnitude vs.
vtkIdType GetAnnotatedValueIndexInternal(const vtkVariant &val)
Look up an index into the array of annotations given a value.
virtual void SetAnnotations(vtkAbstractArray *values, vtkStringArray *annotations)
Set a list of discrete values, either as a categorical set of values (when IndexedLookup is true) or ...
static unsigned char ColorToUChar(T t)
Converts a color from numeric type T to uchar.
virtual void GetColor(double v, double rgb[3])
Map one value through the lookup table and store the color as an RGB array of doubles between 0 and 1...
vtkIdType GetNumberOfAnnotatedValues()
Return the annotated value at a particular index in the list of annotations.
virtual void MapScalarsThroughTable2(void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputFormat)
An internal method typically not used in applications.
virtual void Build()
Perform any processing required (if any) before processing scalars.
virtual vtkIdType SetAnnotation(vtkVariant value, vtkStdString annotation)
Add a new entry (or change an existing entry) to the list of annotated values.
virtual void GetAnnotationColor(const vtkVariant &val, double rgba[4])
Obtain the color associated with a particular annotated value (or NanColor if unmatched).
vtkInternalAnnotatedValueList * AnnotatedValueList
virtual double * GetRange()
Sets/Gets the range of scalars that will be mapped.
vtkAbstractArray * AnnotatedValues
virtual vtkIdType CheckForAnnotatedValue(vtkVariant value)
Allocate annotation arrays if needed, then return the index of the given value or -1 if not present.
void MapVectorsToMagnitude(void *input, double *output, int inputDataType, int numberOfValues, int numberOfComponents, int vectorSize)
An internal method for converting vectors to magnitudes, used as a preliminary step before doing magn...
vtkIdType GetAnnotatedValueIndex(vtkVariant val)
Return the index of the given value in the list of annotated values (or -1 if not present).
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkUnsignedCharArray * ConvertToRGBA(vtkDataArray *colors, int numComp, int numTuples)
An internal method used to convert a color array to RGBA.
vtkStringArray * Annotations
void SetVectorModeToRGBColors()
Change mode that maps vectors by magnitude vs.
vtkStdString GetAnnotation(vtkIdType idx)
Return the annotation at a particular index in the list of annotations.
Wrapper around std::string to keep symbols short.
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of unsigned char
A type representing the union of many types.
#define VTK_SIZEHINT(...)