Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
SoTransferFunction Class Reference

Contains the transfer function definition. More...

#include <VolumeViz/nodes/SoTransferFunction.h>

Inheritance diagram for SoTransferFunction:
SoVolumeRendering SoNode SoFieldContainer SoBase

Public Types

enum  PredefColorMap {
enum  ColorMapType { ALPHA, LUM_ALPHA, RGBA }
- Public Types inherited from SoVolumeRendering
enum  HW_SupportStatus { NO, YES, UNKNOWN }
- Public Types inherited from SoNode
enum  NodeType

Public Member Functions

void reMap (int low, int high)
SbBool hasTransparency (void) const
- Public Member Functions inherited from SoVolumeRendering
HW_SupportStatus isSupported (HW_Feature feature)
- Public Member Functions inherited from SoNode
void setOverride (const SbBool state)
SbBool isOverride (void) const
void setNodeType (const NodeType type)
NodeType getNodeType (void) const
virtual SoNodecopy (SbBool copyconnections=FALSE) const
virtual SbBool affectsState (void) const
virtual void GLRenderBelowPath (SoGLRenderAction *action)
virtual void GLRenderInPath (SoGLRenderAction *action)
virtual void GLRenderOffPath (SoGLRenderAction *action)
virtual void getBoundingBox (SoGetBoundingBoxAction *action)
virtual void getMatrix (SoGetMatrixAction *action)
virtual void handleEvent (SoHandleEventAction *action)
virtual void rayPick (SoRayPickAction *action)
virtual void search (SoSearchAction *action)
virtual void write (SoWriteAction *action)
virtual void audioRender (SoAudioRenderAction *action)
virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action)
virtual void grabEventsSetup (void)
virtual void grabEventsCleanup (void)
virtual void startNotify (void)
virtual void notify (SoNotList *l)
SbUniqueId getNodeId (void) const
virtual SoChildListgetChildren (void) const
virtual void writeInstance (SoOutput *out)
virtual SoNodeaddToCopyDict (void) const
virtual void copyContents (const SoFieldContainer *from, SbBool copyconnections)
virtual SoFieldContainercopyThroughConnection (void) const
- Public Member Functions inherited from SoFieldContainer
void setToDefaults (void)
SbBool hasDefaultValues (void) const
SbBool fieldsAreEqual (const SoFieldContainer *container) const
void copyFieldValues (const SoFieldContainer *container, SbBool copyconnections=FALSE)
SbBool set (const char *const fielddata)
void get (SbString &fielddata)
virtual int getFields (SoFieldList &l) const
virtual int getAllFields (SoFieldList &l) const
virtual SoFieldgetField (const SbName &name) const
virtual SoFieldgetEventIn (const SbName &name) const
virtual SoFieldgetEventOut (const SbName &name) const
SbBool getFieldName (const SoField *const field, SbName &name) const
SbBool enableNotify (const SbBool flag)
SbBool isNotifyEnabled (void) const
SbBool set (const char *fielddata, SoInput *input)
void get (SbString &fielddata, SoOutput *out)
virtual SbBool validateNewFieldValue (SoField *field, void *newval)
virtual void addWriteReference (SoOutput *out, SbBool isfromfield=FALSE)
SbBool getIsBuiltIn (void) const
virtual const SoFieldDatagetFieldData (void) const
virtual void getFieldsMemorySize (size_t &managed, size_t &unmanaged) const
void setUserData (void *userdata) const
void * getUserData (void) const
- Public Member Functions inherited from SoBase
void ref (void) const
void unref (void) const
void unrefNoDelete (void) const
int32_t getRefCount (void) const
void touch (void)
virtual SoType getTypeId (void) const=0
SbBool isOfType (SoType type) const
virtual SbName getName (void) const
virtual void setName (const SbName &newname)
void addAuditor (void *const auditor, const SoNotRec::Type type)
void removeAuditor (void *const auditor, const SoNotRec::Type type)
const SoAuditorListgetAuditors (void) const
SbBool shouldWrite (void)
void assertAlive (void) const

Static Public Member Functions

