SoVolumeReader Class Reference
[Readers]

Large Data Management Abstract base class for volume data set readers. More...

#include <LDM/readers/SoVolumeReader.h>

Inheritance diagram for SoVolumeReader:
SoFieldContainer SoBase SoRefCounter SoTypedObject SoLDMReader SoVRAmFileReader SoVRAvsFileReader SoVRDicomFileReader SoVRGenericFileReader SoVRImageDataReader SoVRMemoryReader SoVRMrcFileReader SoVRRasterStackReader SoVRSegyFileReader SoVRTiffFileReader SoVRVolFileReader SoVRVoxFileReader SoVRXtFileReader

List of all members.

Public Types

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
}
enum  Axis {
  X,
  Y,
  Z
}
enum  ReaderType {
  NO_READER,
  AM,
  AVS,
  DICOM,
  GENERIC,
  LDM,
  MEMORY,
  RASTERSTACK,
  SEGY,
  VOL,
  VOX,
  TIFF,
  MRC
}
enum  CoordinateType {
  COORDINATES_UNIFORM = 0,
  COORDINATES_RECTILINEAR
}

Public Member Functions

virtual SoType getTypeId () const
 SoVolumeReader ()
virtual SoVolumeReader::ReadError getDataChar (SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim)=0
virtual SbBool setOutputDataType (SbBool doChange, SoDataSet::DataType outputType)
virtual SbBool setInputDataRange (SbBool doChange, double min, double max)
virtual int getNumSignificantBits ()
virtual void getSubSlice (const SbBox2i32 &subSlice, int sliceNumber, void *data)=0
virtual void getSubSlice (const SbBox2i32 &subSlice, int sliceNumber, SoBufferObject *dataBuffer)
SbVec3i32 getNumVoxels (const SbVec3i32 &realSize, const SbVec3i32 &subsamplingLevel)
SbVec3i32 getSizeToAllocate (const SbVec3i32 &realSize, const SbVec3i32 &subsamplingLevel)
virtual int setFilename (const SbString &filename)
SbString getFilename () const
virtual SbBool isDataConverted () const
virtual void reloadTileMinMax ()
virtual SbBool getTileSize (SbVec3i32 &size)
virtual SoBufferObjectreadTile (int index, const SbBox3i32 &tilePosition)
virtual SbBool readXTraceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const SbVec2i32 &tracePosition)
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 readXSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition)
virtual SbBool isThreadSafe () const
virtual SbBool isIgnoredFile () const
virtual SbString getOriginalFilename () const
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 SbBool setDirectCoordSysAutoDetection (SbBool autoValue)
virtual SbBool getDirectCoordSysAutoDetection ()
virtual SbBool setDirectCoorSys (SbBool directCoord)
virtual SbBool getDirectCoordSys ()
virtual SbVec2d getTileMinMax (int index) const
virtual SoVolumeReader::ReaderType getReaderType ()
virtual SoVolumeWritergetConfiguredWriter ()
CoordinateType getCoordinateType ()
const float * getRectilinearCoordinates (Axis axis) const
void setRectilinearCoordinates (const float *x, const float *y, const float *z)
virtual SbBool isRGBA () const
void setRGBA (const SbBool flag)
virtual void closeAllHandles ()
virtual void restoreAllHandles ()

Static Public Member Functions

static SoType getClassTypeId ()
static SoVolumeReadergetAppropriateReader (const SbString &filename)

Protected Member Functions

virtual ~SoVolumeReader ()
void * getBuffer (int64_t offset, unsigned int size)
int bytesToInt (unsigned char *ptr, int sizeBytes)
void swapBytes (int *intPtr, int sizeBytes)
void swapBytesN (void *buffer, int numElements, int numBytesPerElement)
SbBool isValidFloat (const float val)
int64_t fileSize ()

Static Protected Member Functions

static bool registerVolumeReaderExtension (const SbString &fileExtension, const SoType &readerType)
static bool unregisterVolumeReaderExtensions (const SoType &readerType)
static SbBox3f adjustFlatExtent (const SbString &fileName, const SbBox3f &extent, const SbVec3i32 &dim)

