Main Page | Packages | Class Hierarchy | Class List | Directories | Class Members

IDVR.Volume.DataStructures.Transferfunction Class Reference

#include <Transferfunction.h>

List of all members.


Detailed Description

Class for representing a complete transfer funtion.

This class is part of the DataStructure namespace which is actually a subnamespace of the main namespace Volume. Furthermore the standard class Object is inherted to the Transferfunction class for better controlling of a particular quantity of Transferfunction instances.

The main target of this class is the storage of the complete transfer function which will be defined by the user on the GUI (see TransferFuncWin). This transfer function is an important attribute for each volume data object and decides the quality of the rendering process. Thus, each volume data object will have its own transfer function which is realized by the implemention of an own instance of this class into the IRenderer object of the specific DataObject instance.

Because the user defines only some sample points of the transfer function the remaining funtion values has to be interpolated with the member functions Transferfunction.calculateOpacityFrequency and Transferfunction.calculateColorFrequency.

The following member variables stores all necessary data attributes:

See also:
VolumeData - the main datastructure class.

DataObject - the volume data object class.

IRenderer - the abstract render model interface for controlling a specific render model.

Author:
Bernhard Pflugfelder
Version:
1.0
Date:
02-18-2005


Public Member Functions

 Transferfunction (void)
 This is the standard constructor.
 Transferfunction (int numOfDensityValues)
 Constructor initialization with the maximum number of valid gray (density) values.
 Transferfunction (float n_OpacityFunction __gc[], float n_ColorFunction __gc[,], unsigned short n_DensityScope, Hashtable *n_ColorSamples, Hashtable *n_OpacitySamples)
 Constructor initialization with an user-defined transfer function.
 ~Transferfunction (void)
 This is the standard deconstructor.
void addNewOpacityValue (int n_Density, float n_Opacity)
 Adds a new opacity function value to a specified density value.
void addNewColorValue (int n_Density, float n_Color __gc[])
 Adds a new color function value to a specified density value.
float getOpacity (int n_Density)
 Returns the opacity function value to the specified density value.
float getColor (int n_Density) __gc[]
 Returns the coor function value to the specified density value.
void calculateOpacityFrequency (unsigned short n_DensityScope)
 This function interpolates the opacity function for each density value.
void calculateColorFrequency (unsigned short n_DensityScope)
 This function interpolates the color function for each density value.
__property float get_OpacityFrequency (void) __gc[]
 Returns the current opacity transfer function.
