Abstract base class for volume data writer. More...
#include <LDM/writers/SoVolumeWriter.h>
Public Types | |
enum | WordFormat { WF_BIG_ENDIAN = 0, WF_LITTLE_ENDIAN = 1 } |
Public Member Functions | |
virtual SoType | getTypeId () const |
virtual SbBool | initialize () |
virtual SbBool | closeAllHandles () |
virtual SbBool | restoreAllHandles () |
virtual SbBool | isDataConverted () const =0 |
virtual SbBool | writeTile (const SoLDMTileID &tileId, SoBufferObject *buffer) |
virtual SbBool | writeSubSlice (int sliceIndex, const SbBox2i32 &subSlice, SoBufferObject *buffer) |
virtual SbBool | finish () |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Public Attributes | |
SoSFBox3f | extent |
SoSFVec3i32 | dimension |
SoSFEnum | dataType |
SoSFEnum | wordFormat |
Base class used to write volume data. Data are generally organised by tiles (like in LDM) or by slices (like in DICOM).
The isDataConverted() method must be reimplemented in derived classes and return TRUE if the data is organized in tiles. In this case, the writeTile() method MUST be implemented and will be used to write data.
If isDataConverted() returns FALSE, the writeSubSlice() method MUST be implemented and will be used to write data.
SoVRLdmFileWriter* writer = new SoVRLdmFileWriter(); // set parameters writer->headerFilename = "myFile.ldm"; writer->dimension.setValue( 128, 128, 128 ); writer->extent.setValue( -1,-1,-1, 1,1,1 ); // Initialize writer->initialize(); // Write data if ( writer->isDataConverted() ) { SoLDMTileID tileID = 0; SoCpuBufferObject* tileBuffer = new SoCpuBufferObject(); writer->writeTile( tileID, tileBuffer ); } else { int sliceIndex = 0; SbBox2i32 subSlice( 0,0, 128,128 ); SoCpuBufferObject* sliceBuffer = new SoCpuBufferObject(); writer->writeSubSlice( sliceIndex, subSlice, sliceBuffer ); } // Finalize writer->finish();
SoVRLdmFileWriter, SoVRMemoryWriter
virtual SbBool SoVolumeWriter::closeAllHandles | ( | ) | [virtual] |
Close all ressources that are locked by the writer so that someone else can read or write to them.
For example, if the writer write to a file, this method must close the file so that someone else can re-open it in read mode.
Reimplemented in SoVRLdmFileWriter.
virtual SbBool SoVolumeWriter::finish | ( | ) | [virtual] |
Finish writing the file, free ressources, .
.. depending on kind of writer.
Reimplemented in SoVRLdmFileWriter.
static SoType SoVolumeWriter::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoFieldContainer.
Reimplemented in SoVRLdmFileWriter, and SoVRMemoryWriter.
virtual SoType SoVolumeWriter::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Implements SoTypedObject.
Reimplemented in SoVRLdmFileWriter, and SoVRMemoryWriter.
virtual SbBool SoVolumeWriter::initialize | ( | ) | [virtual] |
Initialize writer.
Allocates memory and other resources depending on the kind of writer. By default do nothing.
Reimplemented in SoVRLdmFileWriter, and SoVRMemoryWriter.
virtual SbBool SoVolumeWriter::isDataConverted | ( | ) | const [pure virtual] |
Returns TRUE if the data is already organized in tiles for the LDM module.
In other words, all writers that directly support the writeTile() method should return TRUE from isDataConverted.
If TRUE is returned, VolumeViz will use the writeTile method and will not call writeSubVolume() or writeSubSlice().
Must be reimplemented in children classes.
Implemented in SoVRLdmFileWriter, and SoVRMemoryWriter.
virtual SbBool SoVolumeWriter::restoreAllHandles | ( | ) | [virtual] |
Restore ressources that was closed by closeAllHandles.
Reimplemented in SoVRLdmFileWriter.
virtual SbBool SoVolumeWriter::writeSubSlice | ( | int | sliceIndex, | |
const SbBox2i32 & | subSlice, | |||
SoBufferObject * | buffer | |||
) | [virtual] |
Writes the data contained in the specified subslice.
This function must be called only if isDataConverted() return FALSE.
Must be reimplemented in children classes.
Reimplemented in SoVRMemoryWriter.
virtual SbBool SoVolumeWriter::writeTile | ( | const SoLDMTileID & | tileId, | |
SoBufferObject * | buffer | |||
) | [virtual] |
Given a tileID, writes a tile if the data is organized in tiles (see SoLDMTileID).
This function must be called only if isDataConverted() return TRUE.
Must be reimplemented in children classes.
Please refer to SoLDMTileID and SoLDMTopoOctree for relation between tileId and tile position.
Reimplemented in SoVRLdmFileWriter.
Type of input data (that will be given in the writeXXX method) Use enum SoDataSet::DataType.
Default is UNSIGNED_BYTE.
Dimension of dataset, in voxels.
Default is empty.
Extent of dataset.
Default is (-1, -1, -1, 1, 1, 1)
Endianess of data.
Use enum WordFormat. Default is current machine endianess.