OpenCMISS-Zinc C++ API Documentation
Public Types | Public Member Functions | Protected Attributes | List of all members
OpenCMISS::Zinc::Spectrumcomponent Class Reference

Maps a single component of a data field to colour in a spectrum. More...

#include <spectrum.hpp>

Public Types

enum  ScaleType { SCALE_TYPE_INVALID = CMZN_SPECTRUMCOMPONENT_SCALE_TYPE_INVALID, SCALE_TYPE_LINEAR = CMZN_SPECTRUMCOMPONENT_SCALE_TYPE_LINEAR, SCALE_TYPE_LOG = CMZN_SPECTRUMCOMPONENT_SCALE_TYPE_LOG }
 
enum  ColourMappingType {
  COLOUR_MAPPING_TYPE_INVALID = CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_INVALID, COLOUR_MAPPING_TYPE_ALPHA = CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_ALPHA, COLOUR_MAPPING_TYPE_BANDED = CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_BANDED, COLOUR_MAPPING_TYPE_BLUE = CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_BLUE,
  COLOUR_MAPPING_TYPE_GREEN = CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_GREEN, COLOUR_MAPPING_TYPE_MONOCHROME = CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_MONOCHROME, COLOUR_MAPPING_TYPE_RAINBOW = CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_RAINBOW, COLOUR_MAPPING_TYPE_RED = CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_RED,
  COLOUR_MAPPING_TYPE_STEP = CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_STEP, COLOUR_MAPPING_TYPE_WHITE_TO_BLUE = CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_WHITE_TO_BLUE, COLOUR_MAPPING_TYPE_WHITE_TO_RED = CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_WHITE_TO_RED, COLOUR_MAPPING_TYPE_WHITE_TO_GREEN = CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_WHITE_TO_GREEN
}
 

Public Member Functions

 Spectrumcomponent (cmzn_spectrumcomponent_id in_spectrumcomponent_id)
 
 Spectrumcomponent (const Spectrumcomponent &spectrumComponent)
 
Spectrumcomponentoperator= (const Spectrumcomponent &spectrumComponent)
 
bool isValid () const
 
cmzn_spectrumcomponent_id getId () const
 
double getRangeMinimum ()
 
int setRangeMinimum (double value)
 
double getRangeMaximum ()
 
int setRangeMaximum (double value)
 
double getColourMinimum ()
 
int setColourMinimum (double value)
 
double getColourMaximum ()
 
int setColourMaximum (double value)
 
double getStepValue ()
 
int setStepValue (double value)
 
double getExaggeration ()
 
int setExaggeration (double value)
 
double getBandedRatio ()
 
int setBandedRatio (double value)
 
bool isActive ()
 
int setActive (bool active)
 
bool isColourReverse ()
 
int setColourReverse (bool reverse)
 
bool isExtendAbove ()
 
int setExtendAbove (bool extend_above)
 
bool isExtendBelow ()
 
int setExtendBelow (bool extend_below)
 
int getFieldComponent ()
 
int setFieldComponent (int componentNumber)
 
bool isFixMaximum ()
 
int setFixMaximum (bool fixMaximum)
 
bool isFixMinimum ()
 
int setFixMinimum (bool fixMinimum)
 
int getNumberOfBands ()
 
int setNumberOfBands (int numberOfBands)
 
ScaleType getScaleType ()
 
int setScaleType (ScaleType scaleType)
 
ColourMappingType getColourMappingType ()
 
int setColourMappingType (ColourMappingType colourMapping)
 

Protected Attributes

cmzn_spectrumcomponent_id id
 

Detailed Description

Maps a single component of a data field to colour in a spectrum.

A spectrumcomponent object maps a single component of a data field to one of several colour ramps, rainbow, alpha ramp, contour bands or a step function. A spectrum may blend multiple components to give the overall colouring.

See also
Spectrum

Member Enumeration Documentation

Colour mapping mode for specctrum component. Appearances of these mappings can be altered by the various APIs provided in spectrum and spectrum components APIs.

Enumerator
COLOUR_MAPPING_TYPE_INVALID 

Unspecified colour mapping type

COLOUR_MAPPING_TYPE_ALPHA 

This colour mapping alters the alpha (transparency value) for primitives. This mode does not alter the rgb value and should be used with other spectrum component or with overwrite_material set to 0 in spectrum.

COLOUR_MAPPING_TYPE_BANDED 

This colour mapping create non-coloured strips/bands. The appearance is controlled by the number of bands and the banded ratio. This mode does not alter the rgb value except at the bands and should be used with other spectrum component or with overwrite_material set to 0 in spectrum.