__property float get_ColorFrequency (void) __gc[
 Returns the current color transfer function.
__property float __property
int 
get_FunctionLength (void)
 Returns the current length of the transfer function.
__property Hashtable * get_ColorSamples (void)
 Returns the current color sample points.
__property Hashtable * get_OpacitySamples (void)
 Returns the current opacity sample points.
__property float get_InterpolationFactor (void)
 Returns the current interpolation factor.
__property Color get_BackColor (void)
 Returns the current back color of the transfer function.
__property void set_InterpolationFactor (float n_InterpolationFactor)
 Sets a new interpolation factor.
__property void set_ColorFrequency (float n_ColorFrequency __gc[,])
 Sets a new color transfer function.
__property void set_OpacityFrequency (float n_OpacityFrequency __gc[])
 Sets a new opacity transfer function.
__property void set_FunctionLength (int n_functionLength)
 Sets a new function length.
__property void set_ColorSamples (Hashtable *n_ColorSamples)
 Sets new color sample points.
__property void set_OpacitySamples (Hashtable *n_OpacitySamples)
 Sets new opacity sample points.
__property void set_BackColor (Color n_BackColor)
 Sets a new back color for the current transfer function.

Static Public Member Functions

static Hashtable * convertOpacitySamplesToDrawMode (Hashtable *n_OpacitySamples, int panelWidth, int panelHeight)
 This static function converts the opacity sample point to drawable values.
static Hashtable * convertOpacitySamplesToSaveMode (Hashtable *n_OpacitySamples, int panelWidth, int panelHeight)
 This static function converts the opacity sample point to normalzed values between 0 and 1.
static Hashtable * convertColorSamplesToDrawMode (Hashtable *n_ColorSamples, int panelWidth)
 This static function converts the color sample point to drawable values.
static Hashtable * convertColorSamplesToSaveMode (Hashtable *n_ColorSamples, int panelWidth)
 This static function converts the color sample point to normalzed values between 0 and 1.
static float getDownSampledColors (int sampleFactor, float colorValues __gc[,]) __gc[
 Calculates the downsampled color transfer function.
static float static float getDownSampledOpacity (int sampleFactor, float opacityValues __gc[]) __gc[]
 Calculates the downsampled opacity transfer function.
static float getUpSampledColors (unsigned short n_DensityScope, int sampleFactor, float colorValues __gc[,]) __gc[
 Calculates the upsampled color transfer function.
static float static float getUpSampledOpacity (unsigned short n_DensityScope, int sampleFactor, float opacityValues __gc[]) __gc[]
 Calculates the upsampled opacity transfer function.
static TransferfunctionCreateGeneralTransfer (unsigned short n_DensityScope)
 Creates a standard transfer function.

Private Types

enum  ColorIndex
 Constant index values for the three color components red, green and blue.

Private Member Functions

void interpolate_ColorScope (int x1, int x2, Color c1, Color c2)
 This function interpolates the color transfer function linearly.

Private Attributes

float m_OpacityFunction __gc []
 Saves the opacity transfer function for each density value.
float m_ColorFunction __gc [,]
 Saves the color transfer function for each density value.
int m_FunctionLength
 Saves the transfer function length.
Hashtable * m_ColorSamples
 Saves all user-defined color sample points with its actual x coordinate as hash key and the color value as hash value.
Hashtable * m_OpacitySamples
 Saves all user-defined opacity sample points with its actual x coordinate as hash key and the opacity value as hash value.
float m_InterpolationFactor
 Saves the interpolation factor which gives information over the linearity of the interpolation:
  • 0.5 means absolut linearity
  • 0 means use only the left interpolation color
  • 1 means use only the right interpolation color
  • all other values between 0 and 1 will be use as interpolation weight for the left and right interpolation color.
.
Color m_BackColor
 Saves tje background color.


Constructor & Destructor Documentation

Transferfunction::Transferfunction void   ) 
 

This is the standard constructor.

All member variables of this new instance will be set to zero/null.

Transferfunction::Transferfunction int  numOfDensityValues  ) 
 

Constructor initialization with the maximum number of valid gray (density) values.

All member variables will be set to zero, the Transferfunction.m_FunctionLength member will be initialized with the given maximum number of gray values.

Parameters:
numOfDensityValues the maximum valid number of gray values.

Transferfunction::Transferfunction float n_OpacityFunction  __gc[],
float n_ColorFunction  __gc[,],
unsigned short  n_DensityScope,
Hashtable *  n_ColorSamples,
Hashtable *  n_OpacitySamples
 

Constructor initialization with an user-defined transfer function.

All member variables will be set to the corresponding parameters.

Parameters:
n_OpacityFunction the user-defined opacity transfer funtion at each density value.
n_ColorFunction the user-defined color transfer funtion at each density value.
n_DensityScope the maximum valid number of gray values.
n_OpacitySamples the user-defined opacity transfer function samples as an instance of the Hashtable class.
n_ColorSamples the user-defined color transfer function samples as an instance of the Hashtable class.

Transferfunction::~Transferfunction void   ) 
 

This is the standard deconstructor.

Espacially the Histogram::m_OpacityFunction, Histogram::m_ColorFunction, Histogram::m_OpacitySamples and Histogram::m_ColorSamples members will be deleted.


Member Function Documentation

void Transferfunction::addNewColorValue int  n_Density,
float n_Color  __gc[]
 

Adds a new color function value to a specified density value.

The remaining color transfer function will not be changed.

Parameters:
n_Density the choosen density value.
n_Color the new color value as an 3 element array for RGB components.

void Transferfunction::addNewOpacityValue int  n_Density,
float  n_Opacity
 

Adds a new opacity function value to a specified density value.

The remaining opacity transfer function will not be changed.

Parameters:
n_Density the choosen density value.
n_Opacity the new opacity value.

void IDVR.Volume.DataStructures.Transferfunction.calculateColorFrequency unsigned short  n_DensityScope  ) 
 

This function interpolates the color function for each density value.

Based upon the sample points of the Transferfunction.m_ColorSamples member the color transfer function can be linearly interpolated.

