Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vu1 Class Reference

The root class for all volume data in the vuVolume project. More...

#include <volume.h>

Inheritance diagram for vu1:

Inheritance graph
[legend]
Collaboration diagram for vu1:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 vu1 ()
 Default constructor.
 vu1 (const vu1 &inst)
 A copy constructor doing a deep copy of the volume data.
virtual ~vu1 ()
 Destructor.
vu1operator= (const vu1 &rhs)
 A deep assignment operator.
void setFileName (const char *val)
 Sets the file name that the read and write methods access.
const char * getFileName (void) const
 Returns the file name that the volume class is associated with.
virtual bool read (void)=0
 Reads volume data from the data file set with setFileName().
virtual bool write (void)=0
 Writes volume data to the data file set with setFileName().
const char * getHeader (void) const
 Gets the descriptive header for the volume data.
virtual bool IsReRendering ()
 Returns true if the method is allowed to rerender, false otherwise.
virtual void setIsReRendering (bool isit=true)
 Sets the return value of IsReRendering to be the same as the value of isit.
dword getDataSize ()
 Gets the size of the data.
void setRenderState (dword val)
 Sets the render state.
dword getRenderState (void) const
 Returns the render state.
virtual void setViewVectors (const vuVector &view, const vuVector &up, const vuVector &right)=0
 Sets the camera viewing position for the render method.
virtual void render (void)=0
 Renders the volume to OpenGL, using the appropriate render method.
bool errorOccurred (void) const
 Indicates whether an error occurred with the volume class.
byte getErrorLevel (void) const
 Returns the level of the error.
const char * getErrorMessage (void) const
 Returns an error message associated with an error that occured, if any.
virtual void preview (int hint=0)
 Provides a (fast renderable) preview (ms).
void setCamera (vuCamera *mycamera)
 Set the camera (ms).
vuCameragetCamera ()
 Returns the camera (ms).
vuCameragetCameraPtr ()
 Returns a pointer to the camera (ms).
virtual vuVector getCenter () const
 returns the center of the volume
virtual void glInit ()
virtual void glResize (dword width, dword height)

Protected Member Functions

void close (void)
 Closes any opened data and clears the error information.
virtual bool read (FILE *file)
 Reads the general volume info from the file.
virtual bool write (FILE *file)
 Writes the general volume info to the file.
bool setError (const char *Message, byte ErrorLevel=1)
 Sets the error flag in the class.
bool setInvalidFormatError ()
 A shortcut to setting an invalid data format error while reading.
bool setWriteError ()
 A shortcut to setting a writing to a file error.

Protected Attributes

bytem_Data
 The volume data.
dword m_DataSize
 The size of the volume data in bytes.
dword m_RenderState
 The render state--currently not used.
vuString m_FileName
 The file name that the volume data is associated with.
vuString m_Header
 The description header for the volume data.
bool m_Binary
 Whether the volume data file is in binary or ascii format.
bool m_Error
 True when an error with the volume data has occurred.
vuString m_ErrorMessage
 The error message associated with the error.
byte m_ErrorLevel
 The severity level of the error.
bool m_rerendering
vuCameram_Camera
 The Camera.

Detailed Description

The root class for all volume data in the vuVolume project.

It defines the most general interface for all possible volume data. Most interaction with volume data is through this interface. The interface also defines the actions that are possible on volume data, such as render(), read() and write().

To use the volume tree, a proper leaf class of the tree must be instantiated. The class instantiated specifies the type of volume data to be worked with, usually up to the type of rendering method desired. Once instantiated, the volume data file name is set with the setFileName() method. The volume data can then be read with the read() method, which also initializes the whole class so that it's fully functional. Finally, the volume data can be viewed and operated on using the other class methods, such as render().

Definition at line 41 of file volume.h.


Constructor & Destructor Documentation

vu1::vu1  ) 
 

Default constructor.

Creates an empty volume with no data.

Definition at line 11 of file volume.cpp.

