Open Inventor Release 2024.1.1
 
Loading...
Searching...
No Matches
SoVolumeTransform Class Referenceabstract

VolumeViz Transform data before texture creation. More...

#include <VolumeViz/nodes/SoVolumeTransform.h>

+ Inheritance diagram for SoVolumeTransform:

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoVolumeTransform ()
 Constructor.
 
virtual void apply (SoState *state, const SoLDM::DataSetIdPair &p, SoBufferObject *bufferObject, const SoLDMTileID &id)=0
 Apply in-place transformation to the specified dataset tile.
 
virtual SbBool isValid (SoState *state, const SoLDM::DataSetIdPair &p, SoBufferObject *bufferObject, const SoLDMTileID &id)
 Should return TRUE if the given parameters are valid for this compute function.
 
virtual void getTransformedMinMax (double &min, double &max)
 Based on min max of the input data, this function should return the expected data range of the result (transformed) data.
 
SoBufferObjectgetFromCache (const SoLDMTileID &tileID)
 Returns the previously transformed data for a specific tile.
 
void addInCache (const SoLDMTileID &tileID, SoBufferObject *bufferObject)
 Add the transformed data for a specific tile to the cache.
 
- Public Member Functions inherited from SoNode
virtual void setOverride (const SbBool state)
 Turns the override flag on or off.
 
virtual SbBool isOverride () const
 Returns the state of the override flag.
 
virtual SoNodecopy (SbBool copyConnections=FALSE) const
 Creates and returns an exact copy of the node.
 
virtual SbBool affectsState () const
 Returns TRUE if a node has an effect on the state during traversal.
 
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
- Public Member Functions inherited from SoFieldContainer
void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoNode
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SoNodegetByName (const SbName &name)
 A node's name can be set using SoBase::setName().
 
static int getByName (const SbName &name, SoNodeList &list)
 A node's name can be set using SoBase::setName().
 
- Static Public Member Functions inherited from SoFieldContainer
static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Public Attributes

SoSFShort volumeTransformId
 Allows the transform to be applied to all or one specific data set.
 
SoSFInt32 cacheSize
 Size of the computed tile cache for this transform.
 

Detailed Description

VolumeViz Transform data before texture creation.

The SoVolumeTransform node allows an application to apply a defined computation on LDM data tiles just before they are sent to the GPU. There are several other ways to apply a computation to LDM tiles, that are applied at different stages of the pipeline. The SoLDMDataTransform class for example (see the dataTransform field of SoDataSet) applies a computation to each LDM tile requested from the volume reader before the tile is stored in system memory. This can be used to create multiple data sets from a single input (e.g. on disk) data set, but has the drawback that each resulting data set must be stored in system memory. SoVolumeTransform can be used to create multiple data sets from a single data set in system memory and does not require storing the created data sets in system memory (only on the GPU).

A cache mechanism, local to each instance of SoVolumeTransform, allows storing the computed tiles for later reuse. The size of this cache (number of tiles to cache) can be specified using the cacheSize field. We recommend setting the cacheSize to the number of tiles needed to display the biggest expected slice. As an example, for a dataset of size 128x512x1024 with a tile size equal to 128, the biggest slice size is 512x1024. So 4x8 = 32 LDM tiles are needed for rendering and therefore a cacheSize of 32 (tiles) is needed to avoid computing the same tile multiple times. The apply method can retrieve the transformed data for other tiles from the cache and can explicitly add the transformed data for other tiles to the cache.

SoVolumeTransform works on tiles (not slices or volumes). If a compute function needs data from other tiles, the application may use the SoLDMDataAccess API to get that data. (This is another difference from SoLDMDataTransform, which does not allow using the LDM data access API.)

Multiple SoVolumeTransform nodes may be applied to the same SoDataSet. The transforms are applied in the order of their appearance in the scene graph. SoVolumeTransform nodes may also be applied only to a specific SoDataSet using the volumeTransformId field. If this field is zero (the default), the transform is applied to all subsequent data set nodes. Else the transform is only applied to data sets whose dataSetId field contains the same value as the volumeTransformId.

SoVolumeTransform is based on the Open Inventor computing framework and uses the SoBufferObject classes to abstract and manage blocks of memory. The application can use different devices to implement the computation, and manage input tiles and output tiles stored on different devices.

As mentioned previously, SoVolumeTransform can be used to create multiple data sets on-the-fly from a single data set in system memory. In this case the same data set node will be instanced multiple times in the scene graph (although its data will only be loaded in system memory once), but we still need to assign each data texture a unique id so the shader program can access them uniquely. This is done using SoDataSetId nodes to specify a different data set id for each instance of the data set node. If an SoDataSetId node is in the traversal state when a data set node is traversed, the dataSetId field is ignored and the id from the SoDataSetId node is used.

