Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoLDMReader Class Reference

Large Data Management Base class for LDM data set readers More...

#include <LDM/readers/SoLDMReader.h>

+ Inheritance diagram for SoLDMReader:

Public Types

enum  SoLDMError {
  LDM_NO_ERROR ,
  LDM_FILE_NOT_FOUND ,
  LDM_XML_ROOT_START_TAG_NOT_FOUND ,
  LDM_XML_ROOT_END_TAG_NOT_FOUND ,
  LDM_ALTERNATE_FILE_NOT_FOUND ,
  LDM_XML_PARSING_ERROR ,
  LDM_SIZE_TAG_MISSING ,
  LDM_COMPLETION_FILE_NOT_FOUND ,
  LDM_RD_NO_ERROR ,
  LDM_RD_FILE_NOT_FOUND_ERROR ,
  LDM_RD_UNSUPPORTED_DATA_TYPE_ERROR ,
  LDM_RD_UNKNOWN_ERROR
}
 LDM Reader error code. More...
 
- Public Types inherited from SoVolumeReader
enum  ReadError {
  RD_NO_ERROR ,
  RD_FILE_NOT_FOUND_ERROR ,
  RD_INVALID_DATA_ERROR ,
  RD_UNSUPPORTED_DATA_TYPE_ERROR ,
  RD_FILE_FORMAT_NOT_VALID_ERROR ,
  RD_UNKNOWN_ERROR
}
 Read error. More...
 
enum  Axis {
  X ,
  Y ,
  Z
}
 Which axis to handle. More...
 
enum  ReaderType {
  NO_READER ,
  AM ,
  AVS ,
  DICOM ,
  GENERIC ,
  LDM ,
  MEMORY ,
  RASTERSTACK ,
  SEGY ,
  VOL ,
  VOX ,
  TIFF ,
  MRC
}
 Available reader type. More...
 
enum  CoordinateType {
  COORDINATES_UNIFORM = 0 ,
  COORDINATES_RECTILINEAR
}
 Coordinate type used by this data set. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoLDMReader ()
 Constructor.
 
virtual SbBox3f getSize ()
 Returns the bounding box of the total data in world coordinates.
 
virtual SbVec3i32 getDimension ()
 Returns the dimension of the data.
 
virtual SbBool getTileSize (SbVec3i32 &tile)
 Returns the size of a data tile.
 
virtual SbBool getBbox (int fileId, SbBox3f &box)
 Returns the bounding box of the data associated with the specified file ID.
 
virtual SbBool getCenter (int fileId, SbVec3f &center)
 Returns the center of the data associated with the specified file ID.
 
virtual ReadError getDataChar (SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim) override
 Gets the characteristics (file header) of the data volume.
 
void getSubSlice (const SbBox2i32 &subSlice, int sliceNumber, void *data)
 Note: SoLDMReader does not implement this method.
 
virtual SoBufferObjectreadTile (int index, const SbBox3i32 &tilePosition)
 Given an index, reads a tile if the data is organized in tiles (for LDM).
 
virtual SbBool readXTraceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const SbVec2i32 &tracePosition)
 Read directly from the LDM data source, a trace inside a tile.
 
virtual SbBool readXSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition)
 Read directly from the LDM data source, an orthoslice on the X axis inside a tile.
 
virtual SbBool readYSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition)
 Read directly from the LDM data source, an orthoslice on the Y axis inside a tile.
 
virtual SbBool readZSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition)
 Read directly from the LDM data source, an orthoslice on the Z axis inside a tile.
 
virtual SbBool getMinMax (int64_t &min, int64_t &max)
 Returns the minimum and maximum data values.
 
virtual SbBool getMinMax (double &min, double &max)
 Returns the minimum and maximum data values (for float values).
 
virtual SbBool getHistogram (std::vector< int64_t > &numVox)
 Returns the distribution of data values, i.e., the number of voxels per data value.
 
virtual bool isLittleEndian ()
 Returns whether the bytes of the data are stored in big or little endian order.
 
virtual SbString getOriginalFilename () const
 Returns original file name from which the data has been converted to LDM format if stored in file.
 
virtual SbXmlTag getXmlTag (const char *tagName)
 Gets the first occurrence of the XML element whose tag name is specified by tagName.
 
virtual SoVolumeReader::ReaderType getReaderType ()
 Returns the reader type.
 