Deprecated



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

Detailed Description

Large Data Management Abstract base class for volume data set readers.

This virtual class provides the interface through which VolumeViz accesses volume data that is not already in memory. Predefined reader classes are provided for many common formats like DICOM and SEGY. See the list of supported file formats and class names below.

Application developers may implement custom reader classes. Custom reader classes allow VolumeViz to access data stored in other file formats. This is particularly useful for converting data to LDM format. A custom reader class could also allow VolumeViz to access data through a proprietary data manager or data stored in application memory.

Minimum implementation:

The application must implement a class derived from SoVolumeReader, and must implement the methods getDataChar() and getSubSlice(). In addition, the optional methods getNumSignificantBits() and getMinMax() can be implemented. If getNumSignificantBits() is not implemented (or returns 0), then the number of significant bits depends on the data type. If getMinMax() is not implemented (or returns false), then VolumeViz will find the min and max voxel values. Note that this requires loading all the data and could take a lot of time for a large volume.

VolumeViz always calls getDataChar() and getNumSignificantBits() before requesting any data from the reader.

If the isDataConverted() method is not implemented (or returns false), then VolumeViz will only call getSubSlice() to request data and will build the LDM tile hierarchy in memory, using the slice data. In this case, note that:

LDM (tiled) volume reader:

In addition to the usual requirements for an application-defined reader, e.g., implementing the getDataChar() method, an application-defined reader for LDM data is required to:

An application-defined LDM reader may optionally:

General information:

Starting with Open Inventor 7.0, general rectilinear grids are supported. This feature allows non-uniform voxel spacing along each axis of the volume. The AmiraMesh reader (.am file), the in-memory reader, and the LDM reader support rectilinear coordinates. Call the method setRectilinearCoordinates to specify rectilinear coordinates (if they are not already stored in the data file and set by the reader).

Starting with Open Inventor 7.0, SoVolumeReader is derived from SoFieldContainer. This allows client classes like SoVolumeData to be automatically notified when the reader's state changes, and update their own state appropriately. Any reader method that changes the volume properties (dimension, size, data type, etc) should trigger notification by calling the reader's touch() method. If this notification is not done, client node fields, for example SoDataSet::extent, won't be updated correctly. For example, a reader with a method setData(SbVec3i32 size, void* data) that loads a new data set should call touch() at its end. This reader could also be implemented using an SoSFArray3D field instead of the setData method. Modifying this field will automatically trigger notification.

Applications should subclass from SoVolumeReader when creating any type of custom volume reader, including an LDM (tiled) volume reader. The classes SoLDMReader and SoVRLdmFileReader are internal classes which are specific to the VSG defined LDM file format.

This class cannot be instantiated directly.

Supported file formats:

SEE ALSO

SoDataSet, SoVolumeData, SoConverter

See related examples:

UniformTiles


Member Enumeration Documentation

Which axis to handle.

See also:
getRectilinearCoordinates
Enumerator:
X 
Y 
Z 

Coordinate type used by this data set.

Enumerator:
COORDINATES_UNIFORM 

Uniform grid spacing along each axis.

COORDINATES_RECTILINEAR 

Grid spacing defined by x, y, z values.

Read error.

Enumerator:
RD_NO_ERROR 

No error.

RD_FILE_NOT_FOUND_ERROR 

The data file is not found.

RD_INVALID_DATA_ERROR 

Invalid data.

RD_UNSUPPORTED_DATA_TYPE_ERROR 

Unsupported data type (but the data is valid).

RD_FILE_FORMAT_NOT_VALID_ERROR 

Some error were detected in the file making it impossible to read.

RD_UNKNOWN_ERROR 

Unknown error.

Available reader type.

Enumerator:
NO_READER 

Unknown.

AM 

Amira .am.

AVS 

AVS.

DICOM 

Dicom.

GENERIC 

Generic.

LDM 

Open Inventor LDM.

MEMORY 

In memory.

RASTERSTACK 

Raster Stack.

SEGY 

Segy.

VOL 

Vol.

VOX 

Vox.

TIFF 

