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

CTransferFunction Class Reference

#include <CTransferFunction.h>

List of all members.

Public Types

enum  { DESIGNED_FOR_GRADIENTLENGTH, DESIGNED_FOR_IGNORING_GRADIENTLENGTH }

Public Member Functions

 CTransferFunction (void)
virtual ~CTransferFunction (void)
void clear (void)
void updateHashTable (void)
void clearHashTable (void)
void fillHashTable (void)
void sortByID (void)
unsigned int getFreeID (void)
unsigned int getMaxID (void)
unsigned int getCount (void) const
bool isIDUsed (unsigned int uiID)
void swap (unsigned int uiID1, unsigned int uiID2)
bool add (const CTransferFunctionElem &oElem)
bool remove (unsigned int uiID)
const CTransferFunctionElemgetTransferFunction (const unsigned char uc, const float fLength)
bool isClassified (unsigned char uc, float fLength)
const CTransferFunctionElemgetTransferFunction (const unsigned char uc)
const CTransferFunctionElemgetTransferFunctionID (unsigned int uiID)
CTransferFunctionElemgetTransferFunctionIDReference (unsigned int uiID)
const CTransferFunctionElemgetTransferFunctionIndex (unsigned int uiIndex)
void loadFromFile (const std::string &sFileName)
void appendFromFile (const std::string &sFileName)
void saveToFile (const std::string &sFileName)
int getDesign (void)
void setDesign (const int iDesign)
sigc::signal< void > signal_changed ()

Public Attributes

CTransferFunctionElem m_TFDefault
enum CTransferFunction:: { ... }  ENUM_DESIGNS

Protected Member Functions

void on_element_changed (unsigned int uiId)

Protected Attributes

int m_iDesignedFor
std::vector< CTransferFunctionElemm_LTFElements
std::vector< unsigned int > * m_pLDensHash
sigc::signal< void > m_signalChanged


Detailed Description

Class implements the transfer function used for associating color, lighting properties and absorptivity to voxel properties.

Todo:
: autosegmentation, i.e. create a TF automatically for a given voxelfield
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 22 of file CTransferFunction.h.


Member Enumeration Documentation

anonymous enum
 

some rendering algorithms cannot really handle transfer functions which are also depending on the gradient length, therefore we might wanna store information if this transfer function was designed for taking care of gradient lengths

Definition at line 278 of file CTransferFunction.h.


Constructor & Destructor Documentation

CTransferFunction::CTransferFunction void   ) 
 

This constructor initializes the class and by setting up a density based hash table

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 6 of file CTransferFunction.cpp.

References m_iDesignedFor, and m_pLDensHash.

CTransferFunction::~CTransferFunction void   )  [virtual]
 

cleans up the memory used by the hashtable

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 15 of file CTransferFunction.cpp.

References m_pLDensHash.


Member Function Documentation

bool CTransferFunction::add const CTransferFunctionElem oElem  ) 
 

adds a transfer function element and changes the hashtable accordingly

Parameters:
oElem element to be added
Returns:
true if sucessful, otherwise false
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 109 of file CTransferFunction.cpp.

References CTransferFunctionElem::getID(), isIDUsed(), m_LTFElements, m_signalChanged, on_element_changed(), CTransferFunctionElem::signal_changed(), and sortByID().

Referenced by CFileReaderTFVVis::load(), and CWindowTransferFunctionEditor::updateTransferFunction().

void CTransferFunction::appendFromFile const std::string &  sFileName  ) 
 

same as loadFromFile() but it appends the elements of the file to already existing ones.

Parameters:
sFileName filename
Author:
Tobias Eberle <tobias.eberle@gmx.de>

Definition at line 313 of file CTransferFunction.cpp.

References CFileReaderTFVVis::append().

void CTransferFunction::clear void   ) 
 

resets this class, i.e. cleans all list, the hashtable

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 20 of file CTransferFunction.cpp.

References clearHashTable(), m_LTFElements, and m_signalChanged.

Referenced by CFileReaderTFVVis::load(), and CWindowTransferFunctionEditor::updateTransferFunction().

void CTransferFunction::clearHashTable void   ) 
 

clears the hash table, all elements in the element list remain untouched

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 31 of file CTransferFunction.cpp.

References m_pLDensHash.

Referenced by clear(), and updateHashTable().

void CTransferFunction::fillHashTable void   ) 
 

adds all elements from the list of TransferFunctionElements to the Hashtable in the order they are stored in m_LTFElements note that fillHashTable doesnt clear the hash table before adding the entries, you have to do this manually by calling clearHashTable before, if wanted

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 41 of file CTransferFunction.cpp.

References m_LTFElements, and m_pLDensHash.

Referenced by updateHashTable().

unsigned int CTransferFunction::getCount void   )  const [inline]
 