virtual SoVolumeWritergetConfiguredWriter ()
 Returns a volume writer that corresponds to this reader
(same format, parameters, etc).
 
virtual int handleHeader (TiXmlElement *)
 Handle tags of LDM reader inheriting from this base class.
 
virtual SbBool isThreadSafe () const
 Return true as this reader is thread safe.
 
virtual SbVec2d getTileMinMax (int index) const
 Returns the minimum and maximum data values for the given tile.
 
virtual ReadError getDataChar (SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim)=0
 Gets the characteristics (file header) of the data volume.
 
virtual void getSubSlice (const SbBox2i32 &subSlice, int sliceNumber, void *data)
 Must copy the rectangular part defined by subSlice of the XY slice sliceNumber to the memory referenced by data.
 
virtual void getSubSlice (const SbBox2i32 &subSlice, int sliceNumber, SoBufferObject *dataBuffer)
 Same as getSubSlice( const SbBox2i32& subSlice, int sliceNumber, void * data ) but using an SoBufferObject as the target of the data.
 
virtual SoBufferObjectreadTile (int index, const SbBox3i32 &tilePosition)
 Given an index, reads a tile if the data is organized in tiles (for LDM).
 
virtual SoDEPRECATED SbBool readTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition)
 Given an index, reads a tile if the data is organized in tiles (for LDM).
 
virtual SoDEPRECATED SbBool readTile (int index, SoBufferObject *buffer, const SbBox3i32 &tilePosition)
 Same as readTile(int index, unsigned char*& buffer, const SbBox3i32& tilePosition) but using an SoBufferObject (allocated by LDM) as the target of the data.
 
- Public Member Functions inherited from SoVolumeReader
 SoVolumeReader ()
 Constructor.
 
virtual SbBool setOutputDataType (SbBool doChange, SoDataSet::DataType outputType)
 Sets the output data type.
 
virtual SbBool setInputDataRange (SbBool doChange, double min, double max)
 Requests that the input be converted from the specified range to the range depending on the output data type.
 
virtual int getNumSignificantBits ()
 This method is optional.
 
SbVec3i32 getNumVoxels (const SbVec3i32 &realSize, const SbVec3i32 &subsamplingLevel)
 Utility function provided by SoVolumeReader for subclass readers to call.
 
SbVec3i32 getSizeToAllocate (const SbVec3i32 &realSize, const SbVec3i32 &subsamplingLevel)
 Utility function provided by SoVolumeReader for subclass readers to call.
 
virtual int setFilename (const SbString &filename)
 Specifies the path of the file.
 
SbString getFilename () const
 Returns the path of the file.
 
virtual SbBool isIgnoredFile () const
 Should return TRUE if at least one file has been ignored during reading.
 
virtual SbBool setDirectCoordSysAutoDetection (SbBool autoValue)
 Sets whether or not the reader should automatically try to detect if the coordinate system used is direct or not.
 
virtual SbBool getDirectCoordSysAutoDetection ()
 Return automatic detection value.
 
virtual SbBool setDirectCoorSys (SbBool directCoord)
 Specify if the coordinate system used is direct or not.
 
virtual SbBool getDirectCoordSys ()
 Return whether the coordinate system used is direct or not.
 
CoordinateType getCoordinateType ()
 Returns coordinate type used by the data set.
 
const float * getRectilinearCoordinates (Axis axis) const
 Returns the coordinates for the specified axis.
 
void setRectilinearCoordinates (const float *x, const float *y, const float *z)
 Sets rectilinear coordinates for the data set.
 
virtual SbBool isRGBA () const
 Returns TRUE if the data set contains RGBA color values.
 
void setRGBA (const SbBool flag)
 Specifies if data must be considered as RGBA.
 
- 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 void touch ()
 Marks an instance as modified, simulating a change to it.
 
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 SoVolumeReader
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SoVolumeReadergetAppropriateReader (const SbString &filename)
 Returns a preconfigured SoVolumeReader instance that can be used to load the given file (based on the filename extension).
 
- 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.
 

Deprecated

virtual SoDEPRECATED int getBorderFlag ()
 Returns the border flag.
 
virtual SoDEPRECATED SbBool readTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition)
 Given an index, reads a tile if the data is organized in tiles (for LDM).
 