See also
Spectrumcomponent::setBandedRatio
Spectrumcomponent::getNumberOfBands
COLOUR_MAPPING_TYPE_BLUE 

This colour mapping create a colour spectrum from black to blue.

COLOUR_MAPPING_TYPE_GREEN 

This colour mapping create a colour spectrum from black to green.

COLOUR_MAPPING_TYPE_MONOCHROME 

This colour mapping create a monochrome (grey scale) spectrum.

COLOUR_MAPPING_TYPE_RAINBOW 

default colour mapping type This colour mapping create a spectrum from blue to red, similar to the colour of a rainbow.

COLOUR_MAPPING_TYPE_RED 

This colour mapping create a colour spectrum from black to red.

COLOUR_MAPPING_TYPE_STEP 

This colour mapping create a spectrum with only two colours, red and green. The boundary between red and green can be altered by CMZN_SPECTRUMCOMPONENT_ATTRIBUTE_STEP_VALUE.

COLOUR_MAPPING_TYPE_WHITE_TO_BLUE 

This colour mapping create a colour spectrum from black to blue.

COLOUR_MAPPING_TYPE_WHITE_TO_RED 

This colour mapping create a colour spectrum from black to red.

COLOUR_MAPPING_TYPE_WHITE_TO_GREEN 

This colour mapping create a colour spectrum from black to green.

Controls the mapping of field value to colour in a spectrum component.

Enumerator
SCALE_TYPE_INVALID 

Unspecified scale type

SCALE_TYPE_LINEAR 

default scale type The colour value on spectrum will be interpolated linearly in range when this mode is chosen.

SCALE_TYPE_LOG 

Logarithm scale type for spectrum component. The colour value on spectrum will be interpolated logarithmically in range when this mode is chosen.

Member Function Documentation

double OpenCMISS::Zinc::Spectrumcomponent::getBandedRatio ( )
inline

Get the value determining the proportion of band present on each section, number of sections in a spectrum is determined by number of bands, value must be larger than 0.0 and must not exceed 1.0.

Returns
banded ratio of the spectrum component on success.
ColourMappingType OpenCMISS::Zinc::Spectrumcomponent::getColourMappingType ( )
inline

Get the colour_mapping_type of this component.

Returns
colour_mapping_type of the spectrum component. CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_INVALID if failed or mode is not set correctly.
double OpenCMISS::Zinc::Spectrumcomponent::getColourMaximum ( )
inline

Get the colour value mapped to the maximum spectrum component data range. This is a normalised value from 0.0 to 1.0.

Returns
Maximum colour value from 0.0 to 1.0, or 0.0 if invalid component.
double OpenCMISS::Zinc::Spectrumcomponent::getColourMinimum ( )
inline

Get the colour value mapped to the minimum spectrum component data range. This is a normalised value from 0.0 to 1.0.

Returns
Minimum colour value from 0.0 to 1.0, or 0.0 if invalid component.
double OpenCMISS::Zinc::Spectrumcomponent::getExaggeration ( )
inline

Get the value which alters the colour progression when scale type is set to SCALE_TYPE_LOG.

See also
Spectrumcomponent::SCALE_TYPE_LOG
Returns
The exaggeration value of the spectrum, or zero on failure.
int OpenCMISS::Zinc::Spectrumcomponent::getFieldComponent ( )
inline

Get the field component lookup number of a spectrum component, this value determines which of the field component this spectrum component will look up on.

See also
Graphics::setDataField
Returns
positive integer of the field component number to look up to. Any other value if failed or value is not set correctly.
cmzn_spectrumcomponent_id OpenCMISS::Zinc::Spectrumcomponent::getId ( ) const
inline

Return the C handle of the Spectrumcomponent object.

Returns
C handle of Spectrumcomponent if this objects is valid, 0 otherwise.
int OpenCMISS::Zinc::Spectrumcomponent::getNumberOfBands ( )
inline

Get the number of bands this component contains within its range in CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_BANDED

Returns
positive integer of nuymber of bands set for this components. Any other value if failed or value is not set correctly
double OpenCMISS::Zinc::Spectrumcomponent::getRangeMaximum ( )
inline

Get the maximum value of the range this spectrum component will lookup to on targeted field. Primitives with this field value will display the maximum colour value of the component colour type

Returns
value of range maximum on success.
double OpenCMISS::Zinc::Spectrumcomponent::getRangeMinimum ( )
inline

Get the minimum value of the range this spectrum component will lookup to on targeted field. Primitives with this field value will display the minimum colour value of the component colour type

Returns
value of range minimum on success.
ScaleType OpenCMISS::Zinc::Spectrumcomponent::getScaleType ( )
inline

