#include <Transferfunction.h>
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:
DataObject - the volume data object class.
IRenderer - the abstract render model interface for controlling a specific render model.
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 Transferfunction * | CreateGeneralTransfer (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:
| |
Color | m_BackColor |
Saves tje background color. |
|
This is the standard constructor. All member variables of this new instance will be set to zero/null. |
|
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.
|
|
Constructor initialization with an user-defined transfer function. All member variables will be set to the corresponding parameters.
|
|
This is the standard deconstructor. Espacially the Histogram::m_OpacityFunction, Histogram::m_ColorFunction, Histogram::m_OpacitySamples and Histogram::m_ColorSamples members will be deleted. |
|
Adds a new color function value to a specified density value. The remaining color transfer function will not be changed.
|
|
Adds a new opacity function value to a specified density value. The remaining opacity transfer function will not be changed.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
Creates a standard transfer function. This means an linear opacity transfer function and a contant color transfer function with blue color.
|
|
Returns the current back color of the transfer function.
|
|
Returns the current color transfer function.
|
|
Returns the current color sample points.
|
|
Returns the current length of the transfer function.
|
|
Returns the current interpolation factor.
|
|
Returns the current opacity transfer function.
|
|
Returns the current opacity sample points.
|
|
Returns the coor function value to the specified density value.
|
|
Calculates the downsampled color transfer function.
|
|
Calculates the downsampled opacity transfer function.
|
|
Returns the opacity function value to the specified density value.
|
|
Calculates the upsampled color transfer function.
|
|
Calculates the upsampled opacity transfer function.
|
|
This function interpolates the color transfer function linearly.
|
|
Sets a new back color for the current transfer function.
|
|
Sets a new color transfer function.
|
|
Sets new color sample points.
|
|
Sets a new function length.
|
|
Sets a new interpolation factor.
|
|
Sets a new opacity transfer function.
|
|
Sets new opacity sample points.
|