virtual SoDEPRECATED SbBool getMinMax (int &min, int &max)
 Returns the minimum and maximum data values.
 

Additional Inherited Members

- Protected Member Functions inherited from SoVolumeReader
virtual ~SoVolumeReader ()
 Destructor.
 
void * getBuffer (int64_t offset, unsigned int size)
 Returns a pointer to a buffer of size bytes corresponding to a part of the file at offset bytes from the beginning of the file.
 
int64_t fileSize ()
 Returns the size of the file when file I/O is handled by this class.
 
- Static Protected Member Functions inherited from SoVolumeReader
static bool registerVolumeReaderExtension (const SbString &fileExtension, const SoType &readerType)
 Register an SoVolumeReader class to handle a file extension.
 
static bool unregisterVolumeReaderExtensions (const SoType &readerType)
 Unregister all filename extensions associated with the specified SoVolumeReader class.
 
static int bytesToInt (const unsigned char *ptr, int sizeBytes)
 Utility method that returns an integer from sizeBytes bytes starting at address ptr.
 
static void swapBytes (int *intPtr, int sizeBytes)
 Utility method to convert an integer into the correct architecture (little/big endian).
 
static void swapBytesN (void *buffer, int numElements, int numBytesPerElement)
 Utility method to swap bytes of each element of an array of numElements elements.
 
static SbBool isValidFloat (const float val)
 Utility method to check if value is a valid IEEE 754 floating point number.
 
static SbBox3f adjustFlatExtent (const SbString &fileName, const SbBox3f &extent, const SbVec3i32 &dim)
 VolumeViz doesn't handles empty extent (for ex.
 
- Protected Attributes inherited from SoVolumeReader
SoDEPRECATED SbBool m_dataConverted
 

Detailed Description

Large Data Management Base class for LDM data set readers

This is the base class for specific LDM readers.

See SoVRLdmFileReader for a specific implementation.

This class retrieves the XML tags from an LDM header file (usually a .ldm file) that are general to all LDM files, i.e. the tags that are interpreted by VolumeViz.

Custom tags for classes derived from SoLDMReader can be retrieved by overriding the handleHeader method.

General tags common for all LDM Readers are:

<?xml version="1.0" encoding="utf-8" ?>
<VolumeInformation>
<OriginalFile>3dhead.vol</OriginalFile>
<Size> //or dimension//
<U>256</U>
<V>256</V>
<W>109</W>
</Size>
<TileSize>
<U>64</U>
<V>64</V>
<W>64</W>
</TileSize>
<DataType>
<Type>n</Type><Num>m</Num>
...
<DataType>
<DataFilename>3DHEAD.dat</DataFilename>//separate datafile//
<WordFormat>1</WordFormat>//data stored in little/big endian//
<CompletionFilename>3dhead.fcp</CompletionFilename>//if the conversion was interrupted, refer to this file
<RectilinearMapping>
<mapping axis="U">
<map>-180</map>
<map>-160</map>
... one entry per voxel on U axis
</mapping>
... repeat for V, W axis
</RectilinearMapping>

Note that the minimum tags that MUST be in the LDM header are <Size> or <Dimension> and <TileSize>. Otherwise the reader will throw a "tag missing" exception.

Definition at line 97 of file SoLDMReader.h.

Member Enumeration Documentation

◆ SoLDMError

LDM Reader error code.

Enumerator
LDM_NO_ERROR 

no error

LDM_FILE_NOT_FOUND 

file not found

LDM_XML_ROOT_START_TAG_NOT_FOUND 

XML START Tag not found.

LDM_XML_ROOT_END_TAG_NOT_FOUND 

XML END Tag not found.

LDM_ALTERNATE_FILE_NOT_FOUND 

Alternate file not found.

LDM_XML_PARSING_ERROR 

XML parsing error.

LDM_SIZE_TAG_MISSING 

Size tag missing.

LDM_COMPLETION_FILE_NOT_FOUND 

Completion file not found.

LDM_RD_NO_ERROR 

No error.

LDM_RD_FILE_NOT_FOUND_ERROR 

file not found

LDM_RD_UNSUPPORTED_DATA_TYPE_ERROR 

Unsupported data file type.

LDM_RD_UNKNOWN_ERROR 

Unknown error.

Definition at line 109 of file SoLDMReader.h.

Constructor & Destructor Documentation

