VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
vtkScalarsToColors Class Reference

Superclass for mapping scalar values to colors. More...

#include <vtkScalarsToColors.h>

Inheritance diagram for vtkScalarsToColors:
Inheritance graph
[legend]
Collaboration diagram for vtkScalarsToColors:
Collaboration graph
[legend]

List of all members.

Public Types

enum  VectorModes { MAGNITUDE = 0, COMPONENT = 1, RGBCOLORS = 2 }
typedef vtkObject Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
virtual int IsOpaque ()
virtual void Build ()
virtual unsigned char * MapValue (double v)
virtual void GetColor (double v, double rgb[3])
virtual double GetOpacity (double v)
virtual void DeepCopy (vtkScalarsToColors *o)
virtual vtkIdType GetNumberOfAvailableColors ()
virtual doubleGetRange ()
virtual void SetRange (double min, double max)
void SetRange (double rng[2])
doubleGetColor (double v)
double GetLuminance (double x)
virtual void SetAlpha (double alpha)
virtual double GetAlpha ()
virtual vtkUnsignedCharArrayMapScalars (vtkDataArray *scalars, int colorMode, int component)
virtual void SetVectorMode (int)
virtual int GetVectorMode ()
void SetVectorModeToMagnitude ()
void SetVectorModeToComponent ()
void SetVectorModeToRGBColors ()
virtual void SetVectorComponent (int)
virtual int GetVectorComponent ()
virtual void SetVectorSize (int)
virtual int GetVectorSize ()
void MapVectorsThroughTable (void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputFormat, int vectorComponent, int vectorSize)
void MapVectorsThroughTable (void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputFormat)
void MapScalarsThroughTable (vtkDataArray *scalars, unsigned char *output, int outputFormat)
void MapScalarsThroughTable (vtkDataArray *scalars, unsigned char *output)
void MapScalarsThroughTable (void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputFormat)
virtual void MapScalarsThroughTable2 (void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputFormat)
virtual vtkUnsignedCharArrayConvertUnsignedCharToRGBA (vtkUnsignedCharArray *colors, int numComp, int numTuples)
virtual int UsingLogScale ()

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkScalarsToColorsSafeDownCast (vtkObject *o)
static vtkScalarsToColorsNew ()

Protected Member Functions

 vtkScalarsToColors ()
 ~vtkScalarsToColors ()
void MapColorsToColors (void *input, unsigned char *output, int inputDataType, int numberOfValues, int numberOfComponents, int vectorSize, int outputFormat)
void MapVectorsToMagnitude (void *input, double *output, int inputDataType, int numberOfValues, int numberOfComponents, int vectorSize)

Protected Attributes

double Alpha
int VectorMode
int VectorComponent
int VectorSize
int UseMagnitude

Detailed Description

Superclass for mapping scalar values to colors.

vtkScalarsToColors is a general purpose superclass for objects that convert scalars to colors. This include vtkLookupTable classes and color transfer functions. By itself, this class will simply rescale the scalars

The scalars to color mapping can be augmented with an additional uniform alpha blend. This is used, for example, to blend a vtkActor's opacity with the lookup table values.

See also:
vtkLookupTable vtkColorTransferFunction
Tests:
vtkScalarsToColors (Tests)

Definition at line 42 of file vtkScalarsToColors.h.


Member Typedef Documentation


Member Enumeration Documentation

Enumerator:
MAGNITUDE 
COMPONENT 
RGBCOLORS 

Definition at line 127 of file vtkScalarsToColors.h.


Constructor & Destructor Documentation

vtkScalarsToColors::vtkScalarsToColors ( ) [protected]
vtkScalarsToColors::~vtkScalarsToColors ( ) [inline, protected]

Definition at line 223 of file vtkScalarsToColors.h.


Member Function Documentation