static void initClass (void)
- Static Public Member Functions inherited from SoVolumeRendering
static void init (void)
static void initClass (void)
static void setReadAlternateRep (SbBool flag)
static void setWriteAlternateRep (SbBool flag)
static SbBool getReadAlternateRep (void)
static SbBool getWriteAlternateRep (void)
static void setDelayedRendering (SbBool flag)
static SbBool getDelayedRendering (void)
- Static Public Member Functions inherited from SoNode
static uint32_t getCompatibilityTypes (const SoType &nodetype)
static SoNodegetByName (const SbName &name)
static int getByName (const SbName &name, SoNodeList &l)
static void initClasses (void)
static SbUniqueId getNextNodeId (void)
static int getActionMethodIndex (const SoType type)
static void getBoundingBoxS (SoAction *action, SoNode *node)
static void GLRenderS (SoAction *action, SoNode *node)
static void callbackS (SoAction *action, SoNode *node)
static void getMatrixS (SoAction *action, SoNode *node)
static void handleEventS (SoAction *action, SoNode *node)
static void pickS (SoAction *action, SoNode *node)
static void rayPickS (SoAction *action, SoNode *node)
static void searchS (SoAction *action, SoNode *node)
static void writeS (SoAction *action, SoNode *node)
static void audioRenderS (SoAction *action, SoNode *node)
static void getPrimitiveCountS (SoAction *action, SoNode *node)
- Static Public Member Functions inherited from SoFieldContainer
static void initCopyDict (void)
static void addCopy (const SoFieldContainer *orig, const SoFieldContainer *copy)
static SoFieldContainercheckCopy (const SoFieldContainer *orig)
static SoFieldContainerfindCopy (const SoFieldContainer *orig, const SbBool copyconnections)
static void copyDone (void)
- Static Public Member Functions inherited from SoBase
static void initClass (void)
static SoType getClassTypeId (void)
static void addName (SoBase *const base, const char *const name)
static void removeName (SoBase *const base, const char *const name)
static void incrementCurrentWriteCounter (void)
static void decrementCurrentWriteCounter (void)
static SoBasegetNamedBase (const SbName &name, SoType type)
static int getNamedBases (const SbName &name, SoBaseList &baselist, SoType type)
static SbBool read (SoInput *input, SoBase *&base, SoType expectedtype)
static void setInstancePrefix (const SbString &c)
static void setTraceRefs (SbBool trace)
static SbBool getTraceRefs (void)
static SbBool connectRoute (SoInput *input, const SbName &fromnodename, const SbName &fromfieldname, const SbName &tonodename, const SbName &tofieldname)
static SbBool readRoute (SoInput *input)

Public Attributes

SoSFInt32 shift
SoSFInt32 offset
SoSFEnum predefColorMap
SoSFEnum colorMapType
SoMFFloat colorMap
- Public Attributes inherited from SoNode

Protected Member Functions

virtual void doAction (SoAction *action)
virtual void GLRender (SoGLRenderAction *action)
virtual void callback (SoCallbackAction *action)
virtual void pick (SoPickAction *action)
- Protected Member Functions inherited from SoNode
virtual SbBool readInstance (SoInput *in, unsigned short flags)
- Protected Member Functions inherited from SoBase
virtual void destroy (void)
SbBool hasMultipleWriteRefs (void) const
SbBool writeHeader (SoOutput *out, SbBool isgroup, SbBool isengine) const
void writeFooter (SoOutput *out) const
virtual const char * getFileFormatName (void) const


class SoTransferFunctionP

Additional Inherited Members

- Protected Types inherited from SoBase
enum  BaseFlags
- Static Protected Member Functions inherited from SoNode
static const SoFieldData ** getFieldDataPtr (void)
static void setNextActionMethodIndex (int index)
static int getNextActionMethodIndex (void)
static void incNextActionMethodIndex (void)
static void setCompatibilityTypes (const SoType &nodetype, const uint32_t bitmask)
- Static Protected Member Functions inherited from SoBase
static uint32_t getCurrentWriteCounter (void)
- Protected Attributes inherited from SoNode
SbUniqueId uniqueId
- Protected Attributes inherited from SoFieldContainer
SbBool isBuiltIn
- Static Protected Attributes inherited from SoNode
static SbUniqueId nextUniqueId
static int nextActionMethodIndex

