ImFusion SDK 4.3

#include <ImFusion/GL/TransferFunction.h>

Modern 1D transfer function for classification during rendering. More...

+ Inheritance diagram for TransferFunction:

Detailed Description

Modern 1D transfer function for classification during rendering.

A 1D transfer function describes a mapping from image intensities to the optical properties of color and opacity. In this implementation, the transfer function is either described by a set of tissues - each consisting of a set of key points - or a look-up-table (LUT). Keypoint mode: each key point defines an RGBA color for a given intensity. Colors are linearly interpolated between key points of the same tissue. LUT mode: the transfer function is directly defined by a texture in form of a 1D SharedImage of type float.

Both image intensities and colors are defined in normalized [0..1] space. The windowing is defined in original pixel value domain (e.g. Hounsfield units).

See also
TransferFunctionTissue ,

Public Types

enum class  Mode { Keypoint = 0 , LUT = 1 }
 Mode for rendering the TF from a set of keypoints or from a look-up-table.
 

Public Member Functions

 TransferFunction (vec2 windowingRange=vec2(0.0, 1.0), int textureSize=256)
 Default constructor.
 
 TransferFunction (const TransferFunction &rhs)
 
TransferFunctionoperator= (TransferFunction rhs)
 
bool operator== (const TransferFunction &other) const
 
bool operator!= (const TransferFunction &other) const
 
void invert ()
 Inverts this transfer function.
 
void setDirty ()
 Marks the textures of this transfer function as dirty.
 
const SharedImagestandardTexture () const
 Returns the image storing the standard 1D TF. TransferFunction owns this pointer; it may be invalidated as soon as the TF changes.
 
const SharedImagepreIntTexture () const
 Returns the image storing the pre-integrated TF. TransferFunction owns this pointer; it may be invalidated as soon as the TF changes.
 
vec2 opaqueRange () const
 Returns the range of intensities where this transfer function is opaque.
 
void addTissue (std::unique_ptr< TransferFunctionTissue > tissue)
 Adds the given texture to this TF.
 
void removeTissue (int index)
 Removes the given texture from this TF.
 
void clearTissues ()
 Removes all tissues from this TF.
 
void pushTissueToFront (int tissueIndex)
 Pushes the given tissue to the front of the list.
 
void deriveFrom (const GlImage &img, int maxKeypoints=12)
 Derives a custom TF from a GlImage.
 
- Public Member Functions inherited from Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 

Public Attributes

Signal signalChanged
 
- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 

Getters/Setters

bool empty () const
 
const std::vector< std::unique_ptr< TransferFunctionTissue > > & tissues () const
 Returns the list of all tissues.
 
TransferFunctionTissuetissue (int index)
 Returns the tissue at the given index.
 
void setLUT (std::unique_ptr< SharedImage > lut)
 Set 1D standard TF with an image as look-up-table and clear all tissues.
 
void removeLUT ()
 Remove the 1D standard TF and change mode to keypoints.
 
Mode mode ()
 Returns the mode which defines the rendering of the TF.
 
vec2 windowingRange () const
 Convenience function to return the range of intensities of the applied windowing (original values).
 
void setWindowingRange (const vec2 &newRange)
 Convenience function to set the range of intensities of the applied windowing to newRange (original values).
 
double window () const
 Return the size of the windowing window.
 
void setWindow (double value)
 Set the size of the windowing window.
 
double level () const
 Return the center of the windowing window (level).
 
void setLevel (double value)
 Set the center of the windowing window (level).
 
void setWindowLevel (double window, double level)
 Convenience method for setting the windowing range based on window and level.
 
const std::stringpresetName () const
 Gets the name of the original preset when this transfer function was created (may be the preset name, name of the file).
 
void setPresetName (const std::string &presetName)
 Sets the name of the original preset when this transfer function was created (may be the preset name, name of the file).
 
void setTextureSize (int value)
 Sets the size of the transfer function texture.
 

Configurable interface

void configure (const Properties *p) override
 Configure this object instance by de-serializing the given Properties.
 
void configuration (Properties *p) const override
 Serialize the current object configuration into the given Properties object.
 

Additional Inherited Members

- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Constructor & Destructor Documentation

◆ TransferFunction()

TransferFunction ( vec2 windowingRange = vec2(0.0, 1.0),
int textureSize = 256 )
explicit

Default constructor.

Parameters
windowingRangeRange of intensities (original value domain) of the applied windowing
textureSizeSize of the transfer function texture (optional)

Member Function Documentation

◆ empty()

bool empty ( ) const

Returns whether the TF is empty: -> keypoint mode: does not have any tissues. -> lut mode: standard TF is empty.

◆ setDirty()

void setDirty ( )

Marks the textures of this transfer function as dirty.

The next time someone will retrieve one of the TF textures, they will be recomputed. Call this method every time, you change one of the transfer function's tissues directly.

◆ addTissue()

void addTissue ( std::unique_ptr< TransferFunctionTissue > tissue)

Adds the given texture to this TF.

Parameters
tissueTissue to add, TransferFunction will take ownership of the pointer.

◆ removeTissue()

void removeTissue ( int index)

Removes the given texture from this TF.

Parameters
indexIndex of the tissue to remove, the corresponding pointer will be deleted.

◆ pushTissueToFront()

void pushTissueToFront ( int tissueIndex)

Pushes the given tissue to the front of the list.

Parameters
tissueIndexIndex of the tissue to move to the front.

◆ configure()

void configure ( const Properties * p)
overridevirtual

Configure this object instance by de-serializing the given Properties.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configuration() for the inverse functionality

Reimplemented from Configurable.

◆ configuration()

void configuration ( Properties * p) const
overridevirtual

Serialize the current object configuration into the given Properties object.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configure() for the inverse functionality

Reimplemented from Configurable.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close