Tools::TransferFunction::Editor Class Reference

#include <editor.h>

Collaboration diagram for Tools::TransferFunction::Editor:

Collaboration graph
[legend]

List of all members.


Detailed Description

Transfer function editor.

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).

Editor.png

Histogram blended with volume

When drawing the transfer function, it can be blended with the background.

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)

See also:
Display::Volume::updateLut()

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

Constructor & Destructor Documentation

Tools::TransferFunction::Editor::Editor (  ) 

Tools::TransferFunction::Editor::~Editor (  ) 


Member Function Documentation

template<typename DataType>
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

Parameters:
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

template<typename Manip>
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)

Returns:
true if event is caught in the TFE area

bool Tools::TransferFunction::Editor::motion ( int  x,
int  y 
)

handle mouse motion (mouse coordinates are pixels)

Returns:
true if event is caught in the TFE area

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]

change contrast (scale color)

Parameters:
contrast scale color, default is 1

float Tools::TransferFunction::Editor::contrast (  )  const [inline]

get contrast (scale color) between 0 and 1

void Tools::TransferFunction::Editor::brightness ( float  brightness  )  [inline]

change brightness (offset color)

Parameters:
brightness offset color, default is 0

float Tools::TransferFunction::Editor::brightness (  )  const [inline]

get brightness (offset color) between 0 and 1

void Tools::TransferFunction::Editor::colorMode (  ) 

in color mode, the mouse motion will select a color entering this mode will pop a color selector if motion is outside the color selector, the editor leaves the color mode

void Tools::TransferFunction::Editor::display (  )  const

display transfer function

void Tools::TransferFunction::Editor::hide ( bool  status = true  )  [inline]

display hide

Parameters:
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)


The documentation for this class was generated from the following file:

Generated on Tue Aug 4 17:57:43 2009 for libvd by  doxygen 1.5.5