Detailed Description

Contains the transfer function definition.

This node sets up the mapping from voxel data values to actual on-screen color values and transparency / opaqueness.

It has a set of predefined color maps, commonly used in e.g. seismic visualization, and the option to set up one's own free-form color map lookup table (by setting SoTransferFunction::predefColorMap to NONE).

Member Enumeration Documentation

◆ PredefColorMap

Predefined color transfer functions, each containing exactly 256 colors.


If this is set, the SoTransferFunction::colorMap field must be used.


Default transfer function color map. The checker board indicates that this gradient is partly transparent.


Same as GREY.


This gradient is fully opaque.


This gradient is fully opaque.


This gradient is fully opaque.


This gradient is fully opaque.


This gradient is fully opaque.


This gradient is partly transparent.

◆ ColorMapType

Type of color map array. Defines the possible values for the SoTransferFunction::colorMapType field.


Each color entry in the transfer function has only one component, so the SoTransferFunction::colorMap field should consist of exactly 256 float values, each value representing a transparency value. The RGB colors will all be set to [1,1,1], i.e. all white.


Each transfer function color map entry in SoTransferFunction::colorMap has two components, i.e. two floats, so the field should contain exactly 256*2 = 512 values. The first float value of each pair is taken to be an intensity / gray color value, and the second float of each pair is a transparency value (as for the ALPHA enum).


Four floats are used to specify each color of the transfer function. SoTransferFunction::colorMap should consist of exactly 256*4 = 1024 float values. Each quadruple consist of intensity values for red, green, and blue, and then the fourth value is an alpha value, as for LUM_ALPHA and ALPHA.

Member Function Documentation

◆ reMap()

void SoTransferFunction::reMap ( int  low,
int  high 

Set two thresholds, where all transfer function mappings that ends up below the low value or above the high value are set to be completely transparent.

Initial default values are [0, 65535].

Member Data Documentation

◆ shift

SoSFInt32 SoTransferFunction::shift

Used to shift the voxel attribute value before assigning a color value from the transfer function color map. In pseudo code:

colorvalue = transferfunction[(voxelvalue << shift) + offset]

(offset is the value of the SoTransferFunction::offset field.)

◆ offset

SoSFInt32 SoTransferFunction::offset

See the SoTransferFunction::shift field.

◆ predefColorMap

SoSFEnum SoTransferFunction::predefColorMap

Sets up the transfer function to use. See SoTransferFunction::PredefColorMap for a list of the predefined color maps.

Note that most of the predefined color maps are all opaque, even for data value 0. This will often cause the unwanted behavior that the full data set will be completely opaque for visualization, so only the outer "walls" of the volume are shown. To avoid this, use the SoTransferFunction::reMap() method to "narrow" the data values that are to be rendered according to the transfer function (all values outside of the given range will then be fully transparent).

The value SoTransferFunction::NONE has special meaning: it signifies that none of the predefined values should be used, but that the transfer function color map should be fetched from the SoTransferFunction::colorMap field instead.

◆ colorMapType

SoSFEnum SoTransferFunction::colorMapType

This field specifies how the SoTransferFunction::colorMap field should be interpreted when SoTransferFunction::predefColorMap is set to SoTransferFunction::NONE.

(Note that it will not have any effect when SoTransferFunction::predefColorMap is set to any of the actual predefined transfer function color maps, i.e. not equal to NONE.)

See SoTransferFunction::ColorMapType for what possible values this field can have, and their semantics.

◆ colorMap

SoMFFloat SoTransferFunction::colorMap

An array of floats describing the transfer function. Each value must be normalized to be within [0.0, 1.0] for the intensity value of a color, or the alpha value for transparency.

The array must contain 256 colors. The number of floats needed in the array for each color depends on the SoTransferFunction::ColorMapType setting.

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