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

# vtkScalarsToColors Class Reference

`#include <vtkScalarsToColors.h>`

Inheritance diagram for vtkScalarsToColors:

[legend]
Collaboration diagram for vtkScalarsToColors:

[legend]
List of all members.

## Detailed Description

map scalar values into colors

Date:
  2003/01/06 20:36:14

Revision:
  1.28

vtkScalarsToColors is a general purpose superclass for objects that convert scalars to colors. This include vtkLookupTable classes and color transfer functions.

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

Created by:
  - Martin, Ken

CVS contributions (if > 5%):
  - Schroeder, Will (38%)
  - Martin, Ken (24%)
  - Gobbi, David (15%)
  - Geveci, Berk (11%)
  - Law, Charles (6%)

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

Definition at line 56 of file vtkScalarsToColors.h.

## Public Types

typedef vtkObject | Superclass

## Public Methods

virtual const char * | GetClassName ()
virtual int | IsA (const char *type)
void | PrintSelf (ostream &os, vtkIndent indent)
virtual void | Build ()
virtual unsigned char * | MapValue (float v)=0
virtual void | GetColor (float v, float rgb[3])=0
virtual float * | GetRange ()=0
virtual void | SetRange (float min, float max)=0
void | SetRange (float rng[2])
float * | GetColor (float v)
virtual float | GetOpacity (float vtkNotUsed(v))
float | GetLuminance (float x)
void | SetAlpha (float alpha)
virtual float | GetAlpha ()
vtkUnsignedCharArray * | MapScalars (vtkDataArray *scalars, int colorMode, int component)
virtual void | SetVectorMode (int)
virtual int | GetVectorMode ()
void | SetVectorModeToMagnitude ()
void | SetVectorModeToComponent ()
virtual void | SetVectorComponent (int)
virtual int | GetVectorComponent ()
void | MapScalarsThroughTable (vtkDataArray *scalars, unsigned char *output, int outputFormat)
void | MapScalarsThroughTable (vtkDataArray *scalars, unsigned char *output)
virtual void | MapScalarsThroughTable2 (void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputFormat)=0
virtual vtkUnsignedCharArray * | ConvertUnsignedCharToRGBA (vtkUnsignedCharArray *colors, int numComp, int numTuples)

## Static Public Methods

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

## Protected Types

enum | VectorModes { MAGNITUDE = 0, COMPONENT = 1 }

## Protected Methods

| vtkScalarsToColors ()
| ~vtkScalarsToColors ()

## Protected Attributes

float | Alpha
int | VectorMode
int | UseMagnitude
int | VectorComponent

## Member Typedef Documentation

typedef vtkObject vtkScalarsToColors::Superclass

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

## Member Enumeration Documentation

enum vtkScalarsToColors::VectorModes`[protected]`

Enumeration values:

  MAGNITUDE |
  COMPONENT |

Definition at line 188 of file vtkScalarsToColors.h.

## Constructor & Destructor Documentation

vtkScalarsToColors::vtkScalarsToColors | ( |  | ) | `[protected]`

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

| Definition at line 175 of file vtkScalarsToColors.h.

## Member Function Documentation

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

| Reimplemented from vtkObject. Reimplemented in vtkLogLookupTable, vtkLookupTable, vtkWindowLevelLookupTable, and vtkColorTransferFunction.

int vtkScalarsToColors::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 vtkObject. Reimplemented in vtkLogLookupTable, vtkLookupTable, vtkWindowLevelLookupTable, and vtkColorTransferFunction.

virtual int vtkScalarsToColors::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 vtkObject. Reimplemented in vtkLogLookupTable, vtkLookupTable, vtkWindowLevelLookupTable, and vtkColorTransferFunction.

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

| Reimplemented from vtkObject. Reimplemented in vtkLogLookupTable, vtkLookupTable, vtkWindowLevelLookupTable, and vtkColorTransferFunction.

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 vtkLogLookupTable, vtkLookupTable, vtkWindowLevelLookupTable, and vtkColorTransferFunction.

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