Tiff.

MRC 

Mrc.


Constructor & Destructor Documentation

SoVolumeReader::SoVolumeReader (  ) 

Constructor.

virtual SoVolumeReader::~SoVolumeReader (  )  [protected, virtual]

Destructor.


Member Function Documentation

static SbBox3f SoVolumeReader::adjustFlatExtent ( const SbString fileName,
const SbBox3f extent,
const SbVec3i32 dim 
) [static, protected]

VolumeViz doesn't handles empty extent (for ex.

flat extent). But this case may happen some time. For ex. Avizo generally specify a flat extent for single slice volume. In that case, we try to compute a thickness based on other dimension voxel size. This method will return an extent that correspond to given input extent, but with a non null thickness which is equal to smallest non null voxel size.

int SoVolumeReader::bytesToInt ( unsigned char *  ptr,
int  sizeBytes 
) [protected]

Utility method that returns an integer from sizeBytes bytes starting at address ptr.

Also takes into account the machine architecture (little/big endian).

virtual void SoVolumeReader::closeAllHandles (  )  [inline, virtual]

Close all resources that are locked by the reader.

Allows other classes to use the same resources. For example, if the reader reads from a file, this method closes the file so that an SoVolumeWriter associated with the same file can re-open it in write mode. The reader remembers the resources that were closed, so they can re-opened by calling restoreAllHandles().

Reimplemented in SoVRDicomFileReader.

int64_t SoVolumeReader::fileSize (  )  [protected]

Returns the size of the file when file I/O is handled by this class.

static SoVolumeReader* SoVolumeReader::getAppropriateReader ( const SbString filename  )  [static]

Returns a preconfigured SoVolumeReader instance that can be used to load the given file (based on the filename extension).

For example, would return an instance of SoVRDicomFileReader for a file named "data.dic".

If no SoVolumeReader is associated to this extension through registerVolumeReaderExtension() then NULL is returned.

Since Open Inventor 9.4

virtual SoDEPRECATED int SoVolumeReader::getBorderFlag (  )  [inline, virtual]

Returns border (overlap) value if stored in file.

Deprecated:

Deprecated since Open Inventor 9000
No longer used. Only kept to read old file format that contains borderFlag.

Reimplemented in SoLDMReader, and SoVRLdmFileBorderReader.

void* SoVolumeReader::getBuffer ( int64_t  offset,
unsigned int  size 
) [protected]

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.

Then you can directly read the memory pointed to by the returned pointer. This method uses the memory paging system mechanism and thus is quite efficient.

static SoType SoVolumeReader::getClassTypeId (  )  [static]
virtual SoVolumeWriter* SoVolumeReader::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 in SoVRImageDataReader, SoLDMReader, and SoVRMemoryReader.

CoordinateType SoVolumeReader::getCoordinateType (  ) 

Returns coordinate type used by the data set.