virtual const char* vtkScalarsToColors::GetClassName ( ) [virtual]
static int vtkScalarsToColors::IsTypeOf ( const char *  name) [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 vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

Reimplemented in vtkColorTransferFunction, vtkLookupTable, vtkLookupTableWithEnabling, vtkWindowLevelLookupTable, vtkDiscretizableColorTransferFunction, and vtkLogLookupTable.

virtual int vtkScalarsToColors::IsA ( const char *  name) [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 vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

Reimplemented in vtkColorTransferFunction, vtkLookupTable, vtkLookupTableWithEnabling, vtkWindowLevelLookupTable, vtkDiscretizableColorTransferFunction, and vtkLogLookupTable.

static vtkScalarsToColors* vtkScalarsToColors::SafeDownCast ( vtkObject o) [static]
void vtkScalarsToColors::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 vtkObject.

Reimplemented in vtkColorTransferFunction, vtkLookupTable, vtkLookupTableWithEnabling, vtkWindowLevelLookupTable, vtkDiscretizableColorTransferFunction, and vtkLogLookupTable.

static vtkScalarsToColors* vtkScalarsToColors::New ( ) [static]

Create an object with Debug turned off, modified time initialized to zero, and reference counting on.

Reimplemented from vtkObject.

Reimplemented in vtkColorTransferFunction, vtkLookupTable, vtkLookupTableWithEnabling, vtkWindowLevelLookupTable, vtkDiscretizableColorTransferFunction, and vtkLogLookupTable.

virtual int vtkScalarsToColors::IsOpaque ( ) [virtual]

Return true if all of the values defining the mapping have an opacity equal to 1. Default implementation return true.

Reimplemented in vtkLookupTable.

virtual void vtkScalarsToColors::Build ( ) [inline, virtual]

Perform any processing required (if any) before processing scalars.

Reimplemented in vtkLookupTable, vtkWindowLevelLookupTable, and vtkDiscretizableColorTransferFunction.

Definition at line 54 of file vtkScalarsToColors.h.

virtual double* vtkScalarsToColors::GetRange ( ) [virtual]

Sets/Gets the range of scalars which will be mapped.

Reimplemented in vtkLookupTable, and vtkColorTransferFunction.

virtual void vtkScalarsToColors::SetRange ( double  min,
double  max 
) [virtual]

Sets/Gets the range of scalars which will be mapped.

Reimplemented in vtkColorTransferFunction, and vtkLookupTable.

void vtkScalarsToColors::SetRange ( double  rng[2]) [inline]

Sets/Gets the range of scalars which will be mapped.

Reimplemented in vtkColorTransferFunction, and vtkLookupTable.

Definition at line 60 of file vtkScalarsToColors.h.

virtual unsigned char* vtkScalarsToColors::MapValue ( double  v) [virtual]

Map one value through the lookup table and return a color defined as a RGBA unsigned char tuple (4 bytes).

Reimplemented in vtkLookupTable, vtkColorTransferFunction, and vtkDiscretizableColorTransferFunction.

virtual void vtkScalarsToColors::GetColor ( double  v,
double  rgb[3] 
) [virtual]

Map one value through the lookup table and return the color as an RGB array of doubles between 0 and 1.

Reimplemented in vtkLookupTable, vtkColorTransferFunction, and vtkDiscretizableColorTransferFunction.

double* vtkScalarsToColors::GetColor ( double  v) [inline]

Map one value through the lookup table and return the color as an RGB array of doubles between 0 and 1.

Reimplemented in vtkColorTransferFunction.

Definition at line 75 of file vtkScalarsToColors.h.

virtual double vtkScalarsToColors::GetOpacity ( double  v) [virtual]

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

Reimplemented in vtkLookupTable.

double vtkScalarsToColors::GetLuminance ( double  x) [inline]

Map one value through the lookup table and return the luminance 0.3*red + 0.59*green + 0.11*blue as a double between 0 and 1. Returns the luminance value for the specified scalar value.

Definition at line 87 of file vtkScalarsToColors.h.

virtual void vtkScalarsToColors::SetAlpha ( double  alpha) [virtual]

Specify an additional opacity (alpha) value to blend with. Values != 1 modify the resulting color consistent with the requested form of the output. This is typically used by an actor in order to blend its opacity.

Reimplemented in vtkDiscretizableColorTransferFunction.

virtual double vtkScalarsToColors::GetAlpha ( ) [virtual]

Specify an additional opacity (alpha) value to blend with. Values != 1 modify the resulting color consistent with the requested form of the output. This is typically used by an actor in order to blend its opacity.

virtual vtkUnsignedCharArray* vtkScalarsToColors::MapScalars ( vtkDataArray scalars,
int  colorMode,
int  component 
) [virtual]

An internal method maps a data array into a 4-component, unsigned char RGBA array. The color mode determines the behavior of mapping. If VTK_COLOR_MODE_DEFAULT is set, then unsigned char data arrays are treated as colors (and converted to RGBA if necessary); otherwise, the data is mapped through this instance of ScalarsToColors. The offset is used for data arrays with more than one component; it indicates which component to use to do the blending. When the component argument is -1, then the this object uses its own selected technique to change a vector into a scalar to map.

Reimplemented in vtkDiscretizableColorTransferFunction.

virtual void vtkScalarsToColors::SetVectorMode ( int  ) [virtual]

Change mode that maps vectors by magnitude vs. component. If the mode is "RGBColors", then the vectors components are scaled to the range and passed directly as the colors.

virtual int vtkScalarsToColors::GetVectorMode ( ) [virtual]

Change mode that maps vectors by magnitude vs. component. If the mode is "RGBColors", then the vectors components are scaled to the range and passed directly as the colors.

void vtkScalarsToColors::SetVectorModeToMagnitude ( )

Change mode that maps vectors by magnitude vs. component. If the mode is "RGBColors", then the vectors components are scaled to the range and passed directly as the colors.

void vtkScalarsToColors::SetVectorModeToComponent ( )

Change mode that maps vectors by magnitude vs. component. If the mode is "RGBColors", then the vectors components are scaled to the range and passed directly as the colors.

void vtkScalarsToColors::SetVectorModeToRGBColors ( )

Change mode that maps vectors by magnitude vs. component. If the mode is "RGBColors", then the vectors components are scaled to the range and passed directly as the colors.

virtual void vtkScalarsToColors::SetVectorComponent ( int  ) [virtual]

If the mapper does not select which component of a vector to map to colors, you can specify it here.

virtual int vtkScalarsToColors::GetVectorComponent ( ) [virtual]

If the mapper does not select which component of a vector to map to colors, you can specify it here.

virtual void vtkScalarsToColors::SetVectorSize ( int  ) [virtual]

When mapping vectors, consider only the number of components selected by VectorSize to be part of the vector, and ignore any other components. Set to -1 to map all components. If this is not set to -1, then you can use SetVectorComponent to set which scalar component will be the first component in the vector to be mapped.

virtual int vtkScalarsToColors::GetVectorSize ( ) [virtual]

When mapping vectors, consider only the number of components selected by VectorSize to be part of the vector, and ignore any other components. Set to -1 to map all components. If this is not set to -1, then you can use SetVectorComponent to set which scalar component will be the first component in the vector to be mapped.

void vtkScalarsToColors::MapVectorsThroughTable ( void *  input,
unsigned char *  output,
int  inputDataType,
int  numberOfValues,
int  inputIncrement,
int  outputFormat,
int  vectorComponent,
int  vectorSize 
)

Map vectors through the lookup table. Unlike MapScalarsThroughTable, this method will use the VectorMode to decide how to map vectors. The output format can be set to VTK_RGBA (4 components), VTK_RGB (3 components), VTK_LUMINANCE (1 component, greyscale), or VTK_LUMINANCE_ALPHA (2 components)

void vtkScalarsToColors::MapVectorsThroughTable ( void *  input,
unsigned char *  output,
int  inputDataType,
int  numberOfValues,
int  inputIncrement,
int  outputFormat 
) [inline]

Map vectors through the lookup table. Unlike MapScalarsThroughTable, this method will use the VectorMode to decide how to map vectors. The output format can be set to VTK_RGBA (4 components), VTK_RGB (3 components), VTK_LUMINANCE (1 component, greyscale), or VTK_LUMINANCE_ALPHA (2 components)

Definition at line 162 of file vtkScalarsToColors.h.

void vtkScalarsToColors::MapScalarsThroughTable ( vtkDataArray scalars,
unsigned char *  output,
int  outputFormat 
)

Map a set of scalars through the lookup table in a single operation. This method ignores the VectorMode and the VectorComponent. The output format can be set to VTK_RGBA (4 components), VTK_RGB (3 components), VTK_LUMINANCE (1 component, greyscale), or VTK_LUMINANCE_ALPHA (2 components) If not supplied, the output format defaults to RGBA.

void vtkScalarsToColors::MapScalarsThroughTable ( vtkDataArray scalars,
unsigned char *  output 
) [inline]

Map a set of scalars through the lookup table in a single operation. This method ignores the VectorMode and the VectorComponent. The output format can be set to VTK_RGBA (4 components), VTK_RGB (3 components), VTK_LUMINANCE (1 component, greyscale), or VTK_LUMINANCE_ALPHA (2 components) If not supplied, the output format defaults to RGBA.

Definition at line 179 of file vtkScalarsToColors.h.

void vtkScalarsToColors::MapScalarsThroughTable ( void *  input,
unsigned char *  output,
int  inputDataType,
int  numberOfValues,
int  inputIncrement,
int  outputFormat 
) [inline]

Map a set of scalars through the lookup table in a single operation. This method ignores the VectorMode and the VectorComponent. The output format can be set to VTK_RGBA (4 components), VTK_RGB (3 components), VTK_LUMINANCE (1 component, greyscale), or VTK_LUMINANCE_ALPHA (2 components) If not supplied, the output format defaults to RGBA.

Definition at line 182 of file vtkScalarsToColors.h.

virtual void vtkScalarsToColors::MapScalarsThroughTable2 ( void *  input,
unsigned char *  output,
int  inputDataType,
int  numberOfValues,
int  inputIncrement,
int  outputFormat 
) [virtual]

An internal method typically not used in applications. This should be a protected function, but it must be kept public for backwards compatibility. Never call this method directly.

Reimplemented in vtkLookupTable, vtkColorTransferFunction, and vtkLookupTableWithEnabling.

virtual vtkUnsignedCharArray* vtkScalarsToColors::ConvertUnsignedCharToRGBA ( vtkUnsignedCharArray colors,
int  numComp,
int  numTuples 
) [virtual]

An internal method used to convert a color array to RGBA. The method instantiates a vtkUnsignedCharArray and returns it. The user is responsible for managing the memory.

virtual void vtkScalarsToColors::DeepCopy ( vtkScalarsToColors o) [virtual]

Copy the contents from another object.

Reimplemented in vtkLookupTable, and vtkColorTransferFunction.

virtual int vtkScalarsToColors::UsingLogScale ( ) [inline, virtual]

This should return 1 is the subclass is using log scale for mapping scalars to colors. Default implementation returns 0.

Reimplemented in vtkLookupTable, and vtkDiscretizableColorTransferFunction.

Definition at line 214 of file vtkScalarsToColors.h.

virtual vtkIdType vtkScalarsToColors::GetNumberOfAvailableColors ( ) [virtual]

Get the number of available colors for mapping to.

Reimplemented in vtkLookupTable, vtkColorTransferFunction, and vtkDiscretizableColorTransferFunction.

void vtkScalarsToColors::MapColorsToColors ( void *  input,
unsigned char *  output,
int  inputDataType,
int  numberOfValues,
int  numberOfComponents,
int  vectorSize,
int  outputFormat 
) [protected]

An internal method that assumes that the input already has the right colors, and only remaps the range to [0,255] and pads to the desired output format. If the input has 1 or 2 components, the first component will duplicated if the output format is RGB or RGBA. If the input has 2 or 4 components, the last component will be used for the alpha if the output format is RGBA or LuminanceAlpha. If the input has 3 or 4 components but the output is Luminance or LuminanceAlpha, then the components will be combined to compute the luminance. Any components past the fourth component will be ignored.

void vtkScalarsToColors::MapVectorsToMagnitude ( void *  input,
double output,
int  inputDataType,
int  numberOfValues,
int  numberOfComponents,
int  vectorSize 
) [protected]

An internal method for converting vectors to magnitudes, used as a preliminary step before doing magnitude mapping.


Member Data Documentation

Definition at line 249 of file vtkScalarsToColors.h.

Definition at line 252 of file vtkScalarsToColors.h.

Definition at line 253 of file vtkScalarsToColors.h.

Definition at line 254 of file vtkScalarsToColors.h.

Definition at line 257 of file vtkScalarsToColors.h.


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