Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
SoVRVolFileReader Class Reference

Loader for files in the VOL data format. More...

#include <VolumeViz/readers/SoVRVolFileReader.h>

Inheritance diagram for SoVRVolFileReader:
SoVolumeReader

Public Member Functions

void setUserData (void *data)
 
void getDataChar (SbBox3f &size, SoVolumeData::DataType &type, SbVec3s &dim)
 
virtual void getSubSlice (SbBox2s &subslice, int slicenumber, void *data)
 
- Public Member Functions inherited from SoVolumeReader
virtual int getNumSignificantBits (void)
 
virtual SbBool getSubVolume (SbBox3s &volume, void *voxels)
 
virtual SbBool getSubVolume (const SbBox3s &volume, const SbVec3s subsamplelevel, void *&voxels)
 
virtual SbBool getSubVolumeInfo (SbBox3s &volume, SbVec3s reqsubsamplelevel, SbVec3s &subsamplelevel, SoVolumeReader::CopyPolicy &policy)
 
SbVec3s getNumVoxels (SbVec3s realsize, SbVec3s subsamplinglevel) const
 
SbVec3s getSizeToAllocate (SbVec3s realsize, SbVec3s subsamplinglevel) const
 
int setFilename (const char *filename)
 

Friends

class SoVRVolFileReaderP
 

Additional Inherited Members

- Public Types inherited from SoVolumeReader
enum  CopyPolicy { COPY, NO_COPY, NO_COPY_AND_DELETE }
 
- Protected Member Functions inherited from SoVolumeReader
void * getBuffer (int64_t offset, unsigned int size)
 
int bytesToInt (unsigned char *ptr, int sizeBytes)
 
void swapBytes (int *intPtr, int sizeBytes)
 
int64_t fileSize (void)
 
- Protected Attributes inherited from SoVolumeReader
void * m_data
 

Detailed Description

Loader for files in the VOL data format.

This class reads volume data from files in the data format used in the book «Introduction To Volume Rendering», by Lichtenbelt, Crane and Naqvi (Hewlett-Packard / Prentice Hall), ISBN 0-13-861683-3.

The format is just a simple header, before the voxel values are laid out in raw, uncompressed form:

struct vol_header {
  uint32_t magic_number;
  uint32_t header_length;
  uint32_t width;
  uint32_t height;
  uint32_t images;
  uint32_t bits_per_voxel;
  uint32_t index_bits;
  float scaleX, scaleY, scaleZ;
  float rotX, rotY, rotZ;
};

Volume data will by default be normalized to be within a 2x2x2 unit dimensions cube. As an example, if you set up a voxel data set of dimensions 100x400x200, this will be rendered within a bounding box of <-0.25, -1, -0.5> to <0.25, 1, 0.5>. Notice that the largest dimension (the Y dimension in this example) will be made to fit within unit size 2, and the other dimensions will be scaled accordingly.

The scale vector (if present in the header) will subsequently be used on the resulting normalized volume dimensions.

You may use SoVolumeData::setVolumeSize() to force a different unit size box around the volume, or you can simply use the standard Coin transformation nodes, like e.g. SoScale, to accomplish this.

For more information about how the data will be mapped to the world coordinate system, see the documentation of SoVolumeData::setVolumeData().

Member Function Documentation

◆ setUserData()

void SoVRVolFileReader::setUserData ( void *  data)
virtual

data should be a pointer to a character string with the full filename of a file in VOL-format.

Reimplemented from SoVolumeReader.

◆ getDataChar()

void SoVRVolFileReader::getDataChar ( SbBox3f &  size,
SoVolumeData::DataType &  type,
SbVec3s &  dim 
)
virtual

Returns information about the volume data contained in a volume reader. Sub-classes, i.e. the non-abstract readers, needs to implement this function.

size is set to the "world size" of the volume, in unit coordinates.

type is set to either SoVolumeData::UNSIGNED_BYTE or SoVolumeData::UNSIGNED_SHORT, to signify that the voxel values are either 8-bit or 16-bit, respectively.

dim gives the volume dimensions in voxel coordinates, i.e. the number of rows, columns and stacks of voxels along the internal 3 coordinate axes of the volume.

Implements SoVolumeReader.

◆ getSubSlice()

void SoVRVolFileReader::getSubSlice ( SbBox2s &  subslice,
int  slicenumber,
void *  data 
)
virtual

Extract a subslice from the volume (which may still reside solely on disk). Sub-classes, i.e. the non-abstract readers, needs to implement this function.

Implements SoVolumeReader.


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