virtual SoVolumeReader::ReadError SoVolumeReader::getDataChar ( SbBox3f size,
SoDataSet::DataType type,
SbVec3i32 dim 
) [pure 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.

Implemented in SoVRImageDataReader, SoLDMReader, SoVRLdmFileBorderReader, SoVRLdmFileReader, SoVRAmFileReader, SoVRAvsFileReader, SoVRDicomFileReader, SoVRGenericFileReader, SoVRMemoryReader, SoVRMrcFileReader, SoVRRasterStackReader, SoVRSegyFileReader, SoVRTiffFileReader, SoVRVolFileReader, SoVRVoxFileReader, and SoVRXtFileReader.

SbBool SoVolumeReader::getDirectCoordSys (  )  [inline, virtual]

Return whether the coordinate system used is direct or not.

SbBool SoVolumeReader::getDirectCoordSysAutoDetection (  )  [inline, virtual]

Return automatic detection value.

SbString SoVolumeReader::getFilename (  )  const

Returns the path of the file.

SbBool SoVolumeReader::getHistogram ( std::vector< int64_t > &  numVox  )  [inline, virtual]

Returns histogram if available.

If not, return false.

Reimplemented in SoLDMReader, and SoVRLdmFileReader.

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

Returns min max if stored in file.

Deprecated:

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

Reimplemented in SoLDMReader, and SoVRLdmFileReader.

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

Returns min max for float data type, if available.

If not available, return false. The reader should implement this method if possible, because applications often query these values to setup their SoDataRange node. If this method is not implemented, and the application calls SoVolumeData::getMinMax() is called, then VolumeViz must load every tile to compute the volume min and max. This can cause a long delay.

Reimplemented in SoLDMReader, and SoVRLdmFileReader.

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

Returns min and max for integer data type, if available.

If not available, return false. The reader should implement this method if possible, because applications often query these values to setup their SoDataRange node. If this method is not implemented, and the application calls SoVolumeData::getMinMax() is called, then VolumeViz must load every tile to compute the volume min and max. This can cause a long delay.

Reimplemented in SoLDMReader, and SoVRLdmFileReader.

virtual int SoVolumeReader::getNumSignificantBits (  )  [inline, virtual]

This method is optional.

It returns the number of significant bits of the volume data.

If it is not implemented, the default return value is 0, meaning the number of bits depends on the data type. See the last parameter of SoVolumeData::setVolumeData(). This method is called immediately after getDataChar(). For float data type, number of bits is forced to 32.

Reimplemented in SoVRImageDataReader, SoVRLdmFileReader, SoVRDicomFileReader, SoVRMemoryReader, and SoVRVoxFileReader.

SbVec3i32 SoVolumeReader::getNumVoxels ( const SbVec3i32 realSize,
const SbVec3i32 subsamplingLevel 
)

Utility function provided by SoVolumeReader for subclass readers to call.

Returns the size of the brick the reader must use, based on subsamplingLevel and realSize of the brick. If the subsampling level is greater than 0 on an axis, the corresponding size is computed as follows:

  1. realSize is divided by 2** subsamplingLevel
  2. brickSize is the next greater power of 2

For example, if subsamplingLevel[0]=1 and realSize[0]=21, then the returned readerSize[0]=16.

If subsamplingLevel is 0, the corresponding size is the realSize.

virtual SbString SoVolumeReader::getOriginalFilename (  )  const [inline, virtual]

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

Reimplemented in SoLDMReader.

virtual SoVolumeReader::ReaderType SoVolumeReader::getReaderType (  )  [inline, virtual]
const float* SoVolumeReader::getRectilinearCoordinates ( Axis  axis  )  const

Returns the coordinates for the specified axis.

SbVec3i32 SoVolumeReader::getSizeToAllocate ( const SbVec3i32 realSize,
const SbVec3i32 subsamplingLevel 
)

Utility function provided by SoVolumeReader for subclass readers to call.

If the reader uses the NO_COPY policy, this method returns the size to allocate for the brick. For each axis of the brick, this size is:

(first power of 2 greater than realSize) / ( 2** subsamplingLevel)

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:
subSlice 2D region of the slice to return.
sliceNumber Slice number on the volume Z axis (first slice is 0).
dataBuffer The target buffer to be filled.

Reimplemented in SoVRImageDataReader, SoVRMemoryReader, SoVRMrcFileReader, and SoVRTiffFileReader.

virtual void SoVolumeReader::getSubSlice ( const SbBox2i32 subSlice,
int  sliceNumber,
void *  data 
) [pure 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:
subSlice 2D region of the slice to return.
sliceNumber Slice number on the volume Z axis (first slice is 0).
data Copy the data into this buffer.

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

Implemented in SoVRImageDataReader, SoLDMReader, SoVRLdmFileReader, SoVRAmFileReader, SoVRAvsFileReader, SoVRDicomFileReader, SoVRGenericFileReader, SoVRMemoryReader, SoVRMrcFileReader, SoVRRasterStackReader, SoVRSegyFileReader, SoVRTiffFileReader, SoVRVolFileReader, SoVRVoxFileReader, and SoVRXtFileReader.

virtual SbVec2d SoVolumeReader::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 in SoLDMReader.

virtual SbBool SoVolumeReader::getTileSize ( SbVec3i32 size  )  [virtual]

Returns tile dimensions in voxels when using data stored in tiles.


Return FALSE if data is not stored in tiles.

Reimplemented in SoLDMReader, and SoVRLdmFileBorderReader.

virtual SoType SoVolumeReader::getTypeId (  )  const [virtual]
virtual SbBool SoVolumeReader::isDataConverted (  )  const [virtual]

Returns TRUE if the data is already organized in tiles for the LDM module.


In other words, all drivers that directly support the getTile() method should return TRUE from isDataConverted. If TRUE is returned, VolumeViz will use the readTile method and will NOT call getSubVolume() or getSubSlice().

SbBool SoVolumeReader::isIgnoredFile (  )  const [inline, virtual]

Should return TRUE if at least one file has been ignored during reading.

virtual SbBool SoVolumeReader::isRGBA (  )  const [inline, virtual]

Returns TRUE if the data set contains RGBA color values.

Reimplemented in SoVRAmFileReader, and SoVRRasterStackReader.

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

Should return TRUE if the reader is thread safe.


This function is called by VolumeViz when using the multiIO mode (LDM only). LDM multi-threaded data loading can only be used if this method returns TRUE.

Reimplemented in SoVRImageDataReader, SoLDMReader, SoVRDicomFileReader, SoVRMemoryReader, SoVRMrcFileReader, SoVRRasterStackReader, and SoVRTiffFileReader.

SbBool SoVolumeReader::isValidFloat ( const float  val  )  [protected]

Utility method to check if value is a valid IEEE 754 floating point number.

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

Deprecated:

Deprecated since Open Inventor 8500
Use SoBufferObject* readTile(int index, const SbBox3i32& tilePosition) instead.
virtual SoDEPRECATED SbBool SoVolumeReader::readTile ( int  index,
unsigned char *&  buffer,
const SbBox3i32 tilePosition 
) [inline, 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 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).

Deprecated:

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

Reimplemented in SoLDMReader.

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:
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:
the buffer containing the data of the tile, or NULL (or an empty buffer) in order to specify an undefined tile.

Reimplemented in SoLDMReader, and SoVRLdmFileBorderReader.

SbBool SoVolumeReader::readXSliceInTile ( int  index,
unsigned char *&  buffer,
const SbBox3i32 tilePosition,
const uint32_t &  slicePosition 
) [inline, virtual]

Read directly from the data source, an orthoslice on the X axis (Zaxis == 0) 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 tile in the associated volume, in voxel coordinates.
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).
slicePosition The slice position in the tile.

Reimplemented in SoLDMReader.

SbBool SoVolumeReader::readXTraceInTile ( int  index,
unsigned char *&  buffer,
const SbBox3i32 tilePosition,
const SbVec2i32 tracePosition 
) [inline, virtual]

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


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

Reimplemented in SoLDMReader.

SbBool SoVolumeReader::readYSliceInTile ( int  index,
unsigned char *&  buffer,
const SbBox3i32 tilePosition,
const uint32_t &  slicePosition 
) [inline, virtual]

Read directly from the data source, an orthoslice on the Y axis (Zaxis == 1) 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 tile in the associated volume, in voxel coordinates.
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).
slicePosition The slice position in the tile.

