Data set node. More...
#include <LDM/nodes/SoDataSet.h>
Classes | |
struct | DatumElement |
A datum is a series of m*n data type. | |
struct | MTstruct |
thread specific variables | |
Public Types | |
enum | DataType { UNSIGNED_BYTE = SbDataType::UNSIGNED_BYTE, UNSIGNED_SHORT = SbDataType::UNSIGNED_SHORT, UNSIGNED_INT32 = SbDataType::UNSIGNED_INT32, SIGNED_BYTE = SbDataType::SIGNED_BYTE, SIGNED_SHORT = SbDataType::SIGNED_SHORT, SIGNED_INT32 = SbDataType::SIGNED_INT32, FLOAT = SbDataType::FLOAT } |
typedef SbBool | SaveEditingCB (SoDataSet *dataSet, SoVolumeWriter *writer, int tilesRemaining, int totalTiles) |
Public Member Functions | |
virtual SoType | getTypeId () const |
const SbVec3i32 & | getDimension () |
SbVec3i32 | getTileDimension () |
unsigned int | getDatumSize () |
virtual size_t | readTile (SoBufferObject *&bufferObject, SoLDMTileID tileID, bool transform) |
virtual void | readTile (SoLDMTileID tileID, SoBufferObject *buffer, bool transform) |
virtual void | writeTile (SoLDMTileID tileID, SoBufferObject *buffer, SoVolumeWriter *writer) |
SoLDMDataAccess & | getLdmDataAccess () |
virtual SbBool | startEditing (int &transactionId) |
virtual SbBool | finishEditing (int transactionId) |
virtual int | editTile (const SoLDMTileID &tileId, SoBufferObject *userData) |
virtual int | editSubVolume (const SbBox3i32 &subVolume, SoBufferObject *userData) |
virtual int | editTile (const SoLDMTileID &tileId, const double &value) |
virtual int | editSubVolume (const SbBox3i32 &subVolume, const double &value) |
virtual int | editSurfaceShape (const SoNode *surfaceShape, const float &thickness, const double &value) |
virtual int | editSolidShape (const SoNode *solidShape, const double &value) |
virtual int | editBoxes (const std::vector< SbVec3i32 > &boxCenters, const int &boxSize, const double &newValue) |
virtual SbBool | undoEditing (int transactionId) |
virtual SbBool | redoEditing (int transactionId) |
virtual SbBool | saveEditing (bool recomputeLowerResolution=TRUE, const std::vector< char * > conversionParameters=std::vector< char * >(), SaveEditingCB *callback=NULL) |
virtual bool | hasEditedTile () |
SoLDMTileManager * | getTileManager () |
SoLDMTextureManager * | getTextureManager () |
SoLDMNodeFrontManager * | getNodeFrontManager () |
SoLDMReader * | getLDMReader () |
void | setLDMReader (SoLDMReader *reader) |
SoVolumeReader * | getReader () |
SoVolumeReader * | getReader () const |
int | numSigBits () const |
virtual SbBool | getMinMax (int64_t &min, int64_t &max) |
virtual SbBool | getMinMax (double &min, double &max) |
DataType | getDataType () |
int | getDataSize () |
void | setReader (SoVolumeReader &reader, SbBool takeOwnership=FALSE) |
SoLDMMediator::LDMManagerAccess & | getLdmManagerAccess () |
void | resetReader () |
Static Public Member Functions | |
static SoType | getClassTypeId () |
static int | dataSize (DataType dataType) |
static SbBool | isDataSigned (DataType dataType) |
static SbBool | isDataFloat (DataType dataType) |
static int | getMaxNumDataSets () |
Public Attributes | |
SoSFInt32 | dataSetId |
SoSFFilePathString | fileName |
SoSFBool | useCompressedTexture |
SoSFUShort | texturePrecision |
SoSFBox3f | extent |
SoSFLDMDataTransform | dataTransform |
SoSFBool | allocateResourceOnRender |
SoSFLDMResourceParameters | ldmResourceParameters |
Friends | |
class | SoLdmValuationAction |
Deprecated | |
| |
typedef void | SoLDMDataTransformFunction (SoDataSet *ds, const SbVec3i32 &bufferDimension, void *bufferToTransform, const SbBox3i32 &dataBox, int resolutionLevel, void *userData) |
SoDEPRECATED SoLDMTileVisitor * | getTileVisitor () |
SoDEPRECATED void | setTileVisitor (SoLDMTileVisitor *tileVisitor) |
SoDEPRECATED SoLDMGeometry * | getVVizGeometry () |
SoDEPRECATED SoLDMResourceParameters & | getLdmResourceParameter () |
virtual SoDEPRECATED void | readTile (SoLDMTileID tileID, unsigned char *buffer, bool transform) |
SoDEPRECATED void | setLDMDataTransformFunction (SoLDMDataTransformFunction *func, void *userData=NULL) |
SoDEPRECATED SbBool | isTimeDependent () |
SoDEPRECATED int | getNumTimeSteps () |
SoDEPRECATED int | getOverlapping () |
SoDEPRECATED void | setLDM (SbBool state) |
This class specifies the data set and its properties, and also provides utilities for extracting a subset of the data set and for resampling the data set. The data can be read from directly from a file or can be accessed via a user-defined volume reader. This class is the parent class of the VolumeViz data nodes SoVolumeData and SoMeshGeometry. These nodes provide the data for VolumeViz nodes (SoVolumeRender, SoOrthoSlice, SoObliqueSlice, etc.).
The data set can be specified by:
SoDataSetId, SoDataCompositor, SoVolumeData, SoMeshGeometry, SoMeshProperty
DataTransform, EditingExtrusion, EditingFeature, EditingPicking
typedef SbBool SoDataSet::SaveEditingCB(SoDataSet *dataSet, SoVolumeWriter *writer, int tilesRemaining, int totalTiles) |
This is the declaration to use for saveEditing callback functions.
These callbacks are called just before a tile is written. At the beginning of the saving process, the SaveEditingCB is called with tilesRemaining = totalTiles . Once the save process is done (all tiles written and finalized), the SaveEditingCB is called with tilesRemaining = 0.
dataSet | DataSet used. | |
writer | Writer used. | |
tilesRemaining | Remaining tiles to save | |
totalTiles | Total tiles to save. |
typedef void SoDataSet::SoLDMDataTransformFunction(SoDataSet *ds, const SbVec3i32 &bufferDimension,void *bufferToTransform, const SbBox3i32 &dataBox,int resolutionLevel,void *userData) |
enum SoDataSet::DataType |
static int SoDataSet::dataSize | ( | DataType | dataType | ) | [static] |
Returns the number of bytes per voxel of the specified data type.
virtual int SoDataSet::editBoxes | ( | const std::vector< SbVec3i32 > & | boxCenters, | |
const int & | boxSize, | |||
const double & | newValue | |||
) | [virtual] |
Replace all voxels in the region defined by a list of boxes with the specified value.
boxCenter and boxSize are defined in ijk (voxel) space.
Call startEditing() before calling this method. Returns 0 if successful.
Reimplemented in SoVolumeData.
virtual int SoDataSet::editSolidShape | ( | const SoNode * | solidShape, | |
const double & | value | |||
) | [virtual] |
Replace all voxels intersecting the given shape with the specified value.
The geometry defined under solidShape must represent a list of closed surfaces otherwise the result is unpredictable. solidShape must not contain any lines or open polyhedrons (polyhedron with shapes). The result is based on the odd-winding rule, so the result is not necessarily the union or the intersection of the closed surfaces. If you want to voxelize lines or single polygons, see also the editSurfaceShape method.
If the goal is to define a shape which is the results of the intersection/union of multiple closed surfaces, see the SoCSGShape node.
solidShape is defined in the same 3D space as the dataSet. The solidShape can be deleted after calling this function.
Call startEditing() before calling this method. Returns 0 if successful.
Reimplemented in SoVolumeData, and SoVolumeMask.
virtual int SoDataSet::editSubVolume | ( | const SbBox3i32 & | subVolume, | |
const double & | value | |||
) | [virtual] |
Replace the contents of a subvolume with the specified value.
The subvolume is specified in voxel/cell coordinates. Call startEditing() before calling this method. Returns 0 if successful.
Reimplemented in SoVolumeData, and SoVolumeMask.
virtual int SoDataSet::editSubVolume | ( | const SbBox3i32 & | subVolume, | |
SoBufferObject * | userData | |||
) | [virtual] |
Replace the contents of a subvolume with the given data.
The buffer size (in bytes) must match the subvolume size (in bytes) exactly. The subvolume is specified in voxel/cell coordinates. Call startEditing() before calling this method. Returns 0 if successful.
Reimplemented in SoVolumeData, and SoVolumeMask.
virtual int SoDataSet::editSurfaceShape | ( | const SoNode * | surfaceShape, | |
const float & | thickness, | |||
const double & | value | |||
) | [virtual] |
Replace all voxels intersecting the polygons or lines defined by the surfaceShape and given thickness with the specified value.
surfaceShape is defined in the same 3D space as the dataSet. thickness is defined in voxels. The surfaceShape can be deleted after calling this function.
Call startEditing() before calling this method. Returns 0 if successful.
Reimplemented in SoVolumeData, and SoVolumeMask.
virtual int SoDataSet::editTile | ( | const SoLDMTileID & | tileId, | |
const double & | value | |||
) | [virtual] |
Replace the contents of a tile with the specified value.
Call startEditing() before calling this method. Returns 0 if successful.
Reimplemented in SoVolumeData.
virtual int SoDataSet::editTile | ( | const SoLDMTileID & | tileId, | |
SoBufferObject * | userData | |||
) | [virtual] |
Replace the contents of a tile with the given data.
The buffer size (in bytes) must match the tile size (in bytes) exactly. Call startEditing() before calling this method. Returns 0 if successful.
Reimplemented in SoVolumeData.
virtual SbBool SoDataSet::finishEditing | ( | int | transactionId | ) | [virtual] |
Terminate an editing transaction.
Returns true if successful. May only be called with a valid transaction id returned by the startEditing() method. On error does nothing. The finish method will schedule a redraw so the correct data is displayed. To commit the edits, in other words to save the edited data back to the data source, call saveEditing().
Reimplemented in SoVolumeData.
static SoType SoDataSet::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoNode.
Reimplemented in SoHeightFieldGeometry, SoHeightFieldProperty, SoHeightFieldPropertyMask, SoVolumeData, and SoVolumeMask.
int SoDataSet::getDataSize | ( | ) |
Returns the number of bytes per voxel in VolumeViz.
DataType SoDataSet::getDataType | ( | ) |
Returns the data type.
unsigned int SoDataSet::getDatumSize | ( | ) |
Returns the number of bytes per voxel.
const SbVec3i32& SoDataSet::getDimension | ( | ) |
Returns the data set dimension.
Reimplemented in SoVolumeData.
SoLDMDataAccess& SoDataSet::getLdmDataAccess | ( | ) |
Returns a reference to the SoLDMDataAccess object.
This object can be used to query data from the volume.
SoLDMMediator::LDMManagerAccess& SoDataSet::getLdmManagerAccess | ( | ) | [inline] |
Returns a reference to an LDMManagerAccess.
SoLDMReader* SoDataSet::getLDMReader | ( | ) |
Returns a pointer to the current data set reader object.
The actual type will be a subclass of SoVolumeReader, either one of the predefined subclasses or an application-defined subclass. Returns NULL if no reader is currently being used (for example if setVolumeData() was called).
SoDEPRECATED SoLDMResourceParameters& SoDataSet::getLdmResourceParameter | ( | ) |
Returns a reference to the LDMResourceParameter.
The returned value can't be copied.
static int SoDataSet::getMaxNumDataSets | ( | ) | [static] |
Returns the maximum number of data sets that can be render composited on the current hardware (essentially the number of texture units - 1).
virtual SbBool SoDataSet::getMinMax | ( | double & | min, | |
double & | max | |||
) | [virtual] |
Returns min and max values of the data set.
Returns FALSE if the requested data is not available (for example, if no data set exists).
NOTE: This method might force LDM to load the entire data set if the volume reader does not respond to the getMinMax query. Normally for an LDM format data set, the min and max values are stored in the LDM header. For a non-LDM data set, if a filename and/or reader have been specified and the data set has not yet been loaded, LDM will load the entire data set to compute the min and max values. For a large data set this may take a long time.
Reimplemented in SoVolumeData.
virtual SbBool SoDataSet::getMinMax | ( | int64_t & | min, | |
int64_t & | max | |||
) | [virtual] |
Returns min and max values of the data set data.
Returns FALSE if the requested data is not available (for example, if no data set exists).
NOTE: This method might force LDM to load the entire data set if the volume reader does not respond to the getMinMax query. Normally for an LDM format data set, the min and max values are stored in the LDM header. For a non-LDM data set, if a filename and/or reader have been specified and the data set has not yet been loaded, LDM will load the entire data set to compute the min and max values. For a large data set this may take a long time.
Reimplemented in SoVolumeData.
SoLDMNodeFrontManager* SoDataSet::getNodeFrontManager | ( | ) | [inline] |
Returns a pointer to the LDM node front manager.
SoDEPRECATED int SoDataSet::getNumTimeSteps | ( | ) | [inline] |
Returns the number of time steps.
SoDEPRECATED int SoDataSet::getOverlapping | ( | ) |
Returns the tile border (overlap) in voxels.
Since OIV 9.0 always returns 0.
SoVolumeReader* SoDataSet::getReader | ( | ) | const [inline] |
Returns the current data set reader object.
The actual type will be a subclass of SoVolumeReader, either one of the predefined subclasses or an application-defined subclass. Returns null if no reader is currently set. Applications should always verify the class type before using the returned object as a specific sub-class of SoVolumeReader.
SoVolumeReader* SoDataSet::getReader | ( | ) | [inline] |
Returns the current data set reader object.
The actual type will be a subclass of SoVolumeReader, either one of the predefined subclasses or an application-defined subclass. Returns null if no reader is currently set. Applications should always verify the class type before using the returned object as a specific sub-class of SoVolumeReader.
SoLDMTextureManager* SoDataSet::getTextureManager | ( | ) | [inline] |
Returns a pointer to the LDM texture manager.
SbVec3i32 SoDataSet::getTileDimension | ( | ) |
Returns the tile dimension.
SoLDMTileManager* SoDataSet::getTileManager | ( | ) | [inline] |
Returns a pointer to the LDM tile manager.
SoDEPRECATED SoLDMTileVisitor* SoDataSet::getTileVisitor | ( | ) |
Returns the current LDM tile visitor.
virtual SoType SoDataSet::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Reimplemented from SoNode.
Reimplemented in SoHeightFieldGeometry, SoHeightFieldProperty, SoHeightFieldPropertyMask, SoVolumeData, and SoVolumeMask.
SoDEPRECATED SoLDMGeometry* SoDataSet::getVVizGeometry | ( | ) |
Returns a pointer to the LDM geometry object.
virtual bool SoDataSet::hasEditedTile | ( | ) | [virtual] |
Returns true if DataSet has edited tiles.
Returns TRUE if the given data type is a float data type.
Returns TRUE if the given data type is a signed integer data type.
SoDEPRECATED SbBool SoDataSet::isTimeDependent | ( | ) | [inline] |
Indicates if this data set is time dependent.
int SoDataSet::numSigBits | ( | ) | const |
Returns the number of significant bits.
virtual SoDEPRECATED void SoDataSet::readTile | ( | SoLDMTileID | tileID, | |
unsigned char * | buffer, | |||
bool | transform | |||
) | [virtual] |
virtual void SoDataSet::readTile | ( | SoLDMTileID | tileID, | |
SoBufferObject * | buffer, | |||
bool | transform | |||
) | [virtual] |
Copies the specified tile into the provided buffer.
Applies the data transformation (set in dataTransform field) if transform is true.
virtual size_t SoDataSet::readTile | ( | SoBufferObject *& | bufferObject, | |
SoLDMTileID | tileID, | |||
bool | transform | |||
) | [virtual] |
Copies the specified tile into the provided buffer.
Applies the data transformation (set in dataTransform field) if transform is true. Returns the size, in bytes, copied in the buffer. If size == 0 nothing was written (probably due to a memory allocation error).
virtual SbBool SoDataSet::redoEditing | ( | int | transactionId | ) | [virtual] |
Redo all modifications associated with the specified transaction id.
Returns true if successful. On error does nothing. May only be called after the specified transaction has been terminated (see finishEditing() method) and undone (see undoEditing() method). Schedules a redraw so the correct data is displayed.
Note: Redo is no longer available after transactions are saved. After calling saveEditing(), the transaction ids are no longer valid and the modified data is the new reference.
Reimplemented in SoVolumeData.
void SoDataSet::resetReader | ( | ) |
reset previously set custom reader setup by setReader call.
Reference counting:
virtual SbBool SoDataSet::saveEditing | ( | bool | recomputeLowerResolution = TRUE , |
|
const std::vector< char * > | conversionParameters = std::vector< char * >() , |
|||
SaveEditingCB * | callback = NULL | |||
) | [virtual] |
Commit all transactions.
All modified tiles are written back to the data source using the current reader format. May only be called when no threads are editing, i.e. after all threads that called startEditing have called finishEditing.
Returns true if successful. On error does nothing returns false. Returns false if:
Warning: Effectively, saveEditing currently only works for data loaded using an SoVRLDMFileReader (an LDM format tiled data set) or an SoVRMemoryReader (data set completely in memory).
You can specify a callback (see SaveEditingCB) that will be called before saving each tile (even if the data uses a sliced format it is saved tile by tile). If this callback returns FALSE, the saving process is aborted. Warning: In such a case, lower resolutions are not updated and the result will be undefined.
Conversion Parameters:
Reimplemented in SoVolumeData.
SoDEPRECATED void SoDataSet::setLDM | ( | SbBool | state | ) |
Enable or disable LDM mode.
SoDEPRECATED void SoDataSet::setLDMDataTransformFunction | ( | SoLDMDataTransformFunction * | func, | |
void * | userData = NULL | |||
) |
If set, the user-defined function is called after each tile is loaded, but before it is stored in main memory.
This allows you to modify the original data (for example, scaling or filtering) before it is displayed.
void SoDataSet::setLDMReader | ( | SoLDMReader * | reader | ) |
Sets the LDM volume reader object to use.
This method allows the data to be read directly from the disk using the specified subclass of SoVolumeReader.
void SoDataSet::setReader | ( | SoVolumeReader & | reader, | |
SbBool | takeOwnership = FALSE | |||
) |
This method allows the data to be read directly from the disk using the specified subclass of SoVolumeReader.
If the takeOwnership parameter is FALSE (default), LDM will not delete the specified instance. Otherwise, LDM will automatically delete the specified instance, for example, when the SoDataSet node is deleted. If filename is not set before setting the reader, LDM will display an error message just to warn reader did not open any file yet. LDM still work has expected.
Note: When using a custom reader, any reader method that changes the volume properties (dimension, size, data type, etc) should notify the SoVolumeData node by calling the reader's touch() method. If this notification is not done, SoDataSet fields, for example SoDataSet::extent, won't be updated correctly.
SoDEPRECATED void SoDataSet::setTileVisitor | ( | SoLDMTileVisitor * | tileVisitor | ) |
Sets a custom LDM tile visitor.
virtual SbBool SoDataSet::startEditing | ( | int & | transactionId | ) | [virtual] |
Initiate an editing transaction.
Returns true if successful and also returns a unique transaction id. This value is required for finishing the edit transaction (see finishEditing()) and for undo/redo (see undoEditing() and redoEditing()). Multiple transactions may be active at the same time.
Reimplemented in SoVolumeData.
virtual SbBool SoDataSet::undoEditing | ( | int | transactionId | ) | [virtual] |
Undo all modifications associated with the specified transaction id.
Returns true if successful. On error does nothing. May only be called after the specified transaction has been terminated (see finishEditing() method). Schedules a redraw so the correct data is displayed.
Note: Undo is no longer available after transactions are saved. After calling saveEditing(), the transaction ids are no longer valid and the modified data is the new reference.
Reimplemented in SoVolumeData.
virtual void SoDataSet::writeTile | ( | SoLDMTileID | tileID, | |
SoBufferObject * | buffer, | |||
SoVolumeWriter * | writer | |||
) | [virtual] |
Write the specified tile using the specified writer.
No operations are done on buffer (dataTransform or edition), the buffer is written as is. The writer must be initialized and handles must be properly set (see SoVolumeReader::closeAllHandles and SoVolumeWriter::restoreAllHandles), ie. the current reader's handles must be closed, and the specified writer's handles must be opened.
friend class SoLdmValuationAction [friend] |
Indicates if resource allocation is done only on first render traversal or as soon as the node is created.
Default is TRUE. It must be set to FALSE if the dataset is not inserted in a scene graph but will be used for data access for example. Otherwise, memory resources will still remain on default value.
When using multiple SoDataSet nodes, the dataSetId field uniquely identifies each data set used in the compositing.
It also specifies the OpenGL texture unit in which the textures for this data set will be stored when doing render compositing. It is 1 by default (texture unit 0 is reserved for the color lookup table by default). The number of available texture units depends on your hardware. You can query this number using getMaxNumDataSets.
Note: The SoDataSetId node can also be used to define dataSetId. If an SoDataSetId node is traversed before the SoDataSet node, the id from the SoDataSetId node is used and this field is ignored.
NOTE: field available since Open Inventor 6.0If set to an appropriate SoLDMDataTransform object, the object's transformFunction method is called after each tile is loaded, but before it is stored in main memory.
This allows you to modify the original data (for example, scaling or filtering) before it is displayed. Default is no transform.
Note: Before Open Inventor 8.0, the data transformFunction was set
using the setLDMDataTransformFunction method. That method is now deprecated.
NOTE: field available since Open Inventor 8.0The real size (extent) of the volume in modeling coordinates.
Default is -1,-1,-1 to 1,1,1.
Note this can be used to define a volume with non-uniform voxel spacing. For example, if the volume dimensions (voxels) are 64x64x64, but the voxel spacing in Z is twice the X and Y spacing, then you might specify the volume size as -1 to 1 for X and Y but -2 to 2 for Z.
Indicates the file location containing the data set.
Default is an empty string. Depending on the file type, the corresponding SoVolumeReader (if it exists) is used.
File Extension | Loader Class | Description |
.am | SoVRAmFileReader | Amira Mesh file format |
.dc3, .dic, .dicom | SoVRDicomFileReader | Dicom file format |
.fld | SoVRAvsFileReader | AVS field file format |
.lda or .ldm | SoVRLdmFileReader | Large Data Management file format |
.sgy or .segy | SoVRSegyFileReader | SEG Y revision 1 file format |
.vol | SoVRVolFileReader | Vol file format |
.vox | SoVRVoxFileReader | Vox file format |
.lst | SoVRRasterStackReader | Lst file format |
The filename extension is not case sensitive.
Note: SoDataSet and its derived classes (SoVolumeData, etc) do not search the SoInput directory list to find files specified in this field. To check file existence and other properties the SbFileHelper class may be useful.
Contains an SoLDMResourceParameters object which allows you to set LDM resource parameters.
For scalar (non-RGBA) data, specifies the size of voxel values on the GPU in bits.
The valid values are: 0 (default), 8 and 16.
When set to 0, LDM chooses the best precision based on the size of the data type (or if specified, the number of significant bits) - meaning that LDM will store 8-bit values on the GPU for 8-bit data and store 16-bit values for all other data types.
There are several trade-offs influenced by this value, including:
Controls use of OpenGL lossy texture compression for RGBA data (if available).
Default is TRUE.
A significant advantage of compressed textures is that they conserve texture memory space. At the moment, the extension works on RGBA textures only, not on paletted textures. The compression factor is about 5.
A potential drawback of compressed textures is that lossy compression can result in values on the GPU that are that are slightly different from the actual value in the volume. For example "gray scale" colors could have a slight color in some cases. You should always set this option to false when using "RGBA" data to store 32-bit "id" values.