◆ SoLDMReader()

SoLDMReader::SoLDMReader ( )

Constructor.

Member Function Documentation

◆ getBbox()

SbBool SoLDMReader::getBbox ( int  fileId,
SbBox3f box 
)
inlinevirtual

Returns the bounding box of the data associated with the specified file ID.

The file ID corresponds to the tile ID in an LDM data file. If returns FALSE, not supported.

Definition at line 675 of file SoLDMReader.h.

◆ getBorderFlag()

virtual SoDEPRECATED int SoLDMReader::getBorderFlag ( )
virtual

Returns the border flag.

If 0, tiles do not overlap. If not 0, they do.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileBorderReader.

◆ getCenter()

SbBool SoLDMReader::getCenter ( int  fileId,
SbVec3f center 
)
inlinevirtual

Returns the center of the data associated with the specified file ID.

If returns FALSE, not supported.

Definition at line 681 of file SoLDMReader.h.

◆ getClassTypeId()

static SoType SoLDMReader::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getConfiguredWriter()

virtual SoVolumeWriter * SoLDMReader::getConfiguredWriter ( )
virtual

Returns a volume writer that corresponds to this reader
(same format, parameters, etc).

If no writer can be created, NULL is returned.

Notes:

  • The simplest way to implement this behavior is to return a new writer every time.
  • The returned writer is not synchronized with this reader nor with other writers.
  • The returned writer must be manually refed/unrefed.

For example:

MyVolumeReader* reader = new MyVolumeReader();
reader->setFilename( "someFile.dat" );
MyVolumeWriter* writer1 = (MyVolumeWriter*)reader->getConfiguredWriter();
// This writer will write to "someFile.dat"
reader->setFilename( "someOtherFile.dat" );
// The writer will still write to "someFile.dat"
writer1->setFilename( "stillAnotherFile.dat" );
SoVolumeWriter* writer2 = reader->getConfiguredWriter();
// writer2 will write to "someOtherFile.dat", because the
// reader is configured to read from "someOtherFile.dat"
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Abstract...

Reimplemented from SoVolumeReader.

◆ getDataChar() [1/2]

virtual ReadError SoLDMReader::getDataChar ( SbBox3f size,
SoDataSet::DataType type,
SbVec3i32 dim 
)
overridevirtual

Gets the characteristics (file header) of the data volume.

See SoDataSet::setVolumeData().
You can use the convenience method setFilename() to specify the file location, in which case you will not have to open the file yourself. Then you can use the convenience method getBuffer() to read the header in order to get the requested information.

NOTE: We strongly recommend that readers implement this version of getDataChar, introduced in VolumeViz 5.1, because it uses SbVec3i32 for the volume dimension.

Implements SoVolumeReader.

Reimplemented in SoVRLdmFileBorderReader, and SoVRLdmFileReader.

◆ getDataChar() [2/2]

virtual ReadError SoVolumeReader::getDataChar ( SbBox3f size,
SoDataSet::DataType type,
SbVec3i32 dim 
)
virtual

Gets the characteristics (file header) of the data volume.

See SoDataSet::setVolumeData().
You can use the convenience method setFilename() to specify the file location, in which case you will not have to open the file yourself. Then you can use the convenience method getBuffer() to read the header in order to get the requested information.

NOTE: We strongly recommend that readers implement this version of getDataChar, introduced in VolumeViz 5.1, because it uses SbVec3i32 for the volume dimension.

Implements SoVolumeReader.

Reimplemented in SoVRLdmFileBorderReader, and SoVRLdmFileReader.

◆ getDimension()

virtual SbVec3i32 SoLDMReader::getDimension ( )
virtual

Returns the dimension of the data.

◆ getHistogram()

virtual SbBool SoLDMReader::getHistogram ( std::vector< int64_t > &  numVox)
virtual

Returns the distribution of data values, i.e., the number of voxels per data value.

numVox(0) is the number of voxels with value 0, numVox(1) is the number of voxels with value 1, and so on.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileReader.

◆ getMinMax() [1/3]

virtual SbBool SoLDMReader::getMinMax ( double &  min,
double &  max 
)
virtual

Returns the minimum and maximum data values (for float values).

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileReader.

◆ getMinMax() [2/3]

virtual SoDEPRECATED SbBool SoLDMReader::getMinMax ( int &  min,
int &  max 
)
virtual