References m_Camera, m_Data, m_DataSize, m_Error, m_ErrorLevel, m_RenderState, and m_rerendering.

vu1::vu1 const vu1 inst  ) 
 

A copy constructor doing a deep copy of the volume data.

All the volume data is copied to the new class. This can be both time and resource consuming, so be careful when coding.

Definition at line 29 of file volume.cpp.

References byte, m_Binary, m_Camera, m_Data, m_DataSize, m_Error, m_ErrorLevel, m_ErrorMessage, m_FileName, m_Header, and m_RenderState.

vu1::~vu1  )  [virtual]
 

Destructor.

Definition at line 62 of file volume.cpp.

References m_Camera, and m_Data.


Member Function Documentation

void vu1::close void   )  [protected]
 

Closes any opened data and clears the error information.

This method closes all the data for the instance. The instance still points to the same file as before, but all the volume data is deleted and freed. This is useful for freeing up memory if the data is no longer needed. The method also resets any error information that might have occurred during reading or processing.

Definition at line 205 of file volume.cpp.

References vuString::empty(), m_Data, m_DataSize, m_Error, m_ErrorLevel, m_ErrorMessage, and m_Header.

Here is the call graph for this function:

bool vu1::errorOccurred void   )  const
 

Indicates whether an error occurred with the volume class.

Currently, errors can only arrise from reading and writing volume data.

Returns:
True if an error has occurred.

Definition at line 109 of file volume.cpp.

vuCamera & vu1::getCamera  ) 
 

Returns the camera (ms).

Definition at line 345 of file volume.cpp.

Referenced by vuSpecFVR::getCamera(), vuSpecFVR::glOnMouse(), vuBCCSheetSplatter::glOnMouse(), vuBCCSheetSplatter::glRender(), vuSpectral::init(), vuRaycast::init(), vuRaycast::onKeyboard(), vuBasicUtility::onMouseLeftMoving(), vuRaycast::onRender(), vuBCCRaycaster::onRender(), and vuBCCFirstHitRaycaster::onRender().

vuCamera * vu1::getCameraPtr  ) 
 

Returns a pointer to the camera (ms).

Definition at line 350 of file volume.cpp.

Referenced by Scanner::_renderView(), vuSpectral::getCamera(), vuRaycast::getCamera(), vuBCCRaycaster::getCamera(), vuBCCFirstHitRaycaster::getCamera(), vuBCCSheetSplatter::glOnMouse(), vuBCCSheetSplatter::glResize(), vuBasicUtility::onKeyboardKeyframer(), vuBasicUtility::onKeyboardRotate(), vuBasicUtility::onKeyboardZoom(), vuBasicUtility::onMouseLeftMoving(), vuBasicUtility::onMouseRightMoving(), vu1112::preview(), and vu1512::preview().

vuVector vu1::getCenter  )  const [virtual]
 

returns the center of the volume

Reimplemented in vu1512, vu1712< SIZE >, vu1611< SIZE, TYPE >, vu1112113, vu1112, vu1611< SIZE, float >, and vu1611< SIZE, byte >.

Definition at line 355 of file volume.cpp.

Referenced by vuBasicUtility::onKeyboardRotate(), and vuBasicUtility::onMouseLeftMoving().

dword vu1::getDataSize  ) 
 

Gets the size of the data.

Might be useful for optimization by case.

Definition at line 167 of file volume.cpp.

References dword.

byte vu1::getErrorLevel void   )  const
 

Returns the level of the error.

Errors that can occur have different levels, staring with 0 for no error, and increasing according to the severity of the level. Currently there are only two error levels, 0 and 1.

Definition at line 118 of file volume.cpp.

References byte.

const char * vu1::getErrorMessage void   )  const
 

Returns an error message associated with an error that occured, if any.

This is a user readable error message that can be displayed in an error window.

Definition at line 127 of file volume.cpp.

References vuString::c_str(), and m_ErrorMessage.

