VolVis::VolumeRendering::TransferFunction Class Reference

#include <TransferFunction.h>


Detailed Description

Manages the nodes of a transfer function and creates the according texture. The transfer function is used to map density values to a color and an alpha value.


Public Member Functions

void bindTexture () const
bool editNode (int oldPos, int newPos, float newAlpha)
void editNodeColor (int position, Eigen::Vector3f &color)
const std::map< int, TFNodegetAllNodes () const
const TFNodegetNode (int position) const
int getResolution () const
GLuint getTexture () const
bool hasNode (int position) const
void openFile (std::string &filePath)
bool removeNode (int position)
void saveToFile (std::string &filePath)
void setNode (int position, Eigen::Vector3f &color, float alpha)
void setNode (int position, TFNode &node)
 TransferFunction (int resolution=4096)
 ~TransferFunction ()

Static Public Member Functions

static GLuint getDisabledGradientTF ()
static GLuint getDisabledIntensityTF ()


Constructor & Destructor Documentation

VolVis::VolumeRendering::TransferFunction::TransferFunction ( int  resolution = 4096  ) 

Constructor. Creates two nodes at the beginning and the end.

Parameters:
resolution the resolution of the texture which applies the transfer function to the gpu. Should be power of two.

VolVis::VolumeRendering::TransferFunction::~TransferFunction (  ) 

Destructor.


Member Function Documentation

void VolVis::VolumeRendering::TransferFunction::bindTexture (  )  const

bind the texture id containing the transfer function in openGL.

bool VolVis::VolumeRendering::TransferFunction::editNode ( int  oldPos,
int  newPos,
float  newAlpha 
)

Moves a node of the transfer function. The position in the array and the alpha value are changed. The color stays constant. The position of the first and last node cannot be changed (but the alpha value is edited). A position cannot be changed to a lower/greater value than its neighbours'. If the node couldn't be found, nothing is done.

Parameters:
oldPos old position to identify the node
newPos the new position (x-value) of the node
newAlpha the new alpha value (y-value) of the node
Returns:
false if the position couldn't be changed.

void VolVis::VolumeRendering::TransferFunction::editNodeColor ( int  position,
Eigen::Vector3f &  color 
)

Edits the color of the node. All other parameters stay constant. If the node couldn't be found, nothing is done.

Parameters:
position position (x-value) to identify the node
color the new color of the node

const std::map<int, TFNode> VolVis::VolumeRendering::TransferFunction::getAllNodes (  )  const

returns the map of all nodes

Returns:
map of all nodes defined by their positions (x-values).

static GLuint VolVis::VolumeRendering::TransferFunction::getDisabledGradientTF (  )  [static]

Creates (if not already available) a small texture which transfers all gradient magnitude values to one, which is the same as if no gradient transfer function would be applied.

Returns:
texture id of disabled gradient transfer function

static GLuint VolVis::VolumeRendering::TransferFunction::getDisabledIntensityTF (  )  [static]

Creates (if not already available) a small texture which transfers the intensity values from zero to one, which is the same as if the intensity values would be drawn directly.

Returns:
texture id of disabled intensity transfer function

const TFNode& VolVis::VolumeRendering::TransferFunction::getNode ( int  position  )  const

Returns the node at the specified position. If no node exists at this position, an error will occur. Therefor it's absolutely necessary to check with hasNode(int position) before calling this method.

Parameters:
position position (x-value) of the node that should be returned
Returns:
the node at the specified position

int VolVis::VolumeRendering::TransferFunction::getResolution (  )  const

Returns the resolution of the transfer function.

Returns:
resolution of the transfer function texture

GLuint VolVis::VolumeRendering::TransferFunction::getTexture (  )  const

Returns the id of the texture containing the transfer function

Returns:
openGL texture id

bool VolVis::VolumeRendering::TransferFunction::hasNode ( int  position  )  const

Check if a node exists at the specified position

Parameters:
position (x-value) where a node should be searched for
Returns:
false if no node exists

void VolVis::VolumeRendering::TransferFunction::openFile ( std::string &  filePath  ) 

Opens a transfer function from a file. The file contains all nodes of the new transfer function.

Parameters:
filePath path to the file which should be loaded.
See also:
saveToFile

bool VolVis::VolumeRendering::TransferFunction::removeNode ( int  position  ) 

Removes the node which is stored at the specified position. The first and the last point cannot be removed.

Parameters:
position position (x-value) of the node which should be removed
Returns:
false if position is less than 1 or greater than 4094

void VolVis::VolumeRendering::TransferFunction::saveToFile ( std::string &  filePath  ) 

Saves this transfer function to a file. All nodes of this transfer function are written to a file.

Parameters:
filePath path to the file where the transfer function should be saved
See also:
openFile

void VolVis::VolumeRendering::TransferFunction::setNode ( int  position,
Eigen::Vector3f &  color,
float  alpha 
)

Convenience method. Does the same as void setNode(int position, TFNode* node)

Parameters:
position position (x-value) of the node
color 3d-vector defining the color of the new node. The color components are defined as floats between 0 (black) and 1 (white)
alpha alpha value (y-value) of the new node

void VolVis::VolumeRendering::TransferFunction::setNode ( int  position,
TFNode node 
)

Sets a node at the specified position. If the node already exists, its values are changed, otherwise it is created.

Parameters:
position position (x-value) of the node
node the new node which is stored at the specified position


The documentation for this class was generated from the following file:
Generated on Wed Dec 5 12:27:31 2007 for VolVis by  doxygen 1.5.1-p1