Returns the minimum and maximum data values.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileReader.

◆ getMinMax() [3/3]

virtual SbBool SoLDMReader::getMinMax ( int64_t &  min,
int64_t &  max 
)
virtual

Returns the minimum and maximum data values.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileReader.

◆ getOriginalFilename()

virtual SbString SoLDMReader::getOriginalFilename ( ) const
virtual

Returns original file name from which the data has been converted to LDM format if stored in file.

Reimplemented from SoVolumeReader.

◆ getReaderType()

virtual SoVolumeReader::ReaderType SoLDMReader::getReaderType ( )
inlinevirtual

Returns the reader type.

Reimplemented from SoVolumeReader.

Definition at line 290 of file SoLDMReader.h.

◆ getSize()

virtual SbBox3f SoLDMReader::getSize ( )
virtual

Returns the bounding box of the total data in world coordinates.

◆ getSubSlice() [1/3]

virtual void SoVolumeReader::getSubSlice ( const SbBox2i32 subSlice,
int  sliceNumber,
SoBufferObject dataBuffer 
)
virtual

Same as getSubSlice( const SbBox2i32& subSlice, int sliceNumber, void * data ) but using an SoBufferObject as the target of the data.

If not reimplemented then the version with "unsigned char*" parameter is called

Parameters
subSlice2D region of the slice to return.
sliceNumberSlice number on the volume Z axis (first slice is 0).
dataBufferThe target buffer to be filled.

Reimplemented from SoVolumeReader.

◆ getSubSlice() [2/3]

virtual void SoVolumeReader::getSubSlice ( const SbBox2i32 subSlice,
int  sliceNumber,
void *  data 
)
virtual

Must copy the rectangular part defined by subSlice of the XY slice sliceNumber to the memory referenced by data.

Slices will not always be read sequentially.

Parameters
subSlice2D region of the slice to return.
sliceNumberSlice number on the volume Z axis (first slice is 0).
dataCopy the data into this buffer.

You can use the convenience method getBuffer() to read data from file. Note: setFilename() must have been called previously.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileReader.

◆ getSubSlice() [3/3]

void SoLDMReader::getSubSlice ( const SbBox2i32 subSlice,
int  sliceNumber,
void *  data 
)
inlinevirtual

Note: SoLDMReader does not implement this method.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileReader.

Definition at line 687 of file SoLDMReader.h.

◆ getTileMinMax()

virtual SbVec2d SoLDMReader::getTileMinMax ( int  index) const
virtual

Returns the minimum and maximum data values for the given tile.

This information benefits optimizations such as SoLDMGlobalResourceParameters::setIgnoreFullyTransparentTiles and custom SoVolumeReader able to return SoCpuBufferUniform.

VolumeViz will only call this method if the data is organized in tiles like the LDM file format. In other words, if isDataConverted() returned true. The LDM Converter program automatically computes this information and stores it in the LDM header file. Custom volume readers that implement tiled data, i.e. return true when isDataConverted is called, should consider implement this method when the min max values are available from their backend API.

NOTES:

  • Automatic computation of tile min/max values works fine for actual volume data. But we strongly recommend implementing this method for height field data (see SoHeightFieldGeometry etc). Because of the way the height field algorithm works, if tile min/max info is not available, VolumeViz must load all height field tiles before the first render. This can cause a long delay before the first rendering appears.
  • When all the voxels in the requested tile (fileId) have the same value, we recommend that the volume reader implement two optimizations. First, the readTile() method should return an SoCpuBufferUniform object (instead of SoCpuBufferObject). This reduces the amount of CPU and GPU memory needed to store the tile, allowing more tiles to be loaded in the same amount of memory. Second, the getTileMinMax() method should return an empty range (min = max) for this tile. This allows VolumeViz to optimize sending tiles to the GPU. However, note that the getTileMinMax() method is called before the readTile() method. So ideally the volume reader should be able to return the tile min/max without actually loading the tile data, for example by using metadata stored with the tiles.

Default implementation returns SbVec2d(numeric_limits<double>::max(),-numeric_limits<double>::max())

Parameters
indexThe fileId of the tile.

Reimplemented from SoVolumeReader.

◆ getTileSize()

virtual SbBool SoLDMReader::getTileSize ( SbVec3i32 tile)
virtual

