Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# vtkLookupTable Class Reference

`#include <vtkLookupTable.h>`

Inheritance diagram for vtkLookupTable:

[legend]
Collaboration diagram for vtkLookupTable:

[legend]
List of all members.

## Detailed Description

map scalar values into colors via a lookup table

Date:
  2002/12/26 18:24:21

Revision:
  1.70

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 hue, saturation, value, and alpha range and generating a table.

See also:
  vtkLogLookupTable vtkWindowLevelLookupTable

Created by:
  - Martin, Ken

CVS contributions (if > 5%):
  - Schroeder, Will (39%)
  - Gobbi, David (27%)
  - Martin, Ken (11%)
  - Miller, Jim (5%)

CVS logs (CVSweb):
  - .`h` (`/Common/vtkLookupTable.h)`
  - .`cxx` (`/Common/vtkLookupTable.cxx)`

Examples:
  vtkLookupTable (Examples)

Tests:
  vtkLookupTable (Tests)

Definition at line 64 of file vtkLookupTable.h.

## Public Types

typedef vtkScalarsToColors | Superclass

## Public Methods

virtual const char * | GetClassName ()
virtual int | IsA (const char *type)
void | PrintSelf (ostream &os, vtkIndent indent)
int | Allocate (int sz=256, int ext=256)
virtual void | Build ()
virtual void | ForceBuild ()
unsigned char * | MapValue (float v)
float | GetOpacity (float v)
virtual vtkIdType | GetIndex (float v)
void | SetTableValue (vtkIdType indx, float rgba[4])
void | SetTableValue (vtkIdType indx, float r, float g, float b, float a=1.0)
float * | GetTableValue (vtkIdType id)
void | GetTableValue (vtkIdType id, float rgba[4])
unsigned char * | WritePointer (const vtkIdType id, const int number)
void | DeepCopy (vtkLookupTable *lut)
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 (float r[2])
virtual void | SetTableRange (float min, float max)
virtual float * | GetTableRange ()
virtual void | GetTableRange (float data[2])
virtual void | SetHueRange (float, float)
void | SetHueRange (float[2])
virtual float * | GetHueRange ()
virtual void | GetHueRange (float &, float &)
virtual void | GetHueRange (float[2])
virtual void | SetSaturationRange (float, float)
void | SetSaturationRange (float[2])
virtual float * | GetSaturationRange ()
virtual void | GetSaturationRange (float &, float &)
virtual void | GetSaturationRange (float[2])
virtual void | SetValueRange (float, float)
void | SetValueRange (float[2])
virtual float * | GetValueRange ()
virtual void | GetValueRange (float &, float &)
virtual void | GetValueRange (float[2])
virtual void | SetAlphaRange (float, float)
void | SetAlphaRange (float[2])
virtual float * | GetAlphaRange ()
virtual void | GetAlphaRange (float &, float &)
virtual void | GetAlphaRange (float[2])
float * | GetColor (float x)
void | GetColor (float x, float rgb[3])
void | SetNumberOfTableValues (vtkIdType number)
vtkIdType | GetNumberOfTableValues ()
unsigned char * | GetPointer (const vtkIdType id)
float * | GetRange ()
void | SetRange (float min, float max)
void | SetRange (float rng[2])
virtual void | SetNumberOfColors (vtkIdType)
virtual vtkIdType | GetNumberOfColors ()
void | MapScalarsThroughTable2 (void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputIncrement)

## Static Public Methods

vtkLookupTable * | New ()
int | IsTypeOf (const char *type)
vtkLookupTable * | SafeDownCast (vtkObject *o)

## Protected Methods

| vtkLookupTable (int sze=256, int ext=256)
| ~vtkLookupTable ()

## Protected Attributes

vtkIdType | NumberOfColors
vtkUnsignedCharArray * | Table
float | TableRange [2]
float | HueRange [2]
float | SaturationRange [2]
float | ValueRange [2]
float | AlphaRange [2]
int | Scale
int | Ramp
vtkTimeStamp | InsertTime
vtkTimeStamp | BuildTime
float | RGBA [4]

## Member Typedef Documentation

typedef vtkScalarsToColors vtkLookupTable::Superclass

| Reimplemented from vtkScalarsToColors. Reimplemented in vtkLogLookupTable, and vtkWindowLevelLookupTable. Definition at line 71 of file vtkLookupTable.h.

## Constructor & Destructor Documentation

vtkLookupTable::vtkLookupTable | ( | int | sze = 256,
|  | int | ext = 256
| ) | `[protected]`

vtkLookupTable::~vtkLookupTable | ( |  | ) | `[protected]`

## Member Function Documentation

vtkLookupTable* vtkLookupTable::New | ( |  | ) | `[static]`

| Construct with range=[0,1]; and hsv ranges set up for rainbow color table (from red to blue). Reimplemented from vtkObject. Reimplemented in vtkLogLookupTable, and vtkWindowLevelLookupTable.

virtual const char* vtkLookupTable::GetClassName | ( |  | ) | `[virtual]`

| Reimplemented from vtkScalarsToColors. Reimplemented in vtkLogLookupTable, and vtkWindowLevelLookupTable.

int vtkLookupTable::IsTypeOf | ( | const char * | type | ) | `[static]`

| Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkScalarsToColors. Reimplemented in vtkLogLookupTable, and vtkWindowLevelLookupTable.

virtual int vtkLookupTable::IsA | ( | const char * | type | ) | `[virtual]`

| Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkScalarsToColors. Reimplemented in vtkLogLookupTable, and vtkWindowLevelLookupTable.

vtkLookupTable* vtkLookupTable::SafeDownCast | ( | vtkObject * | o | ) | `[static]`

| Reimplemented from vtkScalarsToColors. Reimplemented in vtkLogLookupTable, and vtkWindowLevelLookupTable.

void vtkLookupTable::PrintSelf | ( | ostream & | os,
|  | vtkIndent | indent
| ) | `[virtual]`

| Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes. Reimplemented from vtkScalarsToColors. Reimplemented in vtkLogLookupTable, and vtkWindowLevelLookupTable.

int vtkLookupTable::Allocate | ( | int | sz = 256,
|  | int | ext = 256
| ) |

| Allocate a color table of specified size.

virtual void vtkLookupTable::Build | ( |  | ) | `[virtual]`

| Generate lookup table from hue, saturation, value, alpha min/max values. Table is built from linear ramp of each value. Reimplemented from vtkScalarsToColors. Reimplemented in vtkWindowLevelLookupTable.

virtual void vtkLookupTable::ForceBuild | ( |  | ) | `[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.

virtual void vtkLookupTable::SetRamp | ( | int |  | ) | `[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).

void vtkLookupTable::SetRampToLinear | ( |  | ) | `[inline]`

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).

Definition at line 97 of file vtkLookupTable.h.

References VTK_RAMP_LINEAR.

void vtkLookupTable::SetRampToSCurve | ( |  | ) | `[inline]`

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).

