SoLDMReader Class Reference
[Readers]

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

#include <LDM/readers/SoLDMReader.h>

Inheritance diagram for SoLDMReader:
SoVolumeReader SoFieldContainer SoBase SoRefCounter SoTypedObject SoVRLdmFileReader SoVRLdmFileBorderReader

List of all members.

Classes

struct  Descriptor

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
}

Public Member Functions

virtual SoType getTypeId () const
 SoLDMReader ()
virtual SbBox3f getSize ()
virtual SbVec3i32 getDimension ()
virtual SbBool getTileSize (SbVec3i32 &tile)
virtual SbBool getBbox (int fileId, SbBox3f &box)
virtual SbBool getCenter (int fileId, SbVec3f &center)
virtual SoVolumeReader::ReadError getDataChar (SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim)
void getSubSlice (const SbBox2i32 &subSlice, int sliceNumber, void *data)
virtual SoBufferObjectreadTile (int index, const SbBox3i32 &tilePosition)
virtual SbBool readXTraceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const SbVec2i32 &tracePosition)
virtual SbBool readXSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition)
virtual SbBool readYSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition)
virtual SbBool readZSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition)
virtual SbBool getMinMax (int64_t &min, int64_t &max)
virtual SbBool getMinMax (double &min, double &max)
virtual SbBool getHistogram (std::vector< int64_t > &numVox)
virtual bool isLittleEndian ()
virtual SbString getOriginalFilename () const
virtual SbXmlTag getXmlTag (const char *tagName)
virtual SoVolumeReader::ReaderType getReaderType ()
virtual SoVolumeWritergetConfiguredWriter ()
virtual int handleHeader (TiXmlElement *)
virtual SbBool isThreadSafe () const
virtual SbVec2d getTileMinMax (int index) const

Static Public Member Functions

static SoType getClassTypeId ()

Deprecated



virtual SoDEPRECATED int getBorderFlag ()
virtual SoDEPRECATED SbBool readTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition)
virtual SoDEPRECATED SbBool getMinMax (int &min, int &max)

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.

See related examples:

ComputeBatch


Member Enumeration Documentation

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.


Constructor & Destructor Documentation

SoLDMReader::SoLDMReader (  ) 

Constructor.


Member Function Documentation

SbBool SoLDMReader::getBbox ( int  fileId,
SbBox3f box 
) [inline, virtual]

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.

virtual SoDEPRECATED int SoLDMReader::getBorderFlag (  )  [virtual]

Returns the border flag.

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

Deprecated:

Deprecated since Open Inventor 9000
No longer used. Returns 0

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileBorderReader.

SbBool SoLDMReader::getCenter ( int  fileId,
SbVec3f center 
) [inline, virtual]

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

If returns FALSE, not supported.

static SoType SoLDMReader::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileBorderReader, and SoVRLdmFileReader.

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"

Reimplemented from SoVolumeReader.

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

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

size is the size of the actual volume. type is the type of the data. dim is the dimension of the data.

Implements SoVolumeReader.

Reimplemented in SoVRLdmFileBorderReader, and SoVRLdmFileReader.

virtual SbVec3i32 SoLDMReader::getDimension (  )  [virtual]

Returns the dimension of the data.

SbBool SoLDMReader::getHistogram ( std::vector< int64_t > &  numVox  )  [inline, 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.

SbBool SoLDMReader::getMinMax ( int &  min,
int &  max 
) [inline, virtual]

Returns the minimum and maximum data values.

Deprecated:

Deprecated since Open Inventor 9500
Use getMinMax(int64_t & min, int64_t & max) instead.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileReader.

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

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

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileReader.

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

Returns the minimum and maximum data values.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileReader.

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.

virtual SoVolumeReader::ReaderType SoLDMReader::getReaderType (  )  [inline, virtual]

Returns the reader type.

Reimplemented from SoVolumeReader.

virtual SbBox3f SoLDMReader::getSize (  )  [virtual]

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

void SoLDMReader::getSubSlice ( const SbBox2i32 subSlice,
int  sliceNumber,
void *  data 
) [inline, virtual]

Note: SoLDMReader does not implement this method.

Implements SoVolumeReader.

Reimplemented in SoVRLdmFileReader.

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:
index The fileId of the tile.

Reimplemented from SoVolumeReader.

virtual SbBool SoLDMReader::getTileSize ( SbVec3i32 tile  )  [virtual]

Returns the size of a data tile.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileBorderReader.

virtual SoType SoLDMReader::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Reimplemented from SoVolumeReader.

Reimplemented in SoVRLdmFileBorderReader, and SoVRLdmFileReader.

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().

virtual int SoLDMReader::handleHeader ( TiXmlElement *   )  [inline, virtual]

Handle tags of LDM reader inheriting from this base class.

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.

virtual SbBool SoLDMReader::isThreadSafe (  )  const [virtual]

Return true as this reader is thread safe.

Reimplemented from SoVolumeReader.

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:
index specifies a fileID, the id of an existing tile (fileID=tileID in a cubical volume).
buffer The buffer in which the data is returned.
tilePosition specifies 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).
Deprecated:

Deprecated since Open Inventor 9400
Use SoBufferObject* readTile(int index, const SbBox3i32& tilePosition) instead.

Reimplemented from SoVolumeReader.

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:
index specifies a fileID, the id of an existing tile (fileID=tileID in a cubical volume).
tilePosition specifies 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.

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:
index The fileId of the tile.
buffer The buffer in which the data is returned.
tilePosition Specifies 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).
slicePosition The slice position in the tile.

Reimplemented from SoVolumeReader.

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:
index The fileId of the tile.
buffer The buffer in which the data is returned.
tilePosition Specifies 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).
tracePosition represents the (i,j) coordinates of the trace.

Reimplemented from SoVolumeReader.

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:
index The fileId of the tile.
buffer The buffer in which the data is returned.
tilePosition Specifies 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).
slicePosition The slice position in the tile.

Reimplemented from SoVolumeReader.

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:
index The fileId of the tile.
buffer The buffer in which the data is returned.
tilePosition Specifies 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).
slicePosition The slice position in the tile.

Reimplemented from SoVolumeReader.


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

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/