Returns the size of a data tile.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileBorderReader.

◆ getTypeId()

virtual SoType SoLDMReader::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileBorderReader, and SoVRLdmFileReader.

◆ getXmlTag()

virtual SbXmlTag SoLDMReader::getXmlTag ( const char *  tagName)
virtual

Gets the first occurrence of the XML element whose tag name is specified by tagName.

Then the associated value or subtags can be fetched using the SbXmlElement methods. Custom XML tags can be added to the LDM header file by using the method SoLDMConverter::setXmlCallback().

◆ handleHeader()

virtual int SoLDMReader::handleHeader ( TiXmlElement *  )
inlinevirtual

Handle tags of LDM reader inheriting from this base class.

Definition at line 298 of file SoLDMReader.h.

◆ isLittleEndian()

virtual bool SoLDMReader::isLittleEndian ( )
virtual

Returns whether the bytes of the data are stored in big or little endian order.

The order is little endian if the function returns true.

◆ isThreadSafe()

virtual SbBool SoLDMReader::isThreadSafe ( ) const
virtual

Return true as this reader is thread safe.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileBorderReader, and SoVRLdmFileReader.

◆ readTile() [1/5]

virtual SoBufferObject * SoVolumeReader::readTile ( int  index,
const SbBox3i32 tilePosition 
)
virtual

Given an index, reads a tile if the data is organized in tiles (for LDM).


In the default LDM architecture, the LDM data is based on an octree topology (see SoLDMFileReader). The index passed is 0 for the tile of lowest resolution representing the entire volume (octree root node). The index increments linearly going down through the octree.

A tile can be undefined or empty which means it is not rendered and it isn't taken into account for the rendering of its adjacent cells. An empty buffer or NULL can be returned by this method to specify an undefined tile.

Parameters
indexspecifies a fileID, the id of an existing tile (fileID=tileID in a cubical volume).
tilePositionspecifies the position of the data in the associated volume data of the tile corresponding to the given index. In the default SoVRLdmFileReader, the tilePosition isn't actually used but it is passed as a convenience for customized readers (can be used for mapping to a different index scheme).
Returns
the buffer containing the data of the tile, or NULL (or an empty buffer) in order to specify an undefined tile.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileBorderReader.

◆ readTile() [2/5]

virtual SoBufferObject * SoLDMReader::readTile ( int  index,
const SbBox3i32 tilePosition 
)
virtual

Given an index, reads a tile if the data is organized in tiles (for LDM).

In the default LDM architecture, the LDM data is based on an octree topology (see SoLDMFileReader). The index passed is 0 for the tile of lowest resolution representing the entire volume (octree root node). The index increments linearly going down through the octree.

Parameters
indexspecifies a fileID, the id of an existing tile (fileID=tileID in a cubical volume).
tilePositionspecifies the position of the data in the associated volume data of the tile corresponding to the given index. In the default SoVRLdmFileReader, the tilePosition isn't actually used but it is passed as a convenience for customized readers (can be used for mapping to a different index scheme).

Returns a pointer to an allocated buffer containing the data.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileBorderReader.

◆ readTile() [3/5]

virtual SoDEPRECATED SbBool SoVolumeReader::readTile ( int  index,
SoBufferObject buffer,
const SbBox3i32 tilePosition 
)
virtual

Same as readTile(int index, unsigned char*& buffer, const SbBox3i32& tilePosition) but using an SoBufferObject (allocated by LDM) as the target of the data.

If not reimplemented then the version with "unsigned char*" parameter is called

Reimplemented from SoVolumeReader.

◆ readTile() [4/5]

virtual SoDEPRECATED SbBool SoVolumeReader::readTile ( int  index,
unsigned char *&  buffer,
const SbBox3i32 tilePosition 
)
inlinevirtual

Given an index, reads a tile if the data is organized in tiles (for LDM).


In the default LDM architecture, the LDM data is based on an octree topology (see SoVRLdmFileReader). The index passed is 0 for the tile of lowest resolution representing the entire volume (octree root node). The index increments linearly going down through the octree.

Indexing works as follows:

Tile 1 is the lower back left corner of the cube. The index increments on X, then Y, and finally Z. So the back tiles are:

3 4
1 2

And the front tiles are:

7 8
5 6

The tiles of full resolution are the leaf tiles.

