Main Page   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

TTwoLevelForm Class Reference

The Two Level Volume Rendering window. More...

#include <MDITwoLevel.h>

List of all members.

Private Methods

int __fastcall _getFirstBitIndex (int val)
 Get the index of the bit with the smalest index.

int __fastcall _getNextBitIndex (int val)
 Get the index of the next bit in the value.

void __fastcall _resize ()
 Resize the _picture array, update the status bar and write actual value of _resolution to LResolution.

void __fastcall _render ()
 The _render function performs the two level volume rendering.

void __fastcall _draw (rgb &val, int x, int y, int step)
 _draw is used to draw a color to an array of pixel into _picture.

void __fastcall _resetRenderer ()
 Resets the values needed by _renderImage.

void __fastcall _renderPreview ()
 Renders a fast preview image for setting up the viewing position.

bool __fastcall _renderImage ()
 Renders a high quality image.

bool __fastcall _isInside (vectorf &v)
 Returns true if the vector position is inside the rendering volume.

bool __fastcall _isInside (vectord &v)
 Returns true if the vector position is inside the rendering volume.

float __fastcall _getValue (vectorf &v)
 Returns the value at the position v.

double __fastcall _getValue (const vectord &v)
 Returns the value at the position v.

double __fastcall _getGradLength (const vectord &v)
 Returns the value form absgrad interpolated at position pos.

vectorf __fastcall _getGradient (vectorf &v)
 Returns the gradient at the position v.

vectord __fastcall _getGradient (vectord &v)
 Returns the gradient at the position v.

void __fastcall _calcColor (rgb &col, vectord &normal, vectord &view, vectord &light)
 Shades the color given by val.

void _setupTLAlpha (TSpeedButton *sb, TEdit *e, TTabSheet *ts, double f)
 Sets up the panel for the Two Level Alpha manipulation.

void _setupRef (TSpeedButton *sb, TEdit *e, TTabSheet *ts, double f)
 Set up the reference value panel.

void _setupListBox (TListBox *lb, int &rc)
 Sets up the list boxes on for a spezial ray caster.

void __fastcall _unsetBitInAllRCs (int idx)
 To ensure a special area is drawn by only one kind of ray caster, we first unset the spezial bit in all ray caster with this function.


Private Attributes

int _rotx
 Rotation angle about the respecitve axis.

int _roty
 Rotation angle about the respecitve axis.

int _rotz
 Rotation angle about the respecitve axis.

int _actualBit
 Used by _getFirstBitIndex and _getNextBitIndex.

bool _traging
 Does user want to trag the angle.

bool _rightButton
 If a dragging is started, is it started by the right mouse button.

int _resolution
 Resolution of the target picture.

int _pic_size
 This value is calculated by _resolution*_resolution and is for speed purpose only.

int _oldres
 Last picture resolution befor actual resolution.

int _progress
 The image drawing progress.

bool _stopIt
 Stop ray casting at the end of the actual cycle.

int _actres
 The actual resolution of the ray casting algorythm.

int _actposx
 The actual x position of the ray in terms of the _actres.

int _actposy
 The actual y position of the ray in terms of the _actres.

int _rpc
 The number of rays calculated turing a call of _renderImage.

float _maxTime
 Maximum time the ray tracing function should need.

vectord _viewx
 Viewing plane X direction.

vectord _viewy
 Viewing plane Y direction.

vectord _viewz
 Viewing plane Z direction.

vectord _center
 Center of viewing volume.

double _l2
 Ray lenght.

double _step
 Length of one step in viewing coordinates.

vectord _start
 Start position (lower left corner) of picture in viewing coordinates.

vectord _lightPos
 Position of light.

vectord _lightDir
 Direction of the light vector.

int _thres
 Threshold for preview mode.

double _ambient
 The ambient light intensity.

rgb _ambientCol
 The ambient light color.

double _light
 The light intensity.

rgb _lightCol
 The light color (by default white).

int _power
 The power for phong shading.