Reimplemented in SoLDMReader.

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

Read directly from the data source, an orthoslice on the Z axis (Zaxis == 2) 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 tile in the associated volume, in voxel coordinates.
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).
slicePosition The slice position in the tile.

Reimplemented in SoLDMReader.

static bool SoVolumeReader::registerVolumeReaderExtension ( const SbString fileExtension,
const SoType readerType 
) [static, protected]

Register an SoVolumeReader class to handle a file extension.

This method can be called for any class derived from SoVolumeReader in order to allow the getAppropriateReader() method to return an instance of the specified reader for files with the specified extension. VolumeViz automatically associates the built-in volume reader classes with their corresponding file extensions. For example, the extension "dic" is associated with SoVRDicomFileReader. This method can be used to associate a custom volume reader with an application data file extension. When this association exists, the application can simply set the SoVolumeData node's filename field and VolumeViz will create an instance of the associated volume reader to load the data.

This method can be called multiple times with different file extensions. Extension strings are not case sensitive and should not include the '.' character.

This method should normally be called from the volume reader's initClass() method and the unregisterVolumeReaderExtensions() method should be called from the exitClass() method.

If the given filename extension is already associated with another SoVolumeReader class then the call is ignored and false is returned.

Parameters:
fileExtension file extension to associate with the given readerType (without .)
readerType reader class type to associate with the given fileExtension
Returns:
true on success.
Since Open Inventor 9.4

