#include <displayhistogram.h>
It is possible to zoom and pan portion of the histogram. At any time, the viewed portion of the histogram is normalizd, so the highest visible bin will have a height of 1 in the histogram.
This can be used in a transfer function editor with Ramps and Trapezoids to manage a lookup table of an image or of a volume.
Internally a texture keeps the histogram and zooming and panning are done by changing the texture coordinates (m_u1, m_u1) of the drawn square.
Public Member Functions | |
DisplayHistogram () | |
~DisplayHistogram () | |
template<typename DataType> | |
void | update (const DataType *data, unsigned int data_size, float min, float max, unsigned int nbBins) |
void | clamp (float left, float right) |
float | getLeft () const |
get left value of the visible histogram | |
float | getRight () const |
get right value of the visible histogram | |
void | display () const |
bool | mouse (float x, float y) |
bool | motion (float x, float y) |
Tools::TransferFunction::DisplayHistogram::DisplayHistogram | ( | ) |
Tools::TransferFunction::DisplayHistogram::~DisplayHistogram | ( | ) |
void Tools::TransferFunction::DisplayHistogram::update | ( | const DataType * | data, | |
unsigned int | data_size, | |||
float | min, | |||
float | max, | |||
unsigned int | nbBins | |||
) | [inline] |
create a new histogram with an image
image | compute the histogram of this image | |
data_size | numer of pixels in the image | |
min,max | the minimum and the maximum values of the histogram, this is used to display only a portion or the full intensity range of an image | |
nbBins | number of bins in the histogram |
Referenced by Tools::TransferFunction::Editor::update().
void Tools::TransferFunction::DisplayHistogram::clamp | ( | float | left, | |
float | right | |||
) |
change histogram lower and higher limit (show only a section of the histogram)
left,right | left and right intensity values of the visible histogram |
float Tools::TransferFunction::DisplayHistogram::getLeft | ( | ) | const [inline] |
float Tools::TransferFunction::DisplayHistogram::getRight | ( | ) | const [inline] |
void Tools::TransferFunction::DisplayHistogram::display | ( | ) | const |
display histogram on a centered 1x1 square
bool Tools::TransferFunction::DisplayHistogram::mouse | ( | float | x, | |
float | y | |||
) |
handle a mouse press
x,y | normalized mouse coordinate 0..1 |
bool Tools::TransferFunction::DisplayHistogram::motion | ( | float | x, | |
float | y | |||
) |
handle a mouse motion
x,y | normalized mouse coordinate 0..1 |