bool _sinus
 Should sinus be used in phong shading.

TDateTime _startTime
 Start time of calculation.

TEdit * _TwoLevelAlphaEdit
 Pointer for the manipulation via SbTwoLevelAlpha.

TEdit * _RefEdit
 Edit field to manipulate via TbRef.

double _alphaFH
 Two Level inserting alpha value for First Hit Volume Renderer.

int _thresFH
 Thres hold for the First Hit Volume Renderer.

int _firstHit
 Regions to render.

double _alphaMIP
 Insert alpha value for MIP.

int _MIP
 Areas to draw with MIP.

double _MIPref
 MIP Reference value.

double _alphaNPR
 Alpha value for NPR.

int _NPR
 Areas for NPR.

double _NPRref
 Reference value.

double _alphaNR
 Alpha value for NR.

int _NR
 Areas for NR.

int _NPRpower
 Power of gradient.

double _alphaAverage
 Alpha value for Average.

int _Average
 Areas for Average.

double _Averageref
 Reference value for Average:.

double _alphaTransparent
 Insert alpha value for Transparent.

int _Transparent
 Areas to draw with Transparent.


Detailed Description

The Two Level Volume Rendering window.

Todo:
Adjustable reference (intensity) value for Average Ray Caster.

Threshold value for NPR Ray Caster.

Separate power for border value for NPR Ray Caster from phong shading power.

Stop, start and restart buttons (How should stop be handled? Reset? Continue?).

Save and Load TL ray caster setting.

Export images.

Definition at line 49 of file MDITwoLevel.h.


Member Function Documentation

void __fastcall TTwoLevelForm::_calcColor rgb   col,
vectord &    normal,
vectord &    view,
vectord &    light
[inline, private]
 

Shades the color given by val.

Parameters:
col  The color value to be phong shaded.
normal  Surface normal (must be normalized).
view  Viewing vector (normalized).
light  Light direction (normalized).

Definition at line 298 of file MDITwoLevel.cpp.

References _ambient, _ambientCol, _light, _lightCol, rgb::b, rgb::g, vector< double >::normal(), and rgb::r.

Referenced by _renderImage().

void __fastcall TTwoLevelForm::_draw rgb   val,
int    x,
int    y,
int    step
[inline, private]
 

_draw is used to draw a color to an array of pixel into _picture.

It is used by _renderImage and _renderPreview.

Parameters:
val  the value to be filled into the area.
x  position in picture dimension of res.
y  position in picture dimension of res.
res  resolution of the image to be fitted into the picture of resolution _resolution.
step  the step width calculated by _resolution/_actres.

Definition at line 1108 of file MDITwoLevel.cpp.

References _pic_size, and _resolution.

Referenced by _renderImage(), and _renderPreview().

vectord __fastcall TTwoLevelForm::_getGradient vectord &    v [inline, private]
 

Returns the gradient at the position v.

The function assumes, that the coordinates of v lie inside the viewing volume.

Todo:
Reconstruct gradient instead of interpolating it.

Calculate interval length to harmonize _drawImage calculation time.

Definition at line 238 of file MDITwoLevel.cpp.

References vector< double >::X, vector< double >::Y, and vector< double >::Z.

vectorf __fastcall TTwoLevelForm::_getGradient vectorf &    v [inline, private]
 

Returns the gradient at the position v.

The function assumes, that the coordinates of v lie inside the viewing volume.

Definition at line 182 of file MDITwoLevel.cpp.

References vector< t >::X, vector< t >::Y, and vector< t >::Z.

Referenced by _renderImage(), and _renderPreview().

int __fastcall TTwoLevelForm::_getNextBitIndex int    val [private]
 

Get the index of the next bit in the value.

_getFirstBitIndex must be called first.

Definition at line 85 of file MDITwoLevel.cpp.

References _actualBit.

Referenced by _getFirstBitIndex(), and _setupListBox().