Returns:
number of CTransferFunctionElem
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 103 of file CTransferFunction.h.

References m_LTFElements.

Referenced by CInt1VRenderer::calculate(), CHistogramDensityGradientGL::draw(), CWindowTransferFunctionEditor::on_ButtonOpen_clicked(), CWidgetHistogramDensityGradient::on_expose_event(), CWidgetRenderer::prepare(), CTexture1VRenderer::prepare(), CShearWarp2VRenderer::prepare(), CPreIntTextureVRenderer::prepare(), CCubeVRenderer::prepare(), and CFileWriterTFVVis::save().

int CTransferFunction::getDesign void   )  [inline]
 

returns the type of design

Returns:
type of design
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 262 of file CTransferFunction.h.

References m_iDesignedFor.

Referenced by CTexture1VRenderer::prepare(), CPreIntTextureVRenderer::prepare(), and CFileWriterTFVVis::save().

unsigned int CTransferFunction::getFreeID void   ) 
 

Returns:
an ID which is not yet used by an CTransferFunctionElem instance stored in this transfer function.
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 75 of file CTransferFunction.cpp.

References isIDUsed(), and m_LTFElements.

Referenced by CFileReaderTFVVis::load(), and CWindowTransferFunctionEditor::on_Histogram_created().

unsigned int CTransferFunction::getMaxID void   ) 
 

Returns:
highest used ID being in use in this transfer function
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 168 of file CTransferFunction.cpp.

References m_LTFElements.

const CTransferFunctionElem & CTransferFunction::getTransferFunction const unsigned char  uc  ) 
 

returns a valid transfer function element for a given density using the hashtable for speedup. If no suitable element can be found the default element is returned, otherwise the element with the lowest ID.

Parameters:
uc voxel value
Returns:
a const reference to a CTransferFunctionElem
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 224 of file CTransferFunction.cpp.

References m_LTFElements, m_pLDensHash, and m_TFDefault.

const CTransferFunctionElem & CTransferFunction::getTransferFunction const unsigned char  uc,
const float  fLength
 

returns a valid transfer function element for a given configuration using the hashtable for speedup. If no suitable element can be found the default element is returned.

Parameters:
uc voxel value
fLength length of gradient
Returns:
a const reference to a CTransferFunctionElem
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 188 of file CTransferFunction.cpp.

References m_LTFElements, m_pLDensHash, and m_TFDefault.

Referenced by CShearWarp2VRenderer::calculate(), CBaseVRenderer::getAbsorption(), CBaseVRenderer::getEmission(), CPreIntegrator::integrate(), CInt1VRenderer::integrateAlong(), and CCubeVRenderer::prepare().

const CTransferFunctionElem * CTransferFunction::getTransferFunctionID unsigned int  uiID  ) 
 

returns a pointer to a transfer function element for a given ID. if this ID doesn't exist, NULL is returned.

Parameters:
uiID ID
Returns:
this is zero if no element with this ID was found
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 236 of file CTransferFunction.cpp.

References m_LTFElements.

Referenced by CHistogramDensityGradientGL::draw().

CTransferFunctionElem & CTransferFunction::getTransferFunctionIDReference unsigned int  uiID  ) 
 

returns a reference to a transfer function element for a given ID.

Parameters:
uiID ID
Returns:
reference to a transfer function element for a given ID
Author:
Tobias Eberle <tobias.eberle@gmx.de>

Definition at line 254 of file CTransferFunction.cpp.

References m_LTFElements, and m_TFDefault.

Referenced by swap().

const CTransferFunctionElem * CTransferFunction::getTransferFunctionIndex unsigned int  uiIndex  ) 
 

returns a pointer to a transfer function element for a given index. if this index doesn't exist, NULL is returned.

Parameters:
uiIndex Index
Returns:
this is zero if no element with this index was found
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 272 of file CTransferFunction.cpp.

References m_LTFElements.

Referenced by CWindowTransferFunctionEditor::on_ButtonOpen_clicked(), CWidgetHistogramDensityGradient::on_expose_event(), CWidgetHistogramDensity::on_expose_event(), CCubeVRenderer::prepare(), and CFileWriterTFVVis::save().

bool CTransferFunction::isClassified unsigned char  uc,
float  fLength
 

returns true for a configuration where a transferfunction element exists.

Parameters:
uc voxel value
fLength length of gradient
Returns:
a boolean value indicating the existance of a suitable element
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 206 of file CTransferFunction.cpp.

References m_LTFElements, and m_pLDensHash.

Referenced by CClassifiedVoxelFieldRLEPosition::encode().

bool CTransferFunction::isIDUsed unsigned int  uiID  ) 
 

checks if an ID is already in use in this transfer function