Referenced by vuSplat::init(), vuSpectral::init(), vuSpecSplat::init(), vuSpecFVR::init(), vuSlicer::init(), vuShearWarp::init(), vuRaycast::init(), vuFVR::init(), vuCellProjector::init(), vuBccSplat::init(), vuBCCSheetSplatter::init(), vuBCCShearWarp::init(), vuBCCRaycaster::init(), vuBCCMarchingTetrahedra::init(), and vuBCCFirstHitRaycaster::init().

Here is the call graph for this function:

const char * vu1::getFileName void   )  const
 

Returns the file name that the volume class is associated with.

If no filename has been set for the instance, then 0 is returned.

Definition at line 187 of file volume.cpp.

References vuString::c_str(), and m_FileName.

Referenced by vuShearWarp::init(), vuBCCShearWarp::init(), and main().

Here is the call graph for this function:

const char * vu1::getHeader void   )  const
 

Gets the descriptive header for the volume data.

The header is a one line description of the volume data that is written into the file. It provides a short description of what is stored in the data file. This architecture is according to the vtk file type. For more information, see the .vu file format document. If no volume data has not been read, the method returns 0.

Definition at line 196 of file volume.cpp.

References vuString::c_str(), and m_Header.

Here is the call graph for this function:

dword vu1::getRenderState void   )  const
 

Returns the render state.

Currently undefined for the volume tree.

Definition at line 158 of file volume.cpp.

References dword.

void vu1::glInit  )  [virtual]
 

Definition at line 362 of file volume.cpp.

void vu1::glResize dword  width,
dword  height
[virtual]
 

Reimplemented in vu1712_1< SIZE >, vu1611_1< SIZE, TYPE >, vu1611_2< SIZE, TYPE >, vu1611< SIZE, TYPE >, vu1112119, vu1611_1< SIZE, float >, vu1611_1< SIZE, byte >, vu1611_2< SIZE, float >, vu1611_2< SIZE, byte >, vu1611< SIZE, float >, and vu1611< SIZE, byte >.

Definition at line 367 of file volume.cpp.

Referenced by vuBasicSubWindow::glInit().

bool vu1::IsReRendering  )  [virtual]
 

Returns true if the method is allowed to rerender, false otherwise.

Definition at line 317 of file volume.cpp.

Referenced by vu1112117::getBuffer(), vuFVR::glRender(), vuSplat::IsReRendering(), vuFVR::IsReRendering(), vuCellProjector::IsReRendering(), vuBasicSubWindow::render(), vu1112111::render(), and vu111211a::render().

vu1 & vu1::operator= const vu1 rhs  ) 
 

A deep assignment operator.

All the volume data is copied to the new class. This can be both time and resource consuming, so be careful when coding.

Definition at line 78 of file volume.cpp.

References byte, m_Binary, m_Data, m_DataSize, m_Error, m_ErrorLevel, m_ErrorMessage, m_FileName, m_Header, and m_RenderState.

Referenced by vu1611< SIZE, TYPE >::operator=(), vu12::operator=(), vu112::operator=(), vu14::operator=(), vu13::operator=(), vu1113::operator=(), vu1112::operator=(), vu1712< SIZE >::operator=(), vu1512::operator=(), and vu1111::operator=().

void vu1::preview int  hint = 0  )  [virtual]
 

Provides a (fast renderable) preview (ms).

Reimplemented in vu1512, vu1611_2< SIZE, TYPE >, vu1112, vu1611_2< SIZE, float >, and vu1611_2< SIZE, byte >.

Definition at line 331 of file volume.cpp.

Referenced by vuBasicUtility::glRender(), and vuSphericViewWin::render().

bool vu1::read FILE *  file  )  [protected, virtual]
 

Reads the general volume info from the file.

This includes the standard vuVolume header, the description header for the data file, and whether the data is stored in binary or ascii format.

