vtk-dicom
0.8.17
|
map scalar values into colors via a lookup table More...
#include <vtkLookupTable.h>
Public Types | |
typedef vtkScalarsToColors | Superclass |
Public Member Functions | |
virtual vtkTypeBool | IsA (const char *type) |
vtkLookupTable * | NewInstance () const |
void | PrintSelf (ostream &os, vtkIndent indent) VTK_OVERRIDE |
int | IsOpaque () VTK_OVERRIDE |
int | Allocate (int sz=256, int ext=256) |
void | Build () VTK_OVERRIDE |
virtual void | ForceBuild () |
void | BuildSpecialColors () |
virtual void | SetRamp (int) |
void | SetRampToLinear () |
void | SetRampToSCurve () |
void | SetRampToSQRT () |
virtual int | GetRamp () |
void | SetScale (int scale) |
void | SetScaleToLinear () |
void | SetScaleToLog10 () |
virtual int | GetScale () |
void | SetTableRange (double r[2]) |
virtual void | SetTableRange (double min, double max) |
virtual double * | GetTableRange () |
virtual void | GetTableRange (double data[2]) |
virtual void | SetHueRange (double, double) |
void | SetHueRange (double[2]) |
virtual double * | GetHueRange () |
virtual void | GetHueRange (double &, double &) |
virtual void | GetHueRange (double[2]) |
virtual void | SetSaturationRange (double, double) |
void | SetSaturationRange (double[2]) |
virtual double * | GetSaturationRange () |
virtual void | GetSaturationRange (double &, double &) |
virtual void | GetSaturationRange (double[2]) |
virtual void | SetValueRange (double, double) |
void | SetValueRange (double[2]) |
virtual double * | GetValueRange () |
virtual void | GetValueRange (double &, double &) |
virtual void | GetValueRange (double[2]) |
virtual void | SetAlphaRange (double, double) |
void | SetAlphaRange (double[2]) |
virtual double * | GetAlphaRange () |
virtual void | GetAlphaRange (double &, double &) |
virtual void | GetAlphaRange (double[2]) |
virtual void | SetNanColor (double, double, double, double) |
virtual void | SetNanColor (double[4]) |
virtual double * | GetNanColor () |
virtual void | GetNanColor (double &, double &, double &, double &) |
virtual void | GetNanColor (double[4]) |
unsigned char * | GetNanColorAsUnsignedChars () |
virtual void | SetBelowRangeColor (double, double, double, double) |
virtual void | SetBelowRangeColor (double[4]) |
virtual double * | GetBelowRangeColor () |
virtual void | GetBelowRangeColor (double &, double &, double &, double &) |
virtual void | GetBelowRangeColor (double[4]) |
virtual void | SetUseBelowRangeColor (int) |
virtual int | GetUseBelowRangeColor () |
virtual void | UseBelowRangeColorOn () |
virtual void | UseBelowRangeColorOff () |
virtual void | SetAboveRangeColor (double, double, double, double) |
virtual void | SetAboveRangeColor (double[4]) |
virtual double * | GetAboveRangeColor () |
virtual void | GetAboveRangeColor (double &, double &, double &, double &) |
virtual void | GetAboveRangeColor (double[4]) |
virtual void | SetUseAboveRangeColor (int) |
virtual int | GetUseAboveRangeColor () |
virtual void | UseAboveRangeColorOn () |
virtual void | UseAboveRangeColorOff () |
unsigned char * | MapValue (double v) VTK_OVERRIDE |
void | GetColor (double x, double rgb[3]) VTK_OVERRIDE |
double | GetOpacity (double v) VTK_OVERRIDE |
virtual vtkIdType | GetIndex (double v) |
void | SetNumberOfTableValues (vtkIdType number) |
vtkIdType | GetNumberOfTableValues () |
virtual void | SetTableValue (vtkIdType indx, double rgba[4]) |
virtual void | SetTableValue (vtkIdType indx, double r, double g, double b, double a=1.0) |
double * | GetTableValue (vtkIdType id) |
void | GetTableValue (vtkIdType id, double rgba[4]) |
unsigned char * | GetPointer (const vtkIdType id) |
unsigned char * | WritePointer (const vtkIdType id, const int number) |
double * | GetRange () VTK_OVERRIDE |
void | SetRange (double min, double max) VTK_OVERRIDE |
void | SetRange (double rng[2]) |
virtual void | SetNumberOfColors (vtkIdType) |
virtual vtkIdType | GetNumberOfColors () |
void | SetTable (vtkUnsignedCharArray *) |
virtual vtkUnsignedCharArray * | GetTable () |
void | MapScalarsThroughTable2 (void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputIncrement) VTK_OVERRIDE |
void | DeepCopy (vtkScalarsToColors *lut) VTK_OVERRIDE |
int | UsingLogScale () VTK_OVERRIDE |
vtkIdType | GetNumberOfAvailableColors () VTK_OVERRIDE |
void | GetIndexedColor (vtkIdType idx, double rgba[4]) VTK_OVERRIDE |
Static Public Member Functions | |
static vtkLookupTable * | New () |
static vtkTypeBool | IsTypeOf (const char *type) |
static vtkLookupTable * | SafeDownCast (vtkObjectBase *o) |
static void | GetColorAsUnsignedChars (const double colorIn[4], unsigned char colorOut[4]) |
static void | GetLogRange (const double range[2], double log_range[2]) |
static double | ApplyLogScale (double v, const double range[2], const double log_range[2]) |
Static Public Attributes | |
static const vtkIdType | BELOW_RANGE_COLOR_INDEX |
static const vtkIdType | ABOVE_RANGE_COLOR_INDEX |
static const vtkIdType | NAN_COLOR_INDEX |
static const vtkIdType | NUMBER_OF_SPECIAL_COLORS |
Protected Member Functions | |
virtual vtkObjectBase * | NewInstanceInternal () const |
vtkLookupTable (int sze=256, int ext=256) | |
void | ResizeTableForSpecialColors () |
map scalar values into colors via a lookup table
vtkLookupTable is an object that is used by mapper objects to map scalar values into RGBA (red-green-blue-alpha transparency) color specification, or RGBA into scalar values. The color table can be created by direct insertion of color values, or by specifying a hue, saturation, value, and alpha range and generating a table.
A special color for NaN values in the data can be specified via SetNanColor(). In addition, a color for data values below the lookup table range minimum can be specified with SetBelowRangeColor(), and that color will be used for values below the range minimum when UseBelowRangeColor is on. Likewise, a color for data values above the lookup table range maximum can be specified with SetAboveRangeColor(), and it is used when UseAboveRangeColor is on.
This class behaves differently depending on how IndexedLookup is set. When true, vtkLookupTable enters a mode for representing categorical color maps. By setting IndexedLookup to true, you indicate that the annotated values are the only valid values for which entries in the color table should be returned. The colors in the lookup Table are assigned to annotated values by taking the modulus of their index in the list of annotations. IndexedLookup changes the behavior of GetIndex, which in turn changes the way MapScalarsThroughTable2 behaves; when IndexedLookup is true, MapScalarsThroughTable2 will search for scalar values in AnnotatedValues and use the resulting index to determine the color. If a scalar value is not present in AnnotatedValues, then NanColor will be used.
int vtkLookupTable::Allocate | ( | int | sz = 256 , |
int | ext = 256 |
||
) |
Allocate a color table of specified size.
|
static |
Apply log to value, with appropriate constraints.
void vtkLookupTable::Build | ( | ) |
Generate lookup table from hue, saturation, value, alpha min/max values. Table is built from linear ramp of each value.
void vtkLookupTable::BuildSpecialColors | ( | ) |
Copies the "special" colors into the given table.
void vtkLookupTable::DeepCopy | ( | vtkScalarsToColors * | lut | ) |
Copy the contents from another LookupTable
|
virtual |
Force the lookup table to regenerate from hue, saturation, value, and alpha min/max values. Table is built from a linear ramp of each value. ForceBuild() is useful if a lookup table has been defined manually (using SetTableValue) and then an application decides to rebuild the lookup table using the implicit process.
void vtkLookupTable::GetColor | ( | double | x, |
double | rgb[3] | ||
) |
Map one value through the lookup table and return the color as an RGB array of doubles between 0 and 1.
|
static |
Cast a double color in a type T color. colorIn and colorOut are expected to be RGBA[4] and colorIn to be in [0.0, 1.0]
|
virtual |
Return the table index associated with a particular value.
Do not use this function when IndexedLookup is true: in that case, the set of values v may take on is exactly the integers from 0 to GetNumberOfTableValues() - 1; and v serves directly as an index into TableValues.
void vtkLookupTable::GetIndexedColor | ( | vtkIdType | idx, |
double | rgba[4] | ||
) |
Return a color given an integer index.
This is used to assign colors to annotations (given an offset into the list of annotations). If the table is empty or idx < 0, then NanColor is returned.
|
static |
Returns the log of range
in log_range
. There is a little more to this than simply taking the log10 of the two range values: we do conversion of negative ranges to positive ranges, and conversion of zero to a 'very small number'.
unsigned char* vtkLookupTable::GetNanColorAsUnsignedChars | ( | ) |
Return the NanColor as a pointer to 4 unsigned chars. This will overwrite any data returned by previous calls to MapValue.
vtkIdType vtkLookupTable::GetNumberOfAvailableColors | ( | ) |
Get the number of available colors for mapping to.
double vtkLookupTable::GetOpacity | ( | double | v | ) |
Map one value through the lookup table and return the alpha value (the opacity) as a double between 0 and 1.
|
inline |
Get pointer to color table data. Format is array of unsigned char r-g-b-a-r-g-b-a...
|
inline |
Sets/Gets the range of scalars which will be mapped. This is a duplicate of Get/SetTableRange.
double* vtkLookupTable::GetTableValue | ( | vtkIdType | id | ) |
Return a rgba color value for the given index into the lookup table. Color components are expressed as [0,1] double values.
void vtkLookupTable::GetTableValue | ( | vtkIdType | id, |
double | rgba[4] | ||
) |
Return a rgba color value for the given index into the lookup table. Color components are expressed as [0,1] double values.
int vtkLookupTable::IsOpaque | ( | ) |
Return true if all of the values defining the mapping have an opacity equal to 1.
void vtkLookupTable::MapScalarsThroughTable2 | ( | void * | input, |
unsigned char * | output, | ||
int | inputDataType, | ||
int | numberOfValues, | ||
int | inputIncrement, | ||
int | outputIncrement | ||
) |
map a set of scalars through the lookup table
This member function is thread safe.
unsigned char* vtkLookupTable::MapValue | ( | double | v | ) |
Map one value through the lookup table.
|
static |
Construct with range=[0,1]; and hsv ranges set up for rainbow color table (from red to blue).
|
protected |
Resize the LookupTable to have enough room for the out-of-range colors
|
virtual |
Set the color to use when a value above the range is encountered. This is an RGBA 4-tuple of doubles in the range [0, 1].
|
virtual |
Set the range in alpha (using automatic generation). Alpha ranges from [0,1].
|
virtual |
Set the color to use when a value below the range is encountered. This is an RGBA 4-tuple of doubles in the range [0, 1].
|
virtual |
Set the range in hue (using automatic generation). Hue ranges between [0,1].
|
virtual |
Set the color to use when a NaN (not a number) is encountered. This is an RGBA 4-tuple of doubles in the range [0,1].
|
virtual |
Set the number of colors in the lookup table. Use SetNumberOfTableValues() instead, it can be used both before and after the table has been built whereas SetNumberOfColors() has no effect after the table has been built.
void vtkLookupTable::SetNumberOfTableValues | ( | vtkIdType | number | ) |
Specify the number of values (i.e., colors) in the lookup table.
|
virtual |
Set the shape of the table ramp to either linear or S-curve. The default is S-curve, which tails off gradually at either end. The equation used for the S-curve is y = (sin((x - 1/2)*pi) + 1)/2, while the equation for the linear ramp is simply y = x. For an S-curve greyscale ramp, you should set NumberOfTableValues to 402 (which is 256*pi/2) to provide room for the tails of the ramp. The equation for the SQRT is y = sqrt(x).
|
virtual |
Set the range in saturation (using automatic generation). Saturation ranges between [0,1].
void vtkLookupTable::SetScale | ( | int | scale | ) |
Set the type of scale to use, linear or logarithmic. The default is linear. If the scale is logarithmic, then the TableRange must not cross the value zero.
void vtkLookupTable::SetTable | ( | vtkUnsignedCharArray * | ) |
Set/Get the internal table array that is used to map the scalars to colors. The table array is an unsigned char array with 4 components representing RGBA.
void vtkLookupTable::SetTableRange | ( | double | r[2] | ) |
Set/Get the minimum/maximum scalar values for scalar mapping. Scalar values less than minimum range value are clamped to minimum range value. Scalar values greater than maximum range value are clamped to maximum range value.
The TableRange values are only used when IndexedLookup is false.
|
virtual |
Directly load color into lookup table. Use [0,1] double values for color component specification.
|
virtual |
Directly load color into lookup table. Use [0,1] double values for color component specification. Make sure that you've either used the Build() method or used SetNumberOfTableValues() prior to using this method.
|
virtual |
Set whether the below range color should be used.
|
virtual |
Set whether the below range color should be used.
|
virtual |
Set the range in value (using automatic generation). Value ranges between [0,1].
|
inline |
This should return 1 is the subclass is using log scale for mapping scalars to colors. Returns 1 is scale == VTK_SCALE_LOG10.
|
inline |
Get pointer to data. Useful for direct writes into object. MaxId is bumped by number (and memory allocated if necessary). Id is the location you wish to write into; number is the number of rgba values to write.
|
static |
Constants for offsets of special colors (e.g., NanColor, BelowRangeColor, AboveRangeColor) from the maximum index in the lookup table.