Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoVRRasterStackReader Class Reference

VolumeViz Raster stack reader. More...

#include <VolumeViz/readers/SoVRRasterStackReader.h>

+ Inheritance diagram for SoVRRasterStackReader:

Public Types

enum  ChannelSelection {
  MAX_CHANNEL = 0 ,
  LUMINANCE = 1 ,
  RED_CHANNEL = 2 ,
  GREEN_CHANNEL = 3 ,
  BLUE_CHANNEL = 4 ,
  ALPHA_CHANNEL = 5 ,
  ALL_CHANNELS = 11
}
 Channel selection. 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.
 
 SoVRRasterStackReader ()
 Constructor.
 
virtual int setFilename (const SbString &filename)
 Specifies the path of the descriptive (.lst) file.
 
SbBool setFilenameList (const SbStringList &filenameList)
 Specify a list of files to load.
 
SbBool setDirectory (const SbString &directory)
 Specify a directory containing image files to load (jpg, png, tif,...).
 
virtual ReadError getDataChar (SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim) override
 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.
 
void setSize (SbBox3f &size)
 Defines the bounding box size in physical units of the data set.
 
void setChannelSelection (ChannelSelection cs)
 Selects channels to be used for data rendering.
 
virtual SoVolumeReader::ReaderType getReaderType ()
 Returns the reader type.
 
virtual SbBool isRGBA () const
 Returns TRUE if the data set contains RGBA color values.
 
virtual SbBool isThreadSafe () const
 Return true as this reader is thread safe.
 
- 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.
 
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.
 
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 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 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 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 SoVolumeWritergetConfiguredWriter ()
 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.
 
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().
 
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.
 
- 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.
 

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

VolumeViz Raster stack reader.

Reader for a volume defined by a "stack" of images.

A raster stack is a list of raster images (that is, containing pixels, not vector graphics) of the same size so as to create a voxel volume. This reader uses a descriptive file (.lst) including a header and a list of all the raster image filenames. The file is structured as follows:

 Parameters {
   Raw 0
   Dims 2048 2048 100
   Size 10.000000 10.000000 10.000000 1250.000000 1250.000000 500.000000
   Channel 2
 }

 C:/tmp/tiff/img00000.tiff
 C:/tmp/tiff/img00001.tiff
 C:/tmp/tiff/img00002.tiff
 C:/tmp/tiff/img00003.tiff
 C:/tmp/tiff/img00004.tiff
 ....

OR

 Parameters {
   Raw 1
   Endianess 1
   HeaderLength 256
   PrimType 0
   Binary 0
   Dims 1024 1024 300
   Size 50.000000 50.000000 50.000000 1050.000000 1050.000000 250.000000
   Channel 1
 }

 img00000.raw
 img00001.raw
 img00002.raw
 img00003.raw
 img00004.raw
 ....

Header Description

  • Raw: 0 (formatted data file), 1 (raw data file).
  • Endianess: 0 (little endian), 1 (big endian) (for raw data only).
  • HeaderLength: length of header in characters/bytes (for raw data only).
  • PrimType: See SoDataSet::DataType (for raw data only).
  • Binary: 0 (ASCII), 1 (binary) (for raw data only).
  • Dims: height, width, depth in pixels of the stack.
  • Size: Xmin Ymin Zmin Xmax Ymax Zmax, bounding box of the data set.
  • Channel: See SoVRRasterStackReader::ChannelSelection.

Images in the list can be of different formats (uses all files formats supported by Open Inventor). VolumeViz can load image data in most common image formats including BMP, DDS, GIF, JPEG, JPEG2000, PNG and TIFF.

If images are different sizes, RD_UNSUPPORTED_DATA_TYPE_ERROR is returned by getDataChar.

The file path can be relative or absolute.

It is mandatory to have a line break after each property and/or filename otherwise VolumeViz could be unable to read the file properly.

Definition at line 114 of file SoVRRasterStackReader.h.

Member Enumeration Documentation

◆ ChannelSelection

Channel selection.

Enumerator
MAX_CHANNEL 

Maximum of all channels.

LUMINANCE 

Luminance.

RED_CHANNEL 

Red channel.

GREEN_CHANNEL 

Green channel.

BLUE_CHANNEL 

Blue channel.

ALPHA_CHANNEL 

Alpha channel.

ALL_CHANNELS 

All channels combined.

Definition at line 121 of file SoVRRasterStackReader.h.

Constructor & Destructor Documentation

◆ SoVRRasterStackReader()

SoVRRasterStackReader::SoVRRasterStackReader ( )

Constructor.

Member Function Documentation

◆ getClassTypeId()

static SoType SoVRRasterStackReader::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getDataChar()

virtual ReadError SoVRRasterStackReader::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.

◆ getReaderType()

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

Returns the reader type.

Reimplemented from SoVolumeReader.

Definition at line 211 of file SoVRRasterStackReader.h.

◆ getSubSlice()

virtual void SoVRRasterStackReader::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.

◆ getTypeId()

virtual SoType SoVRRasterStackReader::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoVolumeReader.

◆ isRGBA()

virtual SbBool SoVRRasterStackReader::isRGBA ( ) const
virtual

Returns TRUE if the data set contains RGBA color values.

Reimplemented from SoVolumeReader.

◆ isThreadSafe()

virtual SbBool SoVRRasterStackReader::isThreadSafe ( ) const
virtual

Return true as this reader is thread safe.

Reimplemented from SoVolumeReader.

◆ setChannelSelection()

void SoVRRasterStackReader::setChannelSelection ( ChannelSelection  cs)
inline

Selects channels to be used for data rendering.

Definition at line 206 of file SoVRRasterStackReader.h.

◆ setDirectory()

SbBool SoVRRasterStackReader::setDirectory ( const SbString directory)

Specify a directory containing image files to load (jpg, png, tif,...).

Each image file in this folder with the exact same dimension and the exact same number of components will be loaded.

Notes:

  • The directory should contain only valid image files.
  • The file format is automatically detected.
  • If the images are RGB or RGBA, the volume is loaded as RGBA data. (It is not possible to load a single component using this method.)
Parameters
directoryThe directory from which to load files.
Returns
true if successful.

Since Open Inventor 9.5.0

◆ setFilename()

virtual int SoVRRasterStackReader::setFilename ( const SbString filename)
virtual

Specifies the path of the descriptive (.lst) file.

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

Reimplemented from SoVolumeReader.

◆ setFilenameList()

SbBool SoVRRasterStackReader::setFilenameList ( const SbStringList filenameList)

Specify a list of files to load.

All the specified files should be part of the same volume data set.

Returns
true if successful.

Since Open Inventor 9.7

◆ setSize()

void SoVRRasterStackReader::setSize ( SbBox3f size)
inline

Defines the bounding box size in physical units of the data set.

Definition at line 201 of file SoVRRasterStackReader.h.


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