Parameters:
n_DensityScope the maximum valid number of gray values.

void IDVR.Volume.DataStructures.Transferfunction.calculateOpacityFrequency unsigned short  n_DensityScope  ) 
 

This function interpolates the opacity function for each density value.

Based upon the sample points of the Transferfunction.m_OpacitySamples member the opacity transfer function can be linearly interpolated.

Parameters:
n_DensityScope the maximum valid number of gray values.

static Hashtable* IDVR.Volume.DataStructures.Transferfunction.convertColorSamplesToDrawMode Hashtable *  n_ColorSamples,
int  panelWidth
[static]
 

This static function converts the color sample point to drawable values.

This means that all color sample point (exactly the coordinates of each sample points) will be converted to the original value scope between 0 and maximum width of the transfer function panel.

Parameters:
n_ColorSamples the current color sample points.
panelWidth the current width of the transfer function panel.
Returns:
The converted opacity sample points

static Hashtable* IDVR.Volume.DataStructures.Transferfunction.convertColorSamplesToSaveMode Hashtable *  n_ColorSamples,
int  panelWidth
[static]
 

This static function converts the color sample point to normalzed values between 0 and 1.

This means that all color sample point (exactly the coordinates of each sample points) will be converted to the value scope between 0 and 1.

Parameters:
n_ColorSamples the current opacity sample points.
panelWidth the current width of the transfer function panel.
Returns:
The converted opacity sample points

static Hashtable* IDVR.Volume.DataStructures.Transferfunction.convertOpacitySamplesToDrawMode Hashtable *  n_OpacitySamples,
int  panelWidth,
int  panelHeight
[static]
 

This static function converts the opacity sample point to drawable values.

This means that all opacity sample point (exactly the coordinates of each sample points) will be converted to the original value scope between 0 and maximum height/width of the transfer function panel.

Parameters:
n_OpacitySamples the current opacity sample points.
panelWidth the current width of the transfer function panel.
panelHeight the current height of the transfer function panel.
Returns:
The converted opacity sample points

static Hashtable* IDVR.Volume.DataStructures.Transferfunction.convertOpacitySamplesToSaveMode Hashtable *  n_OpacitySamples,
int  panelWidth,
int  panelHeight
[static]
 

This static function converts the opacity sample point to normalzed values between 0 and 1.

This means that all opacity sample point (exactly the coordinates of each sample points) will be converted to the value scope between 0 and 1.

Parameters:
n_OpacitySamples the current opacity sample points.
panelWidth the current width of the transfer function panel.
panelHeight the current height of the transfer function panel.
Returns:
The converted opacity sample points

static Transferfunction* IDVR.Volume.DataStructures.Transferfunction.CreateGeneralTransfer unsigned short  n_DensityScope  )  [static]
 

Creates a standard transfer function.

This means an linear opacity transfer function and a contant color transfer function with blue color.

Parameters:
n_DensityScope the maximum valid number of gray values.

__property Color IDVR.Volume.DataStructures.Transferfunction.get_BackColor void   ) 
 

Returns the current back color of the transfer function.

Returns:
The back color as an instance of the standard Color class.

float Transferfunction::get_ColorFrequency void   ) 
 

Returns the current color transfer function.

Returns:
The current color transfer funtion as an three dimensional float array.

__property Hashtable* IDVR.Volume.DataStructures.Transferfunction.get_ColorSamples void   ) 
 

Returns the current color sample points.

Returns:
The current color sample points as an instance of the Hashtable class.

__property float __property int IDVR.Volume.DataStructures.Transferfunction.get_FunctionLength void   ) 
 

Returns the current length of the transfer function.

Returns:
The transfer function length
Note:
The transfer function length is actually the maximum density scope.

__property float IDVR.Volume.DataStructures.Transferfunction.get_InterpolationFactor void   ) 
 

Returns the current interpolation factor.

Returns:
The interpolation factor.

float Transferfunction::get_OpacityFrequency void   ) 
 

Returns the current opacity transfer function.

Returns:
The current opacity transfer funtion as an one dimensional float array.

__property Hashtable* IDVR.Volume.DataStructures.Transferfunction.get_OpacitySamples void   ) 
 

Returns the current opacity sample points.

Returns:
The current opacity sample points as an instance of the Hashtable class.