Get the interpolation_mode of this component.

Returns
interpolation_mode set for this spectrum. CMZN_SPECTRUMCOMPONENT_SCALE_TYPE_INVALID if failed or mode is not set correctly
double OpenCMISS::Zinc::Spectrumcomponent::getStepValue ( )
inline

Get the step value of a spectrum component. The step spectrum defines the boundary between the red and blue colour of the COLOUR_MAPPING_TYPE_STEP spectrum compomemt.

Returns
step value of the spectrum component on success.
bool OpenCMISS::Zinc::Spectrumcomponent::isActive ( )
inline

Get the active state of a spectrum component, only active spectrum component will be rendered

Returns
true if spectrum component is active, false if failed or spectrum component is not active
bool OpenCMISS::Zinc::Spectrumcomponent::isColourReverse ( )
inline

Get the reverse flag of a spectrum component, reverse spectrum component will have the colour rendered reversely.

Returns
true if spectrum component is reverse, false if failed or spectrum component is not reverse
bool OpenCMISS::Zinc::Spectrumcomponent::isExtendAbove ( )
inline

Get the 'extend above' flag of a spectrum component, which controls whether values above the maximum are rendered for this component.

See also
Spectrumcomponent::setExtendAbove
Returns
true if spectrum component extends above, false if failed or spectrum component does not extend above
bool OpenCMISS::Zinc::Spectrumcomponent::isExtendBelow ( )
inline

Get the 'extend below' flag of a spectrum component, which controls whether values below the minimum are rendered for this component.

See also
Spectrumcomponent::setExtendBelow
Returns
true if spectrum component extends below, false if failed or spectrum component does not extend below
bool OpenCMISS::Zinc::Spectrumcomponent::isFixMaximum ( )
inline

Query whether this component's data range maximum is marked as fixed.

See also
Spectrumcomponent::setFixMaximum
Returns
Boolean true if the maximum is fixed, otherwise false.
bool OpenCMISS::Zinc::Spectrumcomponent::isFixMinimum ( )
inline

Query whether this component's data range minimum is marked as fixed.

See also
Spectrumcomponent::setFixMinimum
Returns
Boolean true if the minimum is fixed, otherwise false.
bool OpenCMISS::Zinc::Spectrumcomponent::isValid ( ) const
inline

Check if this is a valid Spectrumcomponent object.

Returns
Status True if object is valid, false otherwise.
int OpenCMISS::Zinc::Spectrumcomponent::setActive ( bool  active)
inline

Set the active state of a spectrum component, only active spectrum component will be rendered

Parameters
activeValue to be set to the zinc spectrum component.
Returns
OpenCMISS::Zinc::OK if value is set successfully, any other value if failed.
int OpenCMISS::Zinc::Spectrumcomponent::setBandedRatio ( double  value)
inline

Set the value determining the proportion of band present on each section, number of sections in a spectrum is determined by number of bands, value must be larger than 0.0 and must not exceed 1.0.

the banded ratio to be set

Returns
OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Spectrumcomponent::setColourMappingType ( ColourMappingType  colourMapping)
inline

Set the colour_mapping_type of this component.

Parameters
colourMappingcolour_mapping_type to be set for spectrum component
Returns
OpenCMISS::Zinc::OK if value is set successfully, any other value if failed.
int OpenCMISS::Zinc::Spectrumcomponent::setColourMaximum ( double  value)
inline

Set the colour value mapped to the maximum spectrum component data range. This is a normalised value from 0.0 to 1.0, mapping to a position in the colour map. For simple colour mappings red, green, blue and alpha, this gives the exact colour component value at the maximum data range, which is interpolated to the minimum colour at the minimum data range. Note that setting 'reverse' colours reverses the association of colour range and data range; it is recommended the colour minimum and maximum be swapped instead of using reverse. Changing this value does not affect COLOUR_MAPPING_TYPE_BANDED which is only affected by the number and ratio of bands.

The maximum colour value to set, from 0.0 to 1.0.

Returns
OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Spectrumcomponent::setColourMinimum ( double  value)
inline

Set the colour value mapped to the minimum spectrum component data range. This is a normalised value from 0.0 to 1.0, mapping to a position in the colour map. For simple colour mappings red, green, blue and alpha, this gives the exact colour component value at the minimum data range, which is interpolated to the maximum colour at the maximum data range. Note that setting 'reverse' colours reverses the association of colour range and data range; it is recommended the colour minimum and maximum be swapped instead of using reverse.

See also
Spectrumcomponent::setColourReverse Changing this value does not affect COLOUR_MAPPING_TYPE_BANDED which is only affected by the number and ratio of bands.