Reimplemented in vu15, vu15121, vu1512, vu151, vu17, vu171, vu16, vu1611< SIZE, TYPE >, vu161, vu11, vu11121, vu11122, vu1112, vu111, vu1611< SIZE, float >, and vu1611< SIZE, byte >.

Definition at line 225 of file volume.cpp.

References vuString::getLength(), m_Binary, m_Header, and setInvalidFormatError().

Here is the call graph for this function:

virtual bool vu1::read void   )  [pure virtual]
 

Reads volume data from the data file set with setFileName().

This is the abstract method for reading in all types of volume data. It can only be called once a specific node of the volume tree has been instantiated, a node which corresponds to the type of data being read.

If the read is successful, the function returns true. If the file does not exist or is in an invalid format, the function returns false. In this case, the error information is set for the instance.

Once the read method is called, the volume instance is fully initialized and all the other methods may be called on it. This includes initializing OpenGL for the render method.

Returns:
True if successful, false otherwise.

Implemented in vu15121, vu1512113, vu1512119, vu1512112, vu1512111, vu1512122, vu1512121, vu1712_1< SIZE >, vu1611_4< SIZE, TYPE >, vu1611_3< SIZE, TYPE >, vu1611_2< SIZE, TYPE >, vu1611< SIZE, TYPE >, vu11121, vu111211a, vu1112117, vu1112113, vu111211A, vu1112119, vu1112116, vu1112118, vu1112115, ns_vu1112112::vu1112112, vu1112111, vu11122, vu1112211, vu1611_2< SIZE, float >, vu1611_2< SIZE, byte >, vu1611< SIZE, float >, and vu1611< SIZE, byte >.

Referenced by vuMarchingCubes::init(), vu111::read(), vu161::read(), vu171::read(), vu151::read(), vu1611< SIZE, TYPE >::read(), vu11::read(), vu16::read(), vu17::read(), vu15::read(), vu1112::read(), vu1512::read(), vu11122::read(), vu11121::read(), vu15121::read(), and vu1712< SIZE >::readHeader().

virtual void vu1::render void   )  [pure virtual]
 

Renders the volume to OpenGL, using the appropriate render method.

This is an abstract method that is implemented at the bottom of the volume tree according to the specific rendering algorithm defined. It can be called after the volume data has been read from a file. The method renders directly to the current OpenGL buffer, which then has to be swapped to be shown in a window.

Implemented in vu1512113, vu1512119, vu1512112, vu1512111, vu1512122, vu1512121, vu1712_1< SIZE >, vu1611_1< SIZE, TYPE >, vu1611_4< SIZE, TYPE >, vu1611_3< SIZE, TYPE >, vu1611_2< SIZE, TYPE >, vu11121, vu111211a, vu1112117, vu1112113, vu111211A, vu1112119, vu1112116, vu1112118, vu1112115, ns_vu1112112::vu1112112, vu1112111, vu11122, vu1112211, vu1611_1< SIZE, float >, vu1611_1< SIZE, byte >, vu1611_2< SIZE, float >, and vu1611_2< SIZE, byte >.

Referenced by vuBasicSubWindow::render().

void vu1::setCamera vuCamera mycamera  ) 
 

Set the camera (ms).

Reimplemented in vu1112119.

Definition at line 336 of file volume.cpp.

References m_Camera.

Referenced by Scanner::Scanner(), and vu1112119::setCamera().

bool vu1::setError const char *  Message,
byte  ErrorLevel = 1
[protected]
 

Sets the error flag in the class.

Parameters:
Message An error message for the user.
ErrorLevel The level of the error, with increasing severity.
Returns:
Always returns false for programming conveniance.

Definition at line 289 of file volume.cpp.

References m_Error, m_ErrorLevel, and m_ErrorMessage.