Definition at line 98 of file vtkLookupTable.h.

References VTK_RAMP_SCURVE.

void vtkLookupTable::SetRampToSQRT | ( |  | ) | `[inline]`

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).

Definition at line 99 of file vtkLookupTable.h.

References VTK_RAMP_SQRT.

virtual int vtkLookupTable::GetRamp | ( |  | ) | `[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).

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::SetScaleToLinear | ( |  | ) | `[inline]`

| 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. Definition at line 108 of file vtkLookupTable.h. References VTK_SCALE_LINEAR.

void vtkLookupTable::SetScaleToLog10 | ( |  | ) | `[inline]`

| 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. Definition at line 109 of file vtkLookupTable.h. References VTK_SCALE_LOG10.

virtual int vtkLookupTable::GetScale | ( |  | ) | `[virtual]`

| 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::SetTableRange | ( | float | 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. Referenced by vtkWindowLevelLookupTable::SetLevel(), and vtkWindowLevelLookupTable::SetWindow().

virtual void vtkLookupTable::SetTableRange | ( | float | min,
|  | float | max
| ) | `[virtual]`

| 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.

virtual float* vtkLookupTable::GetTableRange | ( |  | ) | `[virtual]`

| 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.

virtual void vtkLookupTable::GetTableRange | ( | float | data[2] | ) | `[virtual]`

| 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.

virtual void vtkLookupTable::SetHueRange | ( | float | ,
|  | float |
| ) | `[virtual]`

| Set the range in hue (using automatic generation). Hue ranges between [0,1].

void vtkLookupTable::SetHueRange | ( | float | [2] | ) |

| Set the range in hue (using automatic generation). Hue ranges between [0,1].

virtual float* vtkLookupTable::GetHueRange | ( |  | ) | `[virtual]`

| Set the range in hue (using automatic generation). Hue ranges between [0,1].

virtual void vtkLookupTable::GetHueRange | ( | float & | ,
|  | float & |
| ) | `[virtual]`

| Set the range in hue (using automatic generation). Hue ranges between [0,1].

virtual void vtkLookupTable::GetHueRange | ( | float | [2] | ) | `[virtual]`

| Set the range in hue (using automatic generation). Hue ranges between [0,1].

virtual void vtkLookupTable::SetSaturationRange | ( | float | ,
|  | float |
| ) | `[virtual]`

| Set the range in saturation (using automatic generation). Saturation ranges between [0,1].

void vtkLookupTable::SetSaturationRange | ( | float | [2] | ) |

| Set the range in saturation (using automatic generation). Saturation ranges between [0,1].

virtual float* vtkLookupTable::GetSaturationRange | ( |  | ) | `[virtual]`

| Set the range in saturation (using automatic generation). Saturation ranges between [0,1].

virtual void vtkLookupTable::GetSaturationRange | ( | float & | ,
|  | float & |
| ) | `[virtual]`

| Set the range in saturation (using automatic generation). Saturation ranges between [0,1].

virtual void vtkLookupTable::GetSaturationRange | ( | float | [2] | ) | `[virtual]`

| Set the range in saturation (using automatic generation). Saturation ranges between [0,1].

virtual void vtkLookupTable::SetValueRange | ( | float | ,
|  | float |
| ) | `[virtual]`

| Set the range in value (using automatic generation). Value ranges between [0,1].

void vtkLookupTable::SetValueRange | ( | float | [2] | ) |

| Set the range in value (using automatic generation). Value ranges between [0,1].

virtual float* vtkLookupTable::GetValueRange | ( |  | ) | `[virtual]`

| Set the range in value (using automatic generation). Value ranges between [0,1].

virtual void vtkLookupTable::GetValueRange | ( | float & | ,
|  | float & |
| ) | `[virtual]`

| Set the range in value (using automatic generation). Value ranges between [0,1].

virtual void vtkLookupTable::GetValueRange | ( | float | [2] | ) | `[virtual]`

| Set the range in value (using automatic generation). Value ranges between [0,1].

virtual void vtkLookupTable::SetAlphaRange | ( | float | ,
|  | float |
| ) | `[virtual]`

| Set the range in alpha (using automatic generation). Alpha ranges from [0,1].

void vtkLookupTable::SetAlphaRange | ( | float | [2] | ) |

| Set the range in alpha (using automatic generation). Alpha ranges from [0,1].

virtual float* vtkLookupTable::GetAlphaRange | ( |  | ) | `[virtual]`

| Set the range in alpha (using automatic generation). Alpha ranges from [0,1].

virtual void vtkLookupTable::GetAlphaRange | ( | float & | ,
|  | float & |
| ) | `[virtual]`

| Set the range in alpha (using automatic generation). Alpha ranges from [0,1].

virtual void vtkLookupTable::GetAlphaRange | ( | float | [2] | ) | `[virtual]`

| Set the range in alpha (using automatic generation). Alpha ranges from [0,1].

unsigned char* vtkLookupTable::MapValue | ( | float | v | ) | `[virtual]`

| Map one value through the lookup table. Implements vtkScalarsToColors.

float* vtkLookupTable::GetColor | ( | float | x | ) | `[inline]`

| Map one value through the lookup table and return the color as an RGB array of floats between 0 and 1. Reimplemented from vtkScalarsToColors. Definition at line 157 of file vtkLookupTable.h. References vtkScalarsToColors::GetColor().

void vtkLookupTable::GetColor | ( | float | x,
|  | float | rgb[3]
| ) | `[virtual]`

| Map one value through the lookup table and return the color as an RGB array of floats between 0 and 1. Implements vtkScalarsToColors.

float vtkLookupTable::GetOpacity | ( | float | v | ) |

| Map one value through the lookup table and return the alpha value (the opacity) as a float between 0 and 1.

virtual vtkIdType vtkLookupTable::GetIndex | ( | float | v | ) | `[virtual]`

| Return the table index associated with a particular value.

void vtkLookupTable::SetNumberOfTableValues | ( | vtkIdType | number | ) |

| Specify the number of values (i.e., colors) in the lookup table.

vtkIdType vtkLookupTable::GetNumberOfTableValues | ( |  | ) | `[inline]`

| Specify the number of values (i.e., colors) in the lookup table. Definition at line 171 of file vtkLookupTable.h. References vtkIdType.

void vtkLookupTable::SetTableValue | ( | vtkIdType | indx,
|  | float | rgba[4]
| ) |

| Directly load color into lookup table. Use [0,1] float values for color component specification. Make sure that you've either used the Build() method or used SetNumberOfTableValues() prior to using this method.

void vtkLookupTable::SetTableValue | ( | vtkIdType | indx,
|  | float | r,
|  | float | g,
|  | float | b,
|  | float | a = 1.0
| ) |

| Directly load color into lookup table. Use [0,1] float values for color component specification.

float* vtkLookupTable::GetTableValue | ( | vtkIdType | id | ) |

| Return a rgba color value for the given index into the lookup table. Color components are expressed as [0,1] float values.

void vtkLookupTable::GetTableValue | ( | vtkIdType | id,
|  | float | rgba[4]
| ) |

| Return a rgba color value for the given index into the lookup table. Color components are expressed as [0,1] float values.

unsigned char* vtkLookupTable::GetPointer | ( | const vtkIdType | id | ) | `[inline]`

| Get pointer to color table data. Format is array of unsigned char r-g-b-a-r-g-b-a... Definition at line 195 of file vtkLookupTable.h. References id, and vtkIdType.

unsigned char * vtkLookupTable::WritePointer | ( | const vtkIdType | id,
|  | const int | number
| ) | `[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. Definition at line 254 of file vtkLookupTable.h. References id, Table, vtkIdType, and vtkUnsignedCharArray::WritePointer().

float* vtkLookupTable::GetRange | ( |  | ) | `[inline, virtual]`

| Sets/Gets the range of scalars which will be mapped. This is a duplicate of Get/SetTableRange. Implements vtkScalarsToColors. Definition at line 208 of file vtkLookupTable.h.

void vtkLookupTable::SetRange | ( | float | min,
|  | float | max
| ) | `[inline, virtual]`

| Sets/Gets the range of scalars which will be mapped. This is a duplicate of Get/SetTableRange. Implements vtkScalarsToColors. Definition at line 209 of file vtkLookupTable.h.

void vtkLookupTable::SetRange | ( | float | rng[2] | ) | `[inline]`

| Sets/Gets the range of scalars which will be mapped. This is a duplicate of Get/SetTableRange. Reimplemented from vtkScalarsToColors. Definition at line 210 of file vtkLookupTable.h. References vtkScalarsToColors::SetRange().

virtual void vtkLookupTable::SetNumberOfColors | ( | vtkIdType |  | ) | `[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.

virtual vtkIdType vtkLookupTable::GetNumberOfColors | ( |  | ) | `[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::MapScalarsThroughTable2 | ( | void * | input,
|  | unsigned char * | output,
|  | int | inputDataType,
|  | int | numberOfValues,
|  | int | inputIncrement,
|  | int | outputIncrement
| ) | `[virtual]`

| map a set of scalars through the lookup table Implements vtkScalarsToColors.

void vtkLookupTable::DeepCopy | ( | vtkLookupTable * | lut | ) |

| Copy the contents from another LookupTable

## Member Data Documentation

vtkIdType vtkLookupTable::NumberOfColors`[protected]`

| Definition at line 236 of file vtkLookupTable.h.

vtkUnsignedCharArray* vtkLookupTable::Table`[protected]`

| Definition at line 237 of file vtkLookupTable.h. Referenced by WritePointer().

float vtkLookupTable::TableRange[2]`[protected]`

| Definition at line 238 of file vtkLookupTable.h.

float vtkLookupTable::HueRange[2]`[protected]`

| Definition at line 239 of file vtkLookupTable.h.

float vtkLookupTable::SaturationRange[2]`[protected]`

| Definition at line 240 of file vtkLookupTable.h.

float vtkLookupTable::ValueRange[2]`[protected]`

| Definition at line 241 of file vtkLookupTable.h.

float vtkLookupTable::AlphaRange[2]`[protected]`

| Definition at line 242 of file vtkLookupTable.h.

int vtkLookupTable::Scale`[protected]`

| Definition at line 243 of file vtkLookupTable.h.

int vtkLookupTable::Ramp`[protected]`

| Definition at line 244 of file vtkLookupTable.h.

vtkTimeStamp vtkLookupTable::InsertTime`[protected]`

| Definition at line 245 of file vtkLookupTable.h.

vtkTimeStamp vtkLookupTable::BuildTime`[protected]`

| Definition at line 246 of file vtkLookupTable.h.

float vtkLookupTable::RGBA[4]`[protected]`

| Definition at line 247 of file vtkLookupTable.h.

The documentation for this class was generated from the following file:

- Common/vtkLookupTable.h