SIMVoleon
2.1.0
Coin3D volume rendering library
|
Loader for files in the VOL data format. More...
#include <VolumeViz/readers/SoVRVolFileReader.h>
Public Member Functions | |
void | getDataChar (SbBox3f &size, SoVolumeData::DataType &type, SbVec3s &dim) |
virtual void | getSubSlice (SbBox2s &subslice, int slicenumber, void *data) |
void | setUserData (void *data) |
Public Member Functions inherited from SoVolumeReader | |
virtual int | getNumSignificantBits (void) |
SbVec3s | getNumVoxels (SbVec3s realsize, SbVec3s subsamplinglevel) const |
SbVec3s | getSizeToAllocate (SbVec3s realsize, SbVec3s subsamplinglevel) const |
virtual SbBool | getSubVolume (const SbBox3s &volume, const SbVec3s subsamplelevel, void *&voxels) |
virtual SbBool | getSubVolume (SbBox3s &volume, void *voxels) |
virtual SbBool | getSubVolumeInfo (SbBox3s &volume, SbVec3s reqsubsamplelevel, SbVec3s &subsamplelevel, SoVolumeReader::CopyPolicy &policy) |
int | setFilename (const char *filename) |
Additional Inherited Members | |
Public Types inherited from SoVolumeReader | |
enum | CopyPolicy { COPY , NO_COPY , NO_COPY_AND_DELETE } |
Protected Member Functions inherited from SoVolumeReader | |
int | bytesToInt (unsigned char *ptr, int sizeBytes) |
int64_t | fileSize (void) |
void * | getBuffer (int64_t offset, unsigned int size) |
void | swapBytes (int *intPtr, int sizeBytes) |
Protected Attributes inherited from SoVolumeReader | |
void * | m_data |
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().
|
virtual |
Returns information about the volume data contained in a volume reader. Sub-classes, i.e. the non-abstract readers, need 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.
|
virtual |
Extract a subslice from the volume (which may still reside solely on disk). Sub-classes, i.e. the non-abstract readers, need to implement this function.
Implements SoVolumeReader.
|
virtual |
data should be a pointer to a character string with the full filename of a file in VOL-format.
Reimplemented from SoVolumeReader.