Man Page for vtkLookupTable
Table of Contents

NAME

vtkLookupTable - map scalar values into colors or colors to scalars; generate color table

SYNOPSIS


#include "/opt/vtk-c++/common/vtkLookupTable.h"

class VTK_EXPORT vtkLookupTable : public vtkReferenceCount

vtkLookupTable(int sze=256, int ext=256);
int Allocate(int sz=256, int ext=256);
virtual void Build();
static vtkLookupTable *New() {return new vtkLookupTable;};
const char *GetClassName() {return "vtkLookupTable";};
void PrintSelf(ostream& os, vtkIndent indent);
void SetNumberOfColors(int);
int GetNumberOfColors();

void SetTableRange(float r[2]);
can't use macro `cause don't want modified
virtual void SetTableRange(float min, float max);
float *GetTableRange();
void GetTableRange(float data[2]);
void SetHueRange(float, float);
void SetHueRange(float *);
float *GetHueRange();
void GetHueRange(float data[2]);
void SetSaturationRange(float, float);
void SetSaturationRange(float *);
float *GetSaturationRange();
void GetSaturationRange(float data[2]);
void SetValueRange(float, float);
void SetValueRange(float *);
float *GetValueRange();
void GetValueRange(float data[2]);
void SetAlphaRange(float, float);
void SetAlphaRange(float *);
float *GetAlphaRange();
void GetAlphaRange(float data[2]);
virtual unsigned char *MapValue(float v);
void SetNumberOfTableValues(int number);
void SetTableValue (int indx, float rgba[4]);
void SetTableValue (int indx, float r, float g, float b, float a=1.0);
float *GetTableValue (int id);
void GetTableValue (int id, float rgba[4]);
unsigned char *GetPointer(const int id);
unsigned char *WritePointer(const int id, const int number);

DESCRIPTION

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.

This class is designed as a base class for derivation by other classes. The Build(), MapValue(), and SetTableRange() methods are virtual and may require overloading in subclasses.

CAVEATS

vtkLookupTable is a reference counted object. Therefore, you should always use operator "new" to construct new objects. This procedure will avoid memory problems (see text).

SEE ALSO

vtkLogLookupTable vtkWindowLevelLookupTable

SUMMARY

void SetNumberOfColors(int)
Set the number of colors in the lookup table. Use this method before building the lookup table. Use SetNumberOfTableValues() to change the table size after the
lookup table has been built.

void SetHueRange(float, float)
void SetHueRange(float *)
Set the range in hue (using automatic generation). Hue ranges between (0,1).

void SetSaturationRange(float, float)
void SetSaturationRange(float *)
Set the range in saturation (using automatic generation). Saturation ranges between (0,1).

void SetValueRange(float, float)
void SetValueRange(float *)
Set the range in value (using automatic generation). Value ranges between (0,1).

void SetAlphaRange(float, float)
void SetAlphaRange(float *)
Set the range in alpha (using automatic generation). Alpha ranges from (0,1).

unsigned char *GetPointer(const int id)
Get pointer to color table data. Format is array of unsigned char r-g-b-a-r-g-b-a...

unsigned char *WritePointer(const int id, const int number) 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.

vtkLookupTable(int sze, int ext)
Construct with range=(0,1); and hsv ranges set up for rainbow color table (from red to blue).

int Allocate(int sz, int ext)
Allocate a color table of specified size.

void SetTableRange(float r[2])
Set 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.

void SetTableRange(float min, float max)
Set 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.

void Build()
Generate lookup table from hue, saturation, value, alpha min/max values. Table is built from linear ramp of each value.

unsigned char *MapValue(float v)
Given a scalar value v, return an rgba color value from lookup table.

void SetNumberOfTableValues(int number)
Specify the number of values (i.e., colors) in the lookup table. This method simply allocates memory and prepares the table for use with SetTableValue(). It differs from Build() method in that the allocated memory is not initialized according to HSVA ramps.

void SetTableValue (int 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 SetTableValue(int indx, float r, float g, float b, float a)
Directly load color into lookup table. Use [0,1] float values for color component specification.

float *GetTableValue (int indx)
Return a rgba color value for the given index into the lookup table. Color components are expressed as [0,1] float values.

void GetTableValue (int indx, 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.


Table of Contents