| Perform any processing required (if any) before processing scalars. Reimplemented in vtkLookupTable, and vtkWindowLevelLookupTable. Definition at line 63 of file vtkScalarsToColors.h.

virtual float* vtkScalarsToColors::GetRange | ( |  | ) | `[pure virtual]`

| Sets/Gets the range of scalars which will be mapped. Implemented in vtkLookupTable, and vtkColorTransferFunction.

virtual void vtkScalarsToColors::SetRange | ( | float | min,
|  | float | max
| ) | `[pure virtual]`

| Sets/Gets the range of scalars which will be mapped. Implemented in vtkLookupTable, and vtkColorTransferFunction. Referenced by vtkColorTransferFunction::SetRange(), and vtkLookupTable::SetRange().

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

| Sets/Gets the range of scalars which will be mapped. Reimplemented in vtkLookupTable, and vtkColorTransferFunction. Definition at line 69 of file vtkScalarsToColors.h.

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

| Map one value through the lookup table and return a color defined as a RGBA unsigned char tuple (4 bytes). Implemented in vtkLookupTable, and vtkColorTransferFunction.

virtual void vtkScalarsToColors::GetColor | ( | float | v,
|  | float | rgb[3]
| ) | `[pure virtual]`

| Map one value through the lookup table and return the color as an RGB array of floats between 0 and 1. Implemented in vtkLookupTable, and vtkColorTransferFunction. Referenced by vtkColorTransferFunction::GetColor(), and vtkLookupTable::GetColor().

float* vtkScalarsToColors::GetColor | ( | float | v | ) | `[inline]`

| Map one value through the lookup table and return the color as an RGB array of floats between 0 and 1. Reimplemented in vtkLookupTable, and vtkColorTransferFunction. Definition at line 84 of file vtkScalarsToColors.h.

virtual float vtkScalarsToColors::GetOpacity | ( | float | vtkNotUsed(v) | ) | `[inline, virtual]`

| Map one value through the lookup table and return the alpha value (the opacity) as a float between 0 and 1. Definition at line 91 of file vtkScalarsToColors.h.

float vtkScalarsToColors::GetLuminance | ( | float | x | ) | `[inline]`

| Map one value through the lookup table and return the luminance 0.3*red + 0.59*green + 0.11*blue as a float between 0 and 1. Returns the luminance value for the specified scalar value. Definition at line 99 of file vtkScalarsToColors.h.

void vtkScalarsToColors::SetAlpha | ( | float | alpha | ) |

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

vtkUnsignedCharArray* vtkScalarsToColors::MapScalars | ( | vtkDataArray * | scalars,
|  | int | colorMode,
|  | int | component
| ) |

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.

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

| Change mode that maps vectors by magnitude vs. component.

virtual int vtkScalarsToColors::GetVectorMode | ( |  | ) | `[virtual]`

| Change mode that maps vectors by magnitude vs. component.

void vtkScalarsToColors::SetVectorModeToMagnitude | ( |  | ) |

| Change mode that maps vectors by magnitude vs. component.

void vtkScalarsToColors::SetVectorModeToComponent | ( |  | ) |

| Change mode that maps vectors by magnitude vs. component.

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.

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

| Map a set of scalars through the lookup table in a single operation. 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. 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 151 of file vtkScalarsToColors.h. References VTK_RGBA.

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

| An internal method typically not used in applications. Implemented in vtkLookupTable, and vtkColorTransferFunction.

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.

## Member Data Documentation

float vtkScalarsToColors::Alpha`[protected]`

| Definition at line 177 of file vtkScalarsToColors.h.

int vtkScalarsToColors::VectorMode`[protected]`

| Definition at line 180 of file vtkScalarsToColors.h.

int vtkScalarsToColors::UseMagnitude`[protected]`

| Definition at line 184 of file vtkScalarsToColors.h.

int vtkScalarsToColors::VectorComponent`[protected]`

| Definition at line 185 of file vtkScalarsToColors.h.

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

- Common/vtkScalarsToColors.h