virtual void SoVolumeReader::reloadTileMinMax (  )  [inline, virtual]
virtual void SoVolumeReader::restoreAllHandles (  )  [inline, virtual]

Restore resources that were closed by closeAllHandles().

Reimplemented in SoVRDicomFileReader.

SbBool SoVolumeReader::setDirectCoordSysAutoDetection ( SbBool  autoValue  )  [inline, virtual]

Sets whether or not the reader should automatically try to detect if the coordinate system used is direct or not.

The function will return FALSE if the feature is not supported by the current reader. Default is false.

Reimplemented in SoVRSegyFileReader.

SbBool SoVolumeReader::setDirectCoorSys ( SbBool  directCoord  )  [inline, virtual]

Specify if the coordinate system used is direct or not.

The function will return FALSE if the feature is not supported by the current reader. Default is true.

Reimplemented in SoVRSegyFileReader.

virtual int SoVolumeReader::setFilename ( const SbString filename  )  [virtual]

Specifies the path of the file.

Returns 0 for success. Any other return value indicates failure.

Reimplemented in SoVRLdmFileBorderReader, SoVRDicomFileReader, SoVRMrcFileReader, SoVRRasterStackReader, SoVRSegyFileReader, SoVRTiffFileReader, and SoVRVoxFileReader.

virtual SbBool SoVolumeReader::setInputDataRange ( SbBool  doChange,
double  min,
double  max 
) [virtual]

Requests that the input be converted from the specified range to the range depending on the output data type.

This allows, for instance, if the output data type is unsigned byte, conversion of float data from range [min,max] to range [0,255]. If doChange is FALSE no range conversion is applied. Always returns TRUE.

Reimplemented in SoVRSegyFileReader.

virtual SbBool SoVolumeReader::setOutputDataType ( SbBool  doChange,
SoDataSet::DataType  outputType 
) [virtual]

Sets the output data type.

Returns FALSE if the reader does not support this feature. If the reader does support this feature and doChange is set to TRUE, data is converted before being returned (by getSubSlice() for instance). If doChange is set to FALSE, data is not converted and is returned as is.

Reimplemented in SoVRDicomFileReader, and SoVRSegyFileReader.

void SoVolumeReader::setRectilinearCoordinates ( const float *  x,
const float *  y,
const float *  z 
)

Sets rectilinear coordinates for the data set.

void SoVolumeReader::setRGBA ( const SbBool  flag  )  [inline]

Specifies if data must be considered as RGBA.

void SoVolumeReader::swapBytes ( int *  intPtr,
int  sizeBytes 
) [protected]

Utility method to convert an integer into the correct architecture (little/big endian).

void SoVolumeReader::swapBytesN ( void *  buffer,
int  numElements,
int  numBytesPerElement 
) [protected]

Utility method to swap bytes of each element of an array of numElements elements.

The size of each element is numBytesPerElement.

static bool SoVolumeReader::unregisterVolumeReaderExtensions ( const SoType readerType  )  [static, protected]

Unregister all filename extensions associated with the specified SoVolumeReader class.

This method must be called by any SoVolumeReader derived class that previously called registerVolumeReaderExtension().

This method should normally be called once in the volume reader's exitClass() method. It returns false if no filename extension was registered for the specified class.

Since Open Inventor 9.4


Member Data Documentation

SoDEPRECATED SbBool SoVolumeReader::m_dataConverted [protected]

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

Open Inventor Toolkit reference manual, generated on 4 Sep 2023
Copyright © Thermo Fisher Scientific All rights reserved.
https://www.openinventor.com/