double __fastcall TTwoLevelForm::_getValue const vectord &    v [inline, private]
 

Returns the value at the position v.

The function assumes, that the coordinates of v lie inside the viewing volume. This function is used by _drawImage only.

Definition at line 138 of file MDITwoLevel.cpp.

References vector< double >::X, vector< double >::Y, and vector< double >::Z.

float __fastcall TTwoLevelForm::_getValue vectorf &    v [inline, private]
 

Returns the value at the position v.

The function assumes, that the coordinates of v lie inside the viewing volume.

Definition at line 97 of file MDITwoLevel.cpp.

References vector< t >::X, vector< t >::Y, and vector< t >::Z.

Referenced by _renderPreview().

void __fastcall TTwoLevelForm::_render   [inline, private]
 

The _render function performs the two level volume rendering.

It calculates the color of a point and calls _draw which in turn updates the _picture array.

Definition at line 1102 of file MDITwoLevel.cpp.

References _renderPreview().

bool __fastcall TTwoLevelForm::_renderImage   [inline, private]
 

Renders a high quality image.

Todo:
code a two level ray caster.

adjust ray caster, so it can handle any resolution (others than sqares with a size of a multiple of 2).

Definition at line 512 of file MDITwoLevel.cpp.

References _actposx, _actposy, _actres, _alphaAverage, _alphaFH, _alphaMIP, _alphaNPR, _alphaNR, _alphaTransparent, _ambient, _ambientCol, _Average, _Averageref, _calcColor(), _draw(), _firstHit, _getGradient(), _getGradLength(), _isInside(), _l2, _lightDir, _maxTime, _MIP, _MIPref, _NPR, _NPRref, _NR, _pic_size, _progress, _resolution, _rpc, _start, _startTime, _step, _stopIt, _thresFH, _Transparent, _viewx, _viewy, _viewz, rgb::b, rgb::g, vector< double >::normal(), and rgb::r.

void TTwoLevelForm::_setupListBox TListBox *    lb,
int &    rc
[private]
 

Sets up the list boxes on for a spezial ray caster.

Parameters:
lb  The list box to be set up.
rc  The ray caster value to manipulate.
Returns:
Returns the manipulated ray caster value.

Definition at line 1224 of file MDITwoLevel.cpp.

References _getFirstBitIndex(), and _getNextBitIndex().


Member Data Documentation

int TTwoLevelForm::_actres [private]
 

The actual resolution of the ray casting algorythm.

It starts at 2 and ends up at _resolution. Therefor _resolution has to be a multiple of 2.

Todo:
adjust the ray casting algorythm in a way, so it can handle any target resolution.

Definition at line 306 of file MDITwoLevel.h.

Referenced by _renderImage(), and _resetRenderer().

int TTwoLevelForm::_firstHit [private]
 

Regions to render.

Only one region could be rendered with the First Hit because there is only one threshold.

Todo:
Think about a alternative method to render multiple regions with first hit. How should the threshold be defined then?

Definition at line 425 of file MDITwoLevel.h.

Referenced by _renderImage(), and _unsetBitInAllRCs().

vectord TTwoLevelForm::_lightPos [private]
 

Position of light.

It is calculated relative to the viewing position.

Definition at line 357 of file MDITwoLevel.h.

Referenced by _resetRenderer().

int TTwoLevelForm::_progress [private]
 

The image drawing progress.

It is calculated by incrementing the value for each finished ray. So the final value equals to _resolution*_resolution.

Definition at line 294 of file MDITwoLevel.h.

Referenced by _renderImage(), and _resetRenderer().

int TTwoLevelForm::_rpc [private]
 

The number of rays calculated turing a call of _renderImage.

Todo:
adjust the value by mesuring the time needed for the actual number or rays.

Definition at line 321 of file MDITwoLevel.h.

Referenced by _renderImage(), and _resetRenderer().


The documentation for this class was generated from the following files:
Generated on Thu Jan 23 06:17:40 2003 for Vol by doxygen1.2.18