Parameters:
uiID ID
Returns:
true if in use, false otherwise
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 95 of file CTransferFunction.cpp.

References m_LTFElements.

Referenced by add(), and getFreeID().

void CTransferFunction::loadFromFile const std::string &  sFileName  ) 
 

loads transfer function elements from a file. This function clears all already existing elements.

Parameters:
sFileName filename
Author:
Tobias Eberle <tobias.eberle@gmx.de>

Definition at line 307 of file CTransferFunction.cpp.

References CFileReaderTFVVis::load().

Referenced by CWindowTransferFunctionEditor::on_ButtonOpen_clicked().

void CTransferFunction::on_element_changed unsigned int  uiId  )  [protected]
 

signal handler for transfer function element signal changed.

Author:
Tobias Eberle <tobias.eberle@gmx.de>

Definition at line 331 of file CTransferFunction.cpp.

References m_signalChanged, and updateHashTable().

Referenced by add().

bool CTransferFunction::remove unsigned int  uiID  ) 
 

removes a transfer function element by a given ID. updates the hashtable accordingly

Parameters:
uiID ID to be removed
Returns:
true if successful, otherwise false
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 133 of file CTransferFunction.cpp.

References m_LTFElements, m_pLDensHash, and m_signalChanged.

void CTransferFunction::saveToFile const std::string &  sFileName  ) 
 

Saves elements to a file.

Parameters:
sFileName filename
Author:
Tobias Eberle <tobias.eberle@gmx.de>

Definition at line 319 of file CTransferFunction.cpp.

References CFileWriterTFVVis::save().

Referenced by CWindowTransferFunctionEditor::on_ButtonSave_clicked().

void CTransferFunction::setDesign const int  iDesign  )  [inline]
 

Sets the type of design

Parameters:
iDesign design
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 271 of file CTransferFunction.h.

References m_iDesignedFor.

Referenced by CFileReaderTFVVis::load().

void CTransferFunction::sortByID void   ) 
 

Whenever there were changes to the IDs, you need to resort the transfer function hash buckets before the next use of this transfer function. To do so, call this function.

additionally the hashtable is cleared and then filled again

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 67 of file CTransferFunction.cpp.

References m_LTFElements, and updateHashTable().

Referenced by add(), and swap().

void CTransferFunction::swap unsigned int  uiID1,
unsigned int  uiID2
 

swaps the data of two elements defined by their IDs after doing so the hashtable is updated

Parameters:
uiID1 ID1
uiID2 ID2
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 292 of file CTransferFunction.cpp.

References getTransferFunctionIDReference(), m_signalChanged, CTransferFunctionElem::setID(), and sortByID().

void CTransferFunction::updateHashTable void   ) 
 

updates the hash table

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 60 of file CTransferFunction.cpp.

References clearHashTable(), and fillHashTable().

Referenced by on_element_changed(), and sortByID().


Member Data Documentation

enum { ... } CTransferFunction::ENUM_DESIGNS
 

some rendering algorithms cannot really handle transfer functions which are also depending on the gradient length, therefore we might wanna store information if this transfer function was designed for taking care of gradient lengths

int CTransferFunction::m_iDesignedFor [protected]
 

Here we store the type of TF this data was designed for

Definition at line 291 of file CTransferFunction.h.

Referenced by CTransferFunction(), getDesign(), and setDesign().

std::vector<CTransferFunctionElem> CTransferFunction::m_LTFElements [protected]
 

list of transfer function elements used in this transfer function

Definition at line 296 of file CTransferFunction.h.

Referenced by add(), clear(), fillHashTable(), getCount(), getFreeID(), getMaxID(), getTransferFunction(), getTransferFunctionID(), getTransferFunctionIDReference(), getTransferFunctionIndex(), isClassified(), isIDUsed(), remove(), and sortByID().

std::vector<unsigned int>* CTransferFunction::m_pLDensHash [protected]
 

hashtable for fast lookup of density values

Definition at line 301 of file CTransferFunction.h.

Referenced by clearHashTable(), CTransferFunction(), fillHashTable(), getTransferFunction(), isClassified(), remove(), and ~CTransferFunction().

sigc::signal<void> CTransferFunction::m_signalChanged [protected]
 

signal emitted if transfer function elements changed

Definition at line 307 of file CTransferFunction.h.

Referenced by add(), clear(), on_element_changed(), remove(), signal_changed(), and swap().

CTransferFunctionElem CTransferFunction::m_TFDefault
 

the default transfer function ... if nothing else fits

Definition at line 224 of file CTransferFunction.h.

Referenced by getTransferFunction(), and getTransferFunctionIDReference().


The documentation for this class was generated from the following files:
Generated on Sat Sep 24 15:47:02 2005 for vvis by  doxygen 1.4.3-20050530