float Transferfunction::getColor int  n_Density  ) 
 

Returns the coor function value to the specified density value.

Parameters:
n_Density the choosen density value.
Returns:
The corresponding color RGB value.

static float IDVR.Volume.DataStructures.Transferfunction.getDownSampledColors int  sampleFactor,
float colorValues  __gc[,]
[static]
 

Calculates the downsampled color transfer function.

Parameters:
sampleFactor the user-defined sampling factor.
colorValues the color transfer function values.
Returns:
The downsampled color values.

static float static float IDVR.Volume.DataStructures.Transferfunction.getDownSampledOpacity int  sampleFactor,
float opacityValues  __gc[]
[static]
 

Calculates the downsampled opacity transfer function.

Parameters:
sampleFactor the user-defined sampling factor.
opacityValues the opacity transfer function values.
Returns:
The downsampled opacity values.

float Transferfunction::getOpacity int  n_Density  ) 
 

Returns the opacity function value to the specified density value.

Parameters:
n_Density the choosen density value.
Returns:
The corresponding opacity value.

static float IDVR.Volume.DataStructures.Transferfunction.getUpSampledColors unsigned short  n_DensityScope,
int  sampleFactor,
float colorValues  __gc[,]
[static]
 

Calculates the upsampled color transfer function.

Parameters:
n_DensityScope the maximum valid number of gray values.
sampleFactor the user-defined sampling factor.
colorValues the color transfer function values.
Returns:
The upsampled color values.

static float static float IDVR.Volume.DataStructures.Transferfunction.getUpSampledOpacity unsigned short  n_DensityScope,
int  sampleFactor,
float opacityValues  __gc[]
[static]
 

Calculates the upsampled opacity transfer function.

Parameters:
n_DensityScope the maximum valid number of gray values.
sampleFactor the user-defined sampling factor.
opacityValues the opacity transfer function values.
Returns:
The upsampled color values.

void Transferfunction::interpolate_ColorScope int  x1,
int  x2,
Color  c1,
Color  c2
[private]
 

This function interpolates the color transfer function linearly.

Parameters:
x1 x coordinate of the left interpolation boundary point.
x2 x coordinate of the right interpolation boundary point.
c1 color value of the left interpolation boundary point.
c2 color value of the right interpolation boundary point.

__property void IDVR.Volume.DataStructures.Transferfunction.set_BackColor Color  n_BackColor  ) 
 

Sets a new back color for the current transfer function.

Parameters:
n_BackColor the new back color as an instance of the standard Color class.

__property void IDVR.Volume.DataStructures.Transferfunction.set_ColorFrequency float n_ColorFrequency  __gc[,]  ) 
 

Sets a new color transfer function.

Parameters:
n_ColorFrequency the new color transfer funtion as an three (RGB) dimensional array.

__property void IDVR.Volume.DataStructures.Transferfunction.set_ColorSamples Hashtable *  n_ColorSamples  ) 
 

Sets new color sample points.

Parameters:
n_ColorSamples the new color sample points as an instance of the Hashtable class.

__property void IDVR.Volume.DataStructures.Transferfunction.set_FunctionLength int  n_functionLength  ) 
 

Sets a new function length.

Parameters:
n_functionLength the new function length.
Note:
The current transfer function will not be deleted.

__property void IDVR.Volume.DataStructures.Transferfunction.set_InterpolationFactor float  n_InterpolationFactor  ) 
 

Sets a new interpolation factor.

Parameters:
n_InterpolationFactor the new interpolation factor which will be used for further sampling of the transfer function.

__property void IDVR.Volume.DataStructures.Transferfunction.set_OpacityFrequency float n_OpacityFrequency  __gc[]  ) 
 

Sets a new opacity transfer function.

Parameters:
n_OpacityFrequency the new opacity transfer funtion as an one dimensional array.

__property void IDVR.Volume.DataStructures.Transferfunction.set_OpacitySamples Hashtable *  n_OpacitySamples  ) 
 

Sets new opacity sample points.

Parameters:
n_OpacitySamples the new opacity sample points as an instance of the Hashtable class.


The documentation for this class was generated from the following files:
Generated on Sat Apr 9 11:51:01 2005 for RayCaster wiht Importance Driven Volume Rendering (IDVR) by  doxygen 1.4.1