Referenced by vu1712_1< SIZE >::read(), vu1611< SIZE, TYPE >::read(), vu11122::read(), vu11121::read(), vu15121::read(), vu1712< SIZE >::readHeader(), setInvalidFormatError(), setWriteError(), vu1712_1< SIZE >::write(), vu1611< SIZE, TYPE >::write(), vu11122::write(), vu11121::write(), and vu15121::write().

void vu1::setFileName const char *  val  ) 
 

Sets the file name that the read and write methods access.

This method must be called before the read and write methods are called. It sets the data file that the instance is associated with. If the fileName is set a second time, the read method must be called before the new data is read in.

Definition at line 178 of file volume.cpp.

References m_FileName.

Referenced by vu1112119::convertVUD2VUF(), vu1112119::convertVUF2VUD(), vuSplat::init(), vuSpectral::init(), vuSpecSplat::init(), vuSpecFVR::init(), vuSlicer::init(), vuShearWarp::init(), vuRaycast::init(), vuMarchingCubes::init(), vuFVR::init(), vuCellProjector::init(), vuBccSplat::init(), vuBCCSheetSplatter::init(), vuBCCShearWarp::init(), vuBCCRaycaster::init(), vuBCCMarchingTetrahedra::init(), vuBCCFirstHitRaycaster::init(), main(), and Scanner::Scanner().

bool vu1::setInvalidFormatError  )  [protected]
 

A shortcut to setting an invalid data format error while reading.

Definition at line 303 of file volume.cpp.

References setError().

Referenced by read(), vu111::read(), vu161::read(), vu171::read(), vu151::read(), vu1611< SIZE, TYPE >::read(), vu11::read(), vu16::read(), vu17::read(), vu15::read(), vu1112::read(), vu1512::read(), vu11122::read(), vu11121::read(), vu15121::read(), and vu1712< SIZE >::readHeader().

Here is the call graph for this function:

void vu1::setIsReRendering bool  isit = true  )  [virtual]
 

Sets the return value of IsReRendering to be the same as the value of isit.

Reimplemented in vu1712_1< SIZE >.

Definition at line 322 of file volume.cpp.

References m_rerendering.

Referenced by vu1112117::getBuffer(), vuFVR::glOnMouse(), vuFVR::glRender(), vuBCCRaycaster::OnButtonRender(), vuBCCFirstHitRaycaster::OnButtonRender(), vuBasicUtility::OnChar(), vuFVR::OnCheckBoxDepthCueing(), vuFVR::OnCheckBoxDiffuseShading(), vuSphericIBR< SIZE, TYPE >::OnChoiceFilter(), vuStandardFVR< SIZE >::OnChoiceRenderMethod(), vuFVR::onKeyboard(), vuBasicUtility::onKeyboardRotate(), vuBasicUtility::onMouseLeftMoving(), vuBasicUtility::onMouseRightMoving(), vuBasicSubWindow::render(), vuSplat::setIsReRendering(), vuFVR::setIsReRendering(), and vuCellProjector::setIsReRendering().

void vu1::setRenderState dword  val  ) 
 

Sets the render state.

Currently undefined for the volume tree.

Definition at line 149 of file volume.cpp.

References m_RenderState.

virtual void vu1::setViewVectors const vuVector view,
const vuVector up,
const vuVector right
[pure virtual]
 

Sets the camera viewing position for the render method.

Parameters:
view The offset of the view from the origin.
up A vector specifying the up direction of the camera.
right A vector specifying the right direction of the camera.

Implemented in vu1512113, vu1512119, vu1512112, vu1512111, vu1512122, vu1512121, vu1712_1< SIZE >, vu1611< SIZE, TYPE >, vu11121, vu111211a, vu1112117, vu1112113, vu111211A, vu1112119, vu1112116, vu1112118, vu1112115, ns_vu1112112::vu1112112, vu1112111, vu11122, vu1611< SIZE, float >, and vu1611< SIZE, byte >.

bool vu1::setWriteError  )  [protected]
 

A shortcut to setting a writing to a file error.

Definition at line 312 of file volume.cpp.

References setError().