In the default SoVRLdmFileReader, the tilePosition isn't actually used by the reader but it is passed as a convenience for customized readers (can be used for mapping to a different index scheme).

Reimplemented from SoVolumeReader.

Definition at line 871 of file SoVolumeReader.h.

◆ readTile() [5/5]

virtual SoDEPRECATED SbBool SoLDMReader::readTile ( int  index,
unsigned char *&  buffer,
const SbBox3i32 tilePosition 
)
virtual

Given an index, reads a tile if the data is organized in tiles (for LDM).

In the default LDM architecture, the LDM data is based on an octree topology (see SoLDMFileReader). The index passed is 0 for the tile of lowest resolution representing the entire volume (octree root node). The index increments linearly going down through the octree.

Indexing works as follows:

Tile 1 is the lower back left corner of the cube. The index increments on X, then Y, and finally Z. So the back tiles are:

3 4
1 2

And the front tiles are:

7 8
5 6

The tiles of full resolution are the leaf tiles.

Parameters
indexspecifies a fileID, the id of an existing tile (fileID=tileID in a cubical volume).
bufferThe buffer in which the data is returned.
tilePositionspecifies the position of the data in the associated volume data of the tile corresponding to the given index. In the default SoVRLdmFileReader, the tilePosition isn't actually used but it is passed as a convenience for customized reader (can be used for mapping to a different index scheme).

Reimplemented from SoVolumeReader.

◆ readXSliceInTile()

virtual SbBool SoLDMReader::readXSliceInTile ( int  index,
unsigned char *&  buffer,
const SbBox3i32 tilePosition,
const uint32_t &  slicePosition 
)
virtual

Read directly from the LDM data source, an orthoslice on the X axis inside a tile.

Parameters
indexThe fileId of the tile.
bufferThe buffer in which the data is returned.
tilePositionSpecifies the position of the data in the associated volume data of the tile corresponding to the given index. In the default SoVRLdmFileReader, the tilePosition isn't actually used but it is passed as a convenience for customized reader (can be used for mapping to a different index scheme).
slicePositionThe slice position in the tile.

Reimplemented from SoVolumeReader.

◆ readXTraceInTile()

virtual SbBool SoLDMReader::readXTraceInTile ( int  index,
unsigned char *&  buffer,
const SbBox3i32 tilePosition,
const SbVec2i32 tracePosition 
)
virtual

Read directly from the LDM data source, a trace inside a tile.

Parameters
indexThe fileId of the tile.
bufferThe buffer in which the data is returned.
tilePositionSpecifies the position of the data in the associated volume data of the tile corresponding to the given index. In the default SoVRLdmFileReader, the tilePosition isn't actually used but it is passed as a convenience for customized reader (can be used for mapping to a different index scheme).
tracePositionrepresents the (i,j) coordinates of the trace.

Reimplemented from SoVolumeReader.

◆ readYSliceInTile()

virtual SbBool SoLDMReader::readYSliceInTile ( int  index,
unsigned char *&  buffer,
const SbBox3i32 tilePosition,
const uint32_t &  slicePosition 
)
virtual

Read directly from the LDM data source, an orthoslice on the Y axis inside a tile.

Parameters
indexThe fileId of the tile.
bufferThe buffer in which the data is returned.
tilePositionSpecifies the position of the data in the associated volume data of the tile corresponding to the given index. In the default SoVRLdmFileReader, the tilePosition isn't actually used but it is passed as a convenience for customized reader (can be used for mapping to a different index scheme).
slicePositionThe slice position in the tile.

Reimplemented from SoVolumeReader.

◆ readZSliceInTile()

virtual SbBool SoLDMReader::readZSliceInTile ( int  index,
unsigned char *&  buffer,
const SbBox3i32 tilePosition,
const uint32_t &  slicePosition 
)
virtual

Read directly from the LDM data source, an orthoslice on the Z axis inside a tile.

Parameters
indexThe fileId of the tile.
bufferThe buffer in which the data is returned.
tilePositionSpecifies the position of the data in the associated volume data of the tile corresponding to the given index. In the default SoVRLdmFileReader, the tilePosition isn't actually used but it is passed as a convenience for customized reader (can be used for mapping to a different index scheme).
slicePositionThe slice position in the tile.

Reimplemented from SoVolumeReader.


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