Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

Histogram Class Reference

#include <Histogram.h>

Inherits GuiComponent.

List of all members.

Public Member Functions

 Histogram ()
 ~Histogram ()
void update (unsigned short *data, unsigned int &size)
void render (int x, int y, int width, int height)
void onLeftMouseClick (int x, int y)
void onMouseDrag (int x, int y)
void getColorByDensity (unsigned short &density, float &red, float &green, float &blue, float &alpha)
bool isInitialised ()
bool removeControlPoint ()

Public Attributes

TxPointgrabbedPoint


Detailed Description

This class defines a histogram. The Histrogram shows the density distribution of the voxelData wich had been loaded by the RawReader. Thus we give a pointer to the voxelData array and count therein the occurrence of the density values (in the range of 2^12 = 4096).

Definition at line 33 of file Histogram.h.


Constructor & Destructor Documentation

Histogram::Histogram  ) 
 

The constructor of the Histogram creates the window wich shows the histogram.

Definition at line 18 of file Histogram.cpp.

References grabbedPoint.

Histogram::~Histogram  )  [inline]
 

The destructor deletes the pointes that are initialised by the contructor.

Definition at line 71 of file Histogram.h.

References grabbedPoint.


Member Function Documentation

void Histogram::getColorByDensity unsigned short &  density,
float &  red,
float &  green,
float &  blue,
float &  alpha
 

This function takes a specific density and computes the resulting color responding to the histogram attached control points.

Parameters:
density for wich your want to know the color
red component
green component
blue component
alpha component

Definition at line 176 of file Histogram.cpp.

References TxFunction::getLinearInterpolatedColor().

bool Histogram::isInitialised  )  [inline]
 

Return the flag wether the histogram is initalised

Definition at line 133 of file Histogram.h.

void Histogram::onLeftMouseClick int  x,
int  y
 

This method is called, when the user hit the histogram at a given position x and y - e.g. when clicked with the mouse. The function determines if: 1. the user clicked on an empty space 2. the user selected an existing controlpoint In the first case, the program will add a new controlpoint at the given position. In the second case the program will ask the user if her wants to delete or change the controlpoint.

Parameters:
x position of the cursor
y position of the cursor

Definition at line 62 of file Histogram.cpp.

References TxFunction::addControlPoint(), OrthographicCamera::getLocalWorldCoordinates(), grabbedPoint, GuiComponent::hit(), and TxFunction::hitTxPoint().

void Histogram::onMouseDrag int  x,
int  y
 

This method is called, each time the user drag the mouse over the histogram. This usually happens when a controlpoint is moved.

Parameters:
x position of the cursor
y position of the cursor

Definition at line 99 of file Histogram.cpp.

References OrthographicCamera::getLocalWorldCoordinates(), grabbedPoint, GuiComponent::hit(), TxFunction::moveControlPoint(), and TxPoint::rgba.

bool Histogram::removeControlPoint  ) 
 

Remove the current grabbed point. If the point is NULL, the method returns false and nothing is removed.

Definition at line 202 of file Histogram.cpp.

References grabbedPoint, and TxFunction::removeControlPoint().

void Histogram::render int  x,
int  y,
int  width,
int  height
 

This function is responsible for the drawing of the histogram. Therefore it takes 4 parameters wich determine the viewport - e.g. where the histogram is drawn and wich size it has. Internal the histogram is always drawn with an orthographic projection.

Parameters:
x position of the histogram
y position of the histogram
width of the histogram
height of the histogram

Definition at line 114 of file Histogram.cpp.

References TxFunction::render(), OrthographicCamera::startCamera(), and OrthographicCamera::stopCamera().

void Histogram::update unsigned short *  data,
unsigned int &  size
 

This method initialise the frequency of occurrence of the density by reading each densiy value from the given array and adding +1 to the entry occurenceArray[density]. This function should be called each time, a new file is opened

Parameters:
*data a reference to the voxelData of the RawReader
&size the size of the array read

Definition at line 26 of file Histogram.cpp.

References GuiComponent::enable(), and GuiComponent::hide().


Member Data Documentation

TxPoint* Histogram::grabbedPoint
 

Pointer to the slected TxPoint.

Definition at line 60 of file Histogram.h.

Referenced by Histogram(), onLeftMouseClick(), onMouseDrag(), removeControlPoint(), and ~Histogram().


The documentation for this class was generated from the following files:
Generated on Mon Dec 12 15:20:26 2005 for CCube by  doxygen 1.4.1