Referenced by write(), vu111::write(), vu161::write(), vu171::write(), vu151::write(), vu1611< SIZE, TYPE >::write(), vu11::write(), vu16::write(), vu17::write(), vu15::write(), vu1112::write(), vu1512::write(), vu11122::write(), vu11121::write(), vu15121::write(), and vu1712< SIZE >::writeHeader().

Here is the call graph for this function:

bool vu1::write FILE *  file  )  [protected, virtual]
 

Writes the general volume info to the file.

This is the same information as outlined for the read() method.

Reimplemented in vu15, vu15121, vu1512, vu151, vu17, vu171, vu16, vu1611< SIZE, TYPE >, vu161, vu11, vu11121, vu11122, vu1112, vu111, vu1611< SIZE, float >, and vu1611< SIZE, byte >.

Definition at line 260 of file volume.cpp.

References vuString::c_str(), vuString::isEmpty(), m_Header, and setWriteError().

Here is the call graph for this function:

virtual bool vu1::write void   )  [pure virtual]
 

Writes volume data to the data file set with setFileName().

Returns:
True if successful, false otherwise.

Implemented in vu15121, vu1712_1< SIZE >, vu1611< SIZE, TYPE >, vu11121, vu11122, vu1611< SIZE, float >, and vu1611< SIZE, byte >.

Referenced by vu111::write(), vu161::write(), vu171::write(), vu151::write(), vu1611< SIZE, TYPE >::write(), vu11::write(), vu16::write(), vu17::write(), vu15::write(), vu1112::write(), vu1512::write(), vu11122::write(), vu11121::write(), vu15121::write(), and vu1712< SIZE >::writeHeader().


Member Data Documentation

bool vu1::m_Binary [protected]
 

Whether the volume data file is in binary or ascii format.

Definition at line 207 of file volume.h.

Referenced by operator=(), read(), and vu1().

vuCamera* vu1::m_Camera [protected]
 

The Camera.

Definition at line 218 of file volume.h.

Referenced by ns_vu1112112::Parser::ReadTarga(), setCamera(), vu1(), and ~vu1().

byte* vu1::m_Data [protected]
 

The volume data.

Definition at line 195 of file volume.h.

Referenced by close(), vuConvert::convert(), vu11121::cropFrom(), operator=(), readFreZ(), readRAW(), vu1(), and ~vu1().

dword vu1::m_DataSize [protected]
 

The size of the volume data in bytes.

Definition at line 197 of file volume.h.

Referenced by close(), vuConvert::convert(), vuCellProjector::OnChar(), operator=(), readFreZ(), readRAW(), and vu1().

bool vu1::m_Error [protected]
 

True when an error with the volume data has occurred.

Definition at line 210 of file volume.h.

Referenced by close(), operator=(), setError(), and vu1().

byte vu1::m_ErrorLevel [protected]
 

The severity level of the error.

Definition at line 214 of file volume.h.

Referenced by close(), operator=(), setError(), and vu1().

vuString vu1::m_ErrorMessage [protected]
 

The error message associated with the error.

Definition at line 212 of file volume.h.

Referenced by close(), getErrorMessage(), operator=(), setError(), and vu1().

vuString vu1::m_FileName [protected]
 

The file name that the volume data is associated with.

Definition at line 203 of file volume.h.

Referenced by getFileName(), operator=(), setFileName(), and vu1().

vuString vu1::m_Header [protected]
 

The description header for the volume data.

Definition at line 205 of file volume.h.

Referenced by close(), getHeader(), operator=(), read(), vu1(), and write().

dword vu1::m_RenderState [protected]
 

The render state--currently not used.

Definition at line 200 of file volume.h.

Referenced by operator=(), setRenderState(), and vu1().

bool vu1::m_rerendering [protected]
 

Definition at line 216 of file volume.h.

Referenced by setIsReRendering(), and vu1().


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 21:21:03 2004 for vuVolume by  doxygen 1.3.9.1