The minimum colour value to set, from 0.0 to 1.0.

Returns
OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Spectrumcomponent::setColourReverse ( bool  reverse)
inline

Set the reverse flag of a spectrum component, which if set maps the colour maximum to the data range minimum, and the colour minimum to the data range maximum. This is primarily intended to reverse the rainbow colour map. With most colour maps, swapping the colour minimum and maximum values is easier to explain and achieves the same result.

Parameters
reverseValue to be set to the zinc spectrum component.
Returns
OpenCMISS::Zinc::OK if value is set successfully, any other value if failed.
int OpenCMISS::Zinc::Spectrumcomponent::setExaggeration ( double  value)
inline

Set the value which alters the colour progression when scale type is set to SCALE_TYPE_LOG

See also
Spectrumcomponent::SCALE_TYPE_LOG
Parameters
valueThe exaggeration value to be set.
Returns
OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Spectrumcomponent::setExtendAbove ( bool  extend_above)
inline

Set the 'extend above' flag of a spectrum component. When on (true), values above the maximum are rendered with the same colour as the maximum value. When off, no colour is set for this component for values above the maximum value. By default, extend above is on (true).

Parameters
extend_aboveValue to be set to the zinc spectrum component.
Returns
OpenCMISS::Zinc::OK if value is set successfully, any other value if failed.
int OpenCMISS::Zinc::Spectrumcomponent::setExtendBelow ( bool  extend_below)
inline

Set the 'extend below' flag of a spectrum component. When on (true), values below the minimum are rendered with the same colour as the minimum value. When off, no colour is set for this component for values below the minimum value. By default, extend below is on (true).

Parameters
extend_belowValue to be set to the zinc spectrum component.
Returns
OpenCMISS::Zinc::OK if value is set successfully, any other value if failed.
int OpenCMISS::Zinc::Spectrumcomponent::setFieldComponent ( int  componentNumber)
inline

Set the field component lookup number of a spectrum component, this value determines which of the field component this spectrum component will look up on.

See also
Graphics::setDataField
Returns
OpenCMISS::Zinc::OK if value is set successfully, any other value if failed.
int OpenCMISS::Zinc::Spectrumcomponent::setFixMaximum ( bool  fixMaximum)
inline

Set hint for whether to fix this component's data range maximum when fitting the spectrum ranges to the range of data in the model visualisation. If true, the maximum should be fixed at its current value. If false, it can change e.g. scale in proportion to other data ranges. This attribute is metadata i.e. it does not affect the spectrum result. Its default value is false i.e. the maximum is not fixed.

Parameters
fixMaximumThe new state of the fix maximum flag.
Returns
OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Spectrumcomponent::setFixMinimum ( bool  fixMinimum)
inline

Set hint for whether to fix this component's data range minimum when fitting the spectrum ranges to the range of data in the model visualisation. If true, the minimum should be fixed at its current value. If false, it can change e.g. scale in proportion to other data ranges. This attribute is metadata i.e. it does not affect the spectrum result. Its default value is false i.e. the minimum is not fixed.

Parameters
fixMinimumThe new state of the fix minimum flag.
Returns
OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Spectrumcomponent::setNumberOfBands ( int  numberOfBands)
inline

Set the number of bands this component contains within its range in CMZN_SPECTRUMCOMPONENT_COLOUR_MAPPING_TYPE_BANDED

Parameters
numberOfBandsof bands number of bands for this component
Returns
OpenCMISS::Zinc::OK if value is set successfully, any other value if failed.
int OpenCMISS::Zinc::Spectrumcomponent::setRangeMaximum ( double  value)
inline

Set the maximum value of the range this spectrum component will lookup to on targeted field. Primitives with this field value will display the maximum colour value of the component colour type

the value to be set for range maximum

Returns
OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Spectrumcomponent::setRangeMinimum ( double  value)
inline

Set the minimum value of the range this spectrum component will lookup to on targeted field. Primitives with this field value will display the minimum colour value of the component colour type

the value to be set for range minimum

Returns
OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Spectrumcomponent::setScaleType ( ScaleType  scaleType)
inline

Set the interpolation_mode of this component.

Parameters
scaleTypeInterpolation mode to be set for spectrum component
Returns
OpenCMISS::Zinc::OK if value is set successfully, any other value if failed.
int OpenCMISS::Zinc::Spectrumcomponent::setStepValue ( double  value)
inline

Set the step value of a spectrum component. The step spectrum defines the boundary between the red and blue colour of the COLOUR_MAPPING_TYPE_STEP spectrum component.

the step value to be set

Returns
OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.

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