Abstract base class for volume data set readers. More...
#include <LDM/readers/SoVolumeReader.h>
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 } |
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. | |
SoVolumeReader () | |
Constructor. | |
virtual ReadError | getDataChar (SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim)=0 |
Gets the characteristics (file header) of the data volume. | |
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. | |
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. | |
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 | isDataConverted () const |
Returns TRUE if the data is already organized in tiles for the LDM module. | |
virtual void | reloadTileMinMax () |
virtual SbBool | getTileSize (SbVec3i32 &size) |
Returns tile dimensions in voxels when using data stored in tiles. | |
virtual SoBufferObject * | readTile (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 data source, a trace inside a tile. | |
virtual SbBool | readYSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition) |
Read directly from the data source, an orthoslice on the Y axis (Zaxis == 1) inside a tile. | |
virtual SbBool | readZSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition) |
Read directly from the data source, an orthoslice on the Z axis (Zaxis == 2) inside a tile. | |
virtual SbBool | readXSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition) |
Read directly from the data source, an orthoslice on the X axis (Zaxis == 0) inside a tile. | |
virtual SbBool | isThreadSafe () const |
Should return TRUE if the reader is thread safe. | |
virtual SbBool | isIgnoredFile () const |
Should return TRUE if at least one file has been ignored during reading. | |
virtual SbString | getOriginalFilename () const |
Returns original file name from which the data has been converted to LDM format if stored in file. | |
virtual SbBool | getMinMax (int64_t &min, int64_t &max) |
Returns min and max for integer data type, if available. | |
virtual SbBool | getMinMax (double &min, double &max) |
Returns min max for float data type, if available. | |
virtual SbBool | getHistogram (std::vector< int64_t > &numVox) |
Returns histogram if available. | |
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. | |
virtual SbVec2d | getTileMinMax (int index) const |
Returns the minimum and maximum data values for the given tile. | |
virtual SoVolumeReader::ReaderType | getReaderType () |
Returns the reader type. | |
virtual SoVolumeWriter * | getConfiguredWriter () |
Returns a volume writer that corresponds to this reader (same format, parameters, etc). | |
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. | |
virtual void | closeAllHandles () |
Close all resources that are locked by the reader. | |
virtual void | restoreAllHandles () |
Restore resources that were closed by closeAllHandles(). | |
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 SoField * | getField (const SbName &fieldName) const |
Returns a the field of this object whose name is fieldName. | |
virtual SoField * | getEventIn (const SbName &fieldName) const |
Returns a the eventIn with the given name. | |
virtual SoField * | getEventOut (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 SoVolumeReader * | getAppropriateReader (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. | |
Protected Member Functions | |
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 | |
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. | |
Deprecated | |
SoDEPRECATED SbBool | m_dataConverted |
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. | |
virtual SoDEPRECATED int | getBorderFlag () |
Returns border (overlap) value if stored in file. | |
virtual SoDEPRECATED SbBool | getMinMax (int &min, int &max) |
Returns min max if stored in file. | |
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 method getDataChar(). 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.
File extension | Reader class | Description |
.am | SoVRAmFileReader | Avizo Mesh file format |
.dc3, .dic, .dicom | SoVRDicomFileReader | DICOM file format |
.fld | SoVRAvsFileReader | AVS field file format |
.lda or .ldm | SoVRLdmFileReader | LDM file format |
.mrc | SoVRMrcFileReader | MRC file format |
.sgy or .segy | SoVRSegyFileReader | SEG Y rev 1 file format |
.vol | SoVRVolFileReader | Vol file format |
.vox | SoVRVoxFileReader | Vox file format |
.lst | SoVRRasterStackReader | Lst file format (stack of images) |
File format notes:
Note: '3D TIFF' files (multiple images in one file) are not currently supported.
SoDataSet, SoVolumeData, SoConverter
Definition at line 252 of file SoVolumeReader.h.
enum SoVolumeReader::Axis |
Which axis to handle.
Enumerator | |
---|---|
X | |
Y | |
Z |
Definition at line 293 of file SoVolumeReader.h.
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. |
Definition at line 766 of file SoVolumeReader.h.
Read error.
Definition at line 261 of file SoVolumeReader.h.
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. |
Definition at line 662 of file SoVolumeReader.h.
SoVolumeReader::SoVolumeReader | ( | ) |
Constructor.
|
protectedvirtual |
Destructor.
|
staticprotected |
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.
|
staticprotected |
Utility method that returns an integer from sizeBytes bytes starting at address ptr.
Also takes into account the machine architecture (little/big endian).
|
inlinevirtual |
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.
Definition at line 818 of file SoVolumeReader.h.
|
protected |
Returns the size of the file when file I/O is handled by this class.
|
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.
|
inlinevirtual |
Returns border (overlap) value if stored in file.
Reimplemented in SoLDMReader, and SoVRLdmFileBorderReader.
Definition at line 889 of file SoVolumeReader.h.
|
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 |
Returns the type identifier for this class.
|
virtual |
Returns a volume writer that corresponds to this reader
(same format, parameters, etc).
If no writer can be created, NULL is returned.
Notes:
For example:
Reimplemented in SoVRImageDataReader, SoLDMReader, and SoVRMemoryReader.
CoordinateType SoVolumeReader::getCoordinateType | ( | ) |
Returns coordinate type used by the data set.
|
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, SoVRXtFileReader, and SoLDMReader.
|
inlinevirtual |
Return whether the coordinate system used is direct or not.
Definition at line 1211 of file SoVolumeReader.h.
|
inlinevirtual |
Return automatic detection value.
Definition at line 1199 of file SoVolumeReader.h.
SbString SoVolumeReader::getFilename | ( | ) | const |
Returns the path of the file.
|
inlinevirtual |
Returns histogram if available.
If not, return false.
Reimplemented in SoLDMReader, and SoVRLdmFileReader.
Definition at line 1187 of file SoVolumeReader.h.
|
inlinevirtual |
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.
Definition at line 1181 of file SoVolumeReader.h.
|
inlinevirtual |
Returns min max if stored in file.
Reimplemented in SoLDMReader, and SoVRLdmFileReader.
Definition at line 1163 of file SoVolumeReader.h.
|
inlinevirtual |
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.
Definition at line 1169 of file SoVolumeReader.h.
|
inlinevirtual |
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.
Definition at line 348 of file SoVolumeReader.h.
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:
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.
|
inlinevirtual |
Returns original file name from which the data has been converted to LDM format if stored in file.
Reimplemented in SoLDMReader.
Definition at line 560 of file SoVolumeReader.h.
|
inlinevirtual |
Returns the reader type.
Reimplemented in SoLDMReader, SoVRAmFileReader, SoVRAvsFileReader, SoVRDicomFileReader, SoVRGenericFileReader, SoVRMemoryReader, SoVRRasterStackReader, SoVRSegyFileReader, SoVRTiffFileReader, SoVRVolFileReader, SoVRVoxFileReader, and SoVRMrcFileReader.
Definition at line 694 of file SoVolumeReader.h.
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 |
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
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, SoLDMReader, SoVRMemoryReader, SoVRTiffFileReader, and SoVRMrcFileReader.
|
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.
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.
Reimplemented in SoVRImageDataReader, SoLDMReader, SoLDMReader, SoVRLdmFileReader, SoVRAmFileReader, SoVRAvsFileReader, SoVRDicomFileReader, SoVRGenericFileReader, SoVRMemoryReader, SoVRRasterStackReader, SoVRSegyFileReader, SoVRTiffFileReader, SoVRVolFileReader, SoVRVoxFileReader, SoVRXtFileReader, and SoVRMrcFileReader.
|
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:
Default implementation returns SbVec2d(numeric_limits<double>::max(),-numeric_limits<double>::max())
index | The fileId of the tile. |
Reimplemented in SoLDMReader.
Returns tile dimensions in voxels when using data stored in tiles.
Return FALSE if data is not stored in tiles.
Reimplemented in SoVRLdmFileBorderReader, and SoLDMReader.
|
virtual |
Returns the type identifier for this specific instance.
Implements SoTypedObject.
Reimplemented in SoVRImageDataReader, SoLDMReader, SoVRLdmFileBorderReader, SoVRLdmFileReader, SoVRAmFileReader, SoVRAvsFileReader, SoVRDicomFileReader, SoVRGenericFileReader, SoVRMemoryReader, SoVRMrcFileReader, SoVRRasterStackReader, SoVRSegyFileReader, SoVRTiffFileReader, SoVRVolFileReader, SoVRVoxFileReader, and SoVRXtFileReader.
|
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().
|
inlinevirtual |
Should return TRUE if at least one file has been ignored during reading.
Definition at line 1175 of file SoVolumeReader.h.
|
inlinevirtual |
Returns TRUE if the data set contains RGBA color values.
Reimplemented in SoVRAmFileReader, and SoVRRasterStackReader.
Definition at line 800 of file SoVolumeReader.h.
|
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, SoVRLdmFileBorderReader, SoVRLdmFileReader, SoVRDicomFileReader, SoVRMemoryReader, SoVRRasterStackReader, SoVRTiffFileReader, and SoVRMrcFileReader.
|
staticprotected |
Utility method to check if value is a valid IEEE 754 floating point number.
|
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.
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). |
Reimplemented in SoLDMReader, SoLDMReader, and SoVRLdmFileBorderReader.
|
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 in SoLDMReader.
|
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 in SoLDMReader, and SoLDMReader.
Definition at line 871 of file SoVolumeReader.h.
|
inlinevirtual |
Read directly from the data source, an orthoslice on the X axis (Zaxis == 0) inside a tile.
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.
Definition at line 1151 of file SoVolumeReader.h.
|
inlinevirtual |
Read directly from the data source, a trace inside a tile.
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.
Definition at line 1145 of file SoVolumeReader.h.
|
inlinevirtual |
Read directly from the data source, an orthoslice on the Y axis (Zaxis == 1) inside a tile.
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.
Definition at line 1157 of file SoVolumeReader.h.
|
virtual |
Read directly from the data source, an orthoslice on the Z axis (Zaxis == 2) inside a tile.
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.
|
staticprotected |
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.
fileExtension | file extension to associate with the given readerType (without .) |
readerType | reader class type to associate with the given fileExtension |
|
inlinevirtual |
Definition at line 451 of file SoVolumeReader.h.
|
inlinevirtual |
Restore resources that were closed by closeAllHandles().
Reimplemented in SoVRDicomFileReader.
Definition at line 823 of file SoVolumeReader.h.
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.
Definition at line 1193 of file SoVolumeReader.h.
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.
Definition at line 1205 of file SoVolumeReader.h.
|
virtual |
Specifies the path of the file.
Returns 0 for success. Any other return value indicates failure.
Reimplemented in SoVRLdmFileBorderReader, SoVRDicomFileReader, SoVRRasterStackReader, SoVRSegyFileReader, SoVRTiffFileReader, SoVRVoxFileReader, and SoVRMrcFileReader.
|
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 |
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.
|
inline |
Specifies if data must be considered as RGBA.
Definition at line 807 of file SoVolumeReader.h.
|
staticprotected |
Utility method to convert an integer into the correct architecture (little/big endian).
|
staticprotected |
Utility method to swap bytes of each element of an array of numElements elements.
The size of each element is numBytesPerElement.
|
staticprotected |
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.
|
protected |
Definition at line 1065 of file SoVolumeReader.h.