#include <TransferFunction.h>
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, TFNode > | getAllNodes () const |
const TFNode & | getNode (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 () |
VolVis::VolumeRendering::TransferFunction::TransferFunction | ( | int | resolution = 4096 |
) |
Constructor. Creates two nodes at the beginning and the end.
resolution | the resolution of the texture which applies the transfer function to the gpu. Should be power of two. |
VolVis::VolumeRendering::TransferFunction::~TransferFunction | ( | ) |
Destructor.
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.
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 |
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.
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
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.
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.
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.
position | position (x-value) of the node that should be returned |
int VolVis::VolumeRendering::TransferFunction::getResolution | ( | ) | const |
Returns the resolution of the transfer function.
GLuint VolVis::VolumeRendering::TransferFunction::getTexture | ( | ) | const |
Returns the id of the texture containing the transfer function
bool VolVis::VolumeRendering::TransferFunction::hasNode | ( | int | position | ) | const |
Check if a node exists at the specified position
position | (x-value) where a node should be searched for |
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.
filePath | path to the file which should be loaded. |
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.
position | position (x-value) of the node which should be removed |
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.
filePath | path to the file where the transfer function should be saved |
void VolVis::VolumeRendering::TransferFunction::setNode | ( | int | position, | |
Eigen::Vector3f & | color, | |||
float | alpha | |||
) |
Convenience method. Does the same as void setNode(int position, TFNode* node)
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.
position | position (x-value) of the node | |
node | the new node which is stored at the specified position |