#include <editor.h>
Display and manipulate a transfer function editor. It draws a histogram and manipulators allow you to change the transfer function. It is possible to change the color of a manipulator feature (e.g. ramp or trapezoid corner).
Histogram blended with volume
Add Ramp and other manipulator:
Tools::TransferFunction::Editor tfe; // initialize transfer function editor tfe.update(image, 100*100); tfe.place(x,y, tfe_width,tfe_height, window_with,window_height); tfe.add(new Ramp(100,200)); // handle mouse events tfe.mouse(x,y); tfe.motion(x,y); tfe.display(); // query transfer function (returns rgba(0..1)) tfe.get(intensity, r,g,b,a);
To update a volume renderer, use Display::Volume::updateLut(tfe)
Public Member Functions | |
Editor () | |
~Editor () | |
template<typename DataType> | |
void | update (const DataType *data, unsigned int data_size) |
void | clamp (float min, float max) |
void | place (int x, int y, int width, int height, int win_width, int win_height) |
template<typename Manip> | |
void | add (Manip *o) |
void | clear () |
bool | mouse (int x, int y) |
bool | motion (int x, int y) |
bool | lutchanged () const |
void | contrast (float contrast) |
float | contrast () const |
void | brightness (float brightness) |
float | brightness () const |
void | colorMode () |
void | display () const |
void | hide (bool status=true) |
bool | status () const |
void | get (float intensity, float &r, float &g, float &b, float &a) const |
Classes | |
struct | TFEobject |
struct | TFEobjectimpl |
Tools::TransferFunction::Editor::Editor | ( | ) |
Tools::TransferFunction::Editor::~Editor | ( | ) |
void Tools::TransferFunction::Editor::update | ( | const DataType * | data, | |
unsigned int | data_size | |||
) | [inline] |
update transfer function with new image
References LOCATE, and Tools::TransferFunction::DisplayHistogram::update().
void Tools::TransferFunction::Editor::clamp | ( | float | min, | |
float | max | |||
) |
only show a portion of the transfer function
void Tools::TransferFunction::Editor::place | ( | int | x, | |
int | y, | |||
int | width, | |||
int | height, | |||
int | win_width, | |||
int | win_height | |||
) |
place transfer function at position x,y with size width,height by giving window size the aspect ratio can be known
x,y | lower left corner of the transfer function editor | |
width,height | size of the editor | |
win_width,win_height | size of the window or of the current viewport |
void Tools::TransferFunction::Editor::add | ( | Manip * | o | ) | [inline] |
add new manipulator (ramp, trapezoid) memory is handled by editor (will be deleted with editor: do not delete manipulator outside) manipulator must have the following interface:
void clamp(left, right); // only show portion of manipulator between left and right bool mouse(x,y); // handle mouse click (normalized coordinates 0..1) void motion(x,y); // handle mouse motion void display() const; // display manipulator void get(i, r,g,b,a) const; // query value at given intensity void setColor(r,g,b); // give a color (may be used by the selected feature)
References Tools::TransferFunction::DisplayHistogram::getLeft(), and Tools::TransferFunction::DisplayHistogram::getRight().
void Tools::TransferFunction::Editor::clear | ( | ) |
clear, remove all manipulators
bool Tools::TransferFunction::Editor::mouse | ( | int | x, | |
int | y | |||
) |
handle mouse click (mouse coordinates are pixels)
bool Tools::TransferFunction::Editor::motion | ( | int | x, | |
int | y | |||
) |
handle mouse motion (mouse coordinates are pixels)
bool Tools::TransferFunction::Editor::lutchanged | ( | ) | const [inline] |
has lut value changed after a mouse event (ie. one object caught and changed its properties)
void Tools::TransferFunction::Editor::contrast | ( | float | contrast | ) | [inline] |
float Tools::TransferFunction::Editor::contrast | ( | ) | const [inline] |
get contrast (scale color) between 0 and 1
void Tools::TransferFunction::Editor::brightness | ( | float | brightness | ) | [inline] |
float Tools::TransferFunction::Editor::brightness | ( | ) | const [inline] |
get brightness (offset color) between 0 and 1
void Tools::TransferFunction::Editor::colorMode | ( | ) |
void Tools::TransferFunction::Editor::display | ( | ) | const |
display transfer function
void Tools::TransferFunction::Editor::hide | ( | bool | status = true |
) | [inline] |
display hide
status | true if the TFE must be hidden, false to show it |
References status().
bool Tools::TransferFunction::Editor::status | ( | ) | const [inline] |
get display status
Referenced by hide().
void Tools::TransferFunction::Editor::get | ( | float | intensity, | |
float & | r, | |||
float & | g, | |||
float & | b, | |||
float & | a | |||
) | const |
query transfer function at given intensity returns rgba (0..1)