FreeMat

- Main Page
- Related Pages

vtkScalarsToColors

Section: Visualization Toolkit Common Classes

# Usage

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.

To create an instance of class vtkScalarsToColors, simply invoke its constructor as follows

      obj = vtkScalarsToColors

# Methods

The class vtkScalarsToColors has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkScalarsToColors class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkScalarsToColors = obj.NewInstance ()`
- `vtkScalarsToColors = obj.SafeDownCast (vtkObject o)`
- `int = obj.IsOpaque ()` - Return true if all of the values defining the mapping have an opacity equal to 1. Default implementation return true.
- `obj.Build ()` - Perform any processing required (if any) before processing scalars.
- `double = obj.GetRange ()` - Sets/Gets the range of scalars which will be mapped.
- `obj.SetRange (double min, double max)` - Sets/Gets the range of scalars which will be mapped.
- `obj.SetRange (double rng[2])` - Map one value through the lookup table and return a color defined as a RGBA unsigned char tuple (4 bytes).
- `obj.GetColor (double v, double rgb[3])` - Map one value through the lookup table and return the color as an RGB array of doubles between 0 and 1.
- `double = obj.GetColor (double v)` - Map one value through the lookup table and return the alpha value (the opacity) as a double between 0 and 1.
- `double = obj.GetOpacity (double )` - 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.
- `double = obj.GetLuminance (double x)` - 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.
- `obj.SetAlpha (double 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.
- `double = obj.GetAlpha ()` - 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 = obj.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.
- `obj.SetVectorMode (int )` - Change mode that maps vectors by magnitude vs. component.
- `int = obj.GetVectorMode ()` - Change mode that maps vectors by magnitude vs. component.
- `obj.SetVectorModeToMagnitude ()` - Change mode that maps vectors by magnitude vs. component.
- `obj.SetVectorModeToComponent ()` - Change mode that maps vectors by magnitude vs. component.
- `obj.SetVectorComponent (int )` - If the mapper does not select which component of a vector to map to colors, you can specify it here.
- `int = obj.GetVectorComponent ()` - If the mapper does not select which component of a vector to map to colors, you can specify it here.
- `obj.MapScalarsThroughTable (vtkDataArray scalars, string 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.
- `obj.MapScalarsThroughTable (vtkDataArray scalars, string output)` - An internal method typically not used in applications.
- `vtkUnsignedCharArray = obj.ConvertUnsignedCharToRGBA (vtkUnsignedCharArray colors, int numComp, int numTuples)` - 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.
- `int = obj.UsingLogScale ()` - This should return 1 is the subclass is using log scale for mapping scalars to colors. Default implementation returns 0.