To implement a computation, the application must derive a new class from SoVolumeTransform and (at least) implement the apply() method, which performs the actual computation. This method is called with parameters that give access to information about the data set and the specific tile being computed. In a simple case you might only need to access the buffer object.

It may also be useful to implement the isValid() and getTransformedMinMax() methods. The isValid() method will be called for each tile immediately before the apply() method. If this method returns FALSE, then the apply() method will not be called for that tile. If the application can compute or estimate the min and max values of the computed data set, then it should implement the getTransformedMinMax() method so VolumeViz does not do unnecessary work to compute these values.

FILE FORMAT/DEFAULT

    VolumeTransform {
    volumeTransformId 0
    cacheSize 1
    }

ACTION BEHAVIOR

SEE ALSO

SoDataSet, SoDataSetId, SoVolumeData

Definition at line 134 of file SoVolumeTransform.h.

Constructor & Destructor Documentation

◆ SoVolumeTransform()

SoVolumeTransform::SoVolumeTransform ( )

Constructor.

Member Function Documentation

◆ addInCache()

void SoVolumeTransform::addInCache ( const SoLDMTileID tileID,
SoBufferObject bufferObject 
)

Add the transformed data for a specific tile to the cache.


It is not necessary to call this method for the current tile, it will be added to the cache automatically. This method is useful if the apply method computes transformed data for other tiles. These tiles can be saved in the cache to avoid recomputing them later.

◆ apply()

virtual void SoVolumeTransform::apply ( SoState state,
const SoLDM::DataSetIdPair p,
SoBufferObject bufferObject,
const SoLDMTileID id 
)
pure virtual

Apply in-place transformation to the specified dataset tile.


The application must implement this method in the derived class.

Parameters
stateCurrent traversal state.
pDataset/id pair (p.first is an SoDataSet*, p.second is a dataSetId) Using the SoDataSet object you can obtain, for example, the actual data type of the data:
SoDataSet *pDataSet = p.first;
SoDataSet::dataType type = pDataSet->getDataType();
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Data set...
Definition SoDataSet.h:139
DataType getDataType() const
Returns the data type.
bufferObjectThe buffer that contains the data
idTile to be transformed Using this id and the SoDataSet object you can obtain, for example, the actual position of the tile in the volume:
SbBox3i32 tilePos =
pDataSet->getNodeFrontManager()->getTilePos( id );
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D box class.
Definition SbBox.h:96

◆ getClassTypeId()

static SoType SoVolumeTransform::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getFromCache()

SoBufferObject * SoVolumeTransform::getFromCache ( const SoLDMTileID tileID)

Returns the previously transformed data for a specific tile.


This method is useful if the apply method depends on transformed data for other tiles, for example adjacent tiles. If the needed tiles have already been transformed and saved in the cache, then it is not necessary to recompute them. Returns NULL if the tile was not found in the cache. See also the cacheSize field.

◆ getTransformedMinMax()

void SoVolumeTransform::getTransformedMinMax ( double &  min,
double &  max 
)
inlinevirtual

Based on min max of the input data, this function should return the expected data range of the result (transformed) data.

Definition at line 305 of file SoVolumeTransform.h.

◆ getTypeId()

virtual SoType SoVolumeTransform::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoNode.

◆ isValid()

virtual SbBool SoVolumeTransform::isValid ( SoState state,
const SoLDM::DataSetIdPair p,
SoBufferObject bufferObject,
const SoLDMTileID id 
)
virtual

Should return TRUE if the given parameters are valid for this compute function.


If not the apply function will not be called for this tile. The interpretation of "valid" is up to the application. For example, you could use this function to skip computing for low resolution tiles.

Parameters
stateCurrent traversal state.
pDataset/id pair (p.first is an SoDataSet*, p.second is a dataSetId)
bufferObjectThe buffer that contains the data
idTile to be transformed

Member Data Documentation

◆ cacheSize

SoSFInt32 SoVolumeTransform::cacheSize

Size of the computed tile cache for this transform.


This is the number of computed tiles that will be cached and will not need to be recomputed. Choose a value to balance between memory usage and computing time. Default is 1.

Definition at line 155 of file SoVolumeTransform.h.

◆ volumeTransformId

SoSFShort SoVolumeTransform::volumeTransformId

Allows the transform to be applied to all or one specific data set.


A volume transform id of 0 means that this transform will be applied to all subsequent data sets. A value greater than 0 means that this transform will only be applied to data sets with a matching data set id. For example, if the transform id is 1, the transform will only be applied to data sets whose data set id is also 1. The default value is 0.

Definition at line 147 of file SoVolumeTransform.h.


The documentation for this class was generated from the following file: