Base class for LDM data set readers More...
#include <LDM/readers/SoLDMReader.h>
Classes | |
struct | Descriptor |
Public Types | |
enum | SoLDMError { LDM_NO_ERROR, LDM_FILE_NOT_FOUND, LDM_XML_ROOT_START_TAG_NOT_FOUND, LDM_XML_ROOT_END_TAG_NOT_FOUND, LDM_ALTERNATE_FILE_NOT_FOUND, LDM_XML_PARSING_ERROR, LDM_SIZE_TAG_MISSING, LDM_COMPLETION_FILE_NOT_FOUND, LDM_RD_NO_ERROR, LDM_RD_FILE_NOT_FOUND_ERROR, LDM_RD_UNSUPPORTED_DATA_TYPE_ERROR, LDM_RD_UNKNOWN_ERROR } |
Public Member Functions | |
virtual SoType | getTypeId () const |
SoLDMReader () | |
virtual SbBox3f | getSize () |
virtual SbVec3i32 | getDimension () |
virtual SbBool | getTileSize (SbVec3i32 &tile) |
virtual SbBool | getBbox (int fileId, SbBox3f &box) |
virtual SbBool | getCenter (int fileId, SbVec3f ¢er) |
virtual ReadError | getDataChar (SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim) |
void | getSubSlice (const SbBox2i32 &subSlice, int sliceNumber, void *data) |
virtual SoBufferObject * | readTile (int index, const SbBox3i32 &tilePosition) |
virtual SbBool | readXTraceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const SbVec2i32 &tracePosition) |
virtual SbBool | readXSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition) |
virtual SbBool | readYSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition) |
virtual SbBool | readZSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition) |
virtual SbBool | getMinMax (int64_t &min, int64_t &max) |
virtual SbBool | getMinMax (double &min, double &max) |
virtual SbBool | getHistogram (std::vector< int64_t > &numVox) |
virtual bool | isLittleEndian () |
virtual SbString | getOriginalFilename () const |
virtual SbXmlTag | getXmlTag (const char *tagName) |
virtual ReaderType | getReaderType () |
virtual SoVolumeWriter * | getConfiguredWriter () |
virtual int | handleHeader (TiXmlElement *) |
virtual SbBool | isThreadSafe () const |
virtual SbVec2d | getTileMinMax (int fileId) const |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Deprecated | |
| |
virtual SoDEPRECATED SbBool | getTileSize (SbVec3s &size) |
virtual SoDEPRECATED int | getBorderFlag () |
virtual SoDEPRECATED SbBool | readTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition) |
virtual SoDEPRECATED SbBool | getMinMax (int &min, int &max) |
This is the base class for specific LDM readers.
See SoVRLdmFileReader for a specific implementation.
This class retrieves the XML tags from an LDM header file (usually a .ldm file) that are general to all LDM files, i.e. the tags that are interpreted by VolumeViz.
Custom tags for classes derived from SoLDMReader can be retrieved by overriding the handleHeader method.
General tags common for all LDM Readers are:
<?xml version="1.0" encoding="utf-8" ?> <VolumeInformation> <OriginalFile>3dhead.vol</OriginalFile> <Size> //or dimension// <U>256</U> <V>256</V> <W>109</W> </Size> <TileSize> <U>64</U> <V>64</V> <W>64</W> </TileSize> <DataType> <Type>n</Type><Num>m</Num> ... <DataType> <DataFilename>3DHEAD.dat</DataFilename>//separate datafile// <WordFormat>1</WordFormat>//data stored in little/big endian// <CompletionFilename>3dhead.fcp</CompletionFilename>//if the conversion was interrupted, refer to this file <RectilinearMapping> <mapping axis="U"> <map>-180</map> <map>-160</map> ... one entry per voxel on U axis </mapping> ... repeat for V, W axis </RectilinearMapping>
Note that the minimum tags that MUST be in the LDM header are <Size> or <Dimension> and <TileSize>. Otherwise the reader will throw a "tag missing" exception.
LDM Reader error code.
SoLDMReader::SoLDMReader | ( | ) |
Constructor.
Returns the bounding box of the data associated with the specified file ID.
The file ID corresponds to the tile ID in an LDM data file. If returns FALSE, not supported.
virtual SoDEPRECATED int SoLDMReader::getBorderFlag | ( | ) | [virtual] |
Returns the border flag.
If 0, tiles do not overlap. If not 0, they do.
Reimplemented from SoVolumeReader.
Reimplemented in SoVRLdmFileBorderReader.
Returns the center of the data associated with the specified file ID.
If returns FALSE, not supported.
static SoType SoLDMReader::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoVolumeReader.
Reimplemented in SoVRLdmFileBorderReader, and SoVRLdmFileReader.
virtual SoVolumeWriter* SoLDMReader::getConfiguredWriter | ( | ) | [virtual] |
Returns a volume writer that corresponds to this reader
(same format, parameters, etc). If no writer can be created, NULL is returned.Notes:
MyVolumeReader* reader = new MyVolumeReader(); reader->setFilename( "someFile.dat" ); MyVolumeWriter* writer1 = (MyVolumeWriter*)reader->getConfiguredWriter(); // This writer will write to "someFile.dat" reader->setFilename( "someOtherFile.dat" ); // The writer will still write to "someFile.dat" writer1->setFilename( "stillAnotherFile.dat" ); SoVolumeWriter* writer2 = reader->getConfiguredWriter(); // writer2 will write to "someOtherFile.dat", because the // reader is configured to read from "someOtherFile.dat"
Reimplemented from SoVolumeReader.
virtual ReadError SoLDMReader::getDataChar | ( | SbBox3f & | size, | |
SoDataSet::DataType & | type, | |||
SbVec3i32 & | dim | |||
) | [virtual] |
Gets the characteristics (file header) of the data volume.
size is the size of the actual volume. type is the type of the data. dim is the dimension of the data.
Implements SoVolumeReader.
Reimplemented in SoVRLdmFileBorderReader, and SoVRLdmFileReader.
virtual SbVec3i32 SoLDMReader::getDimension | ( | ) | [virtual] |
Returns the dimension of the data.
SbBool SoLDMReader::getHistogram | ( | std::vector< int64_t > & | numVox | ) | [inline, virtual] |
Returns the distribution of data values, i.e., the number of voxels per data value.
numVox(0) is the number of voxels with value 0, numVox(1) is the number of voxels with value 1, and so on.
Reimplemented from SoVolumeReader.
Reimplemented in SoVRLdmFileReader.
SbBool SoLDMReader::getMinMax | ( | int & | min, | |
int & | max | |||
) | [inline, virtual] |
Returns the minimum and maximum data values.
Reimplemented from SoVolumeReader.
Reimplemented in SoVRLdmFileReader.
SbBool SoLDMReader::getMinMax | ( | double & | min, | |
double & | max | |||
) | [inline, virtual] |
Returns the minimum and maximum data values (for float values).
Reimplemented from SoVolumeReader.
Reimplemented in SoVRLdmFileReader.
SbBool SoLDMReader::getMinMax | ( | int64_t & | min, | |
int64_t & | max | |||
) | [inline, virtual] |
Returns the minimum and maximum data values.
Reimplemented from SoVolumeReader.
Reimplemented in SoVRLdmFileReader.
virtual SbString SoLDMReader::getOriginalFilename | ( | ) | const [virtual] |
Returns original file name from which the data has been converted to LDM format if stored in file.
Reimplemented from SoVolumeReader.
virtual ReaderType SoLDMReader::getReaderType | ( | ) | [inline, virtual] |
Returns the reader type.
Reimplemented from SoVolumeReader.
virtual SbBox3f SoLDMReader::getSize | ( | ) | [virtual] |
Returns the bounding box of the total data in world coordinates.
void SoLDMReader::getSubSlice | ( | const SbBox2i32 & | subSlice, | |
int | sliceNumber, | |||
void * | data | |||
) | [inline, virtual] |
Note: SoLDMReader does not implement this method.
Implements SoVolumeReader.
Reimplemented in SoVRLdmFileReader.
virtual SbVec2d SoLDMReader::getTileMinMax | ( | int | fileId | ) | const [virtual] |
Returns the minimum and maximum data values for the given tile. VolumeViz will only call this method if the data is organized in tiles like the LDM file format. In other words, if isDataConverted() return true.This information benefits optimization such as SoLDMGlobalResourceParameters::setIgnoreFullyTransparentTiles.Default implementation returns SbVec2d(numeric_limits<double>max(),-numeric_limits<double>max())
fileId | The fileId of the tile. |
Reimplemented from SoVolumeReader.
Reimplemented from SoVolumeReader.
Returns the size of a data tile.
Reimplemented from SoVolumeReader.
Reimplemented in SoVRLdmFileBorderReader.
virtual SoType SoLDMReader::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Reimplemented from SoVolumeReader.
Reimplemented in SoVRLdmFileBorderReader, and SoVRLdmFileReader.
virtual SbXmlTag SoLDMReader::getXmlTag | ( | const char * | tagName | ) | [virtual] |
Gets the first occurrence of the XML element whose tag name is specified by tagName.
Then the associated value or subtags can be fetched using the SbXmlElement methods. Custom XML tags can be added to the LDM header file by using the method SoLDMConverter::setXmlCallback().
virtual int SoLDMReader::handleHeader | ( | TiXmlElement * | ) | [inline, virtual] |
Handle tags of LDM reader inheriting from this base class.
virtual bool SoLDMReader::isLittleEndian | ( | ) | [virtual] |
Returns whether the bytes of the data are stored in big or little endian order.
The order is little endian if the function returns true.
virtual SbBool SoLDMReader::isThreadSafe | ( | ) | const [virtual] |
Return true as this reader is thread safe.
Reimplemented from SoVolumeReader.
virtual SoDEPRECATED SbBool SoLDMReader::readTile | ( | int | index, | |
unsigned char *& | buffer, | |||
const SbBox3i32 & | tilePosition | |||
) | [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.
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.
index | specifies a fileID, the id of an existing tile (fileID=tileID in a cubical volume). | |
buffer | The buffer in which the data is returned. | |
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 reader (can be used for mapping to a different index scheme). |
Reimplemented from SoVolumeReader.
virtual SoBufferObject* SoLDMReader::readTile | ( | int | index, | |
const SbBox3i32 & | tilePosition | |||
) | [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.
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). |
Returns a pointer to an allocated buffer containing the data.
Reimplemented from SoVolumeReader.
Reimplemented in SoVRLdmFileBorderReader.
virtual SbBool SoLDMReader::readXSliceInTile | ( | int | index, | |
unsigned char *& | buffer, | |||
const SbBox3i32 & | tilePosition, | |||
const uint32_t & | slicePosition | |||
) | [virtual] |
Read directly from the LDM data source, an orthoslice on the X axis inside a tile.
index | The fileId of the tile. | |
buffer | The buffer in which the data is returned. | |
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 reader (can be used for mapping to a different index scheme). | |
slicePosition | The slice position in the tile. |
Reimplemented from SoVolumeReader.
virtual SbBool SoLDMReader::readXTraceInTile | ( | int | index, | |
unsigned char *& | buffer, | |||
const SbBox3i32 & | tilePosition, | |||
const SbVec2i32 & | tracePosition | |||
) | [virtual] |
Read directly from the LDM data source, a trace inside a tile.
index | The fileId of the tile. | |
buffer | The buffer in which the data is returned. | |
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 reader (can be used for mapping to a different index scheme). | |
tracePosition | represents the (i,j) coordinates of the trace. |
Reimplemented from SoVolumeReader.
virtual SbBool SoLDMReader::readYSliceInTile | ( | int | index, | |
unsigned char *& | buffer, | |||
const SbBox3i32 & | tilePosition, | |||
const uint32_t & | slicePosition | |||
) | [virtual] |
Read directly from the LDM data source, an orthoslice on the Y axis inside a tile.
index | The fileId of the tile. | |
buffer | The buffer in which the data is returned. | |
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 reader (can be used for mapping to a different index scheme). | |
slicePosition | The slice position in the tile. |
Reimplemented from SoVolumeReader.
virtual SbBool SoLDMReader::readZSliceInTile | ( | int | index, | |
unsigned char *& | buffer, | |||
const SbBox3i32 & | tilePosition, | |||
const uint32_t & | slicePosition | |||
) | [virtual] |
Read directly from the LDM data source, an orthoslice on the Z axis inside a tile.
index | The fileId of the tile. | |
buffer | The buffer in which the data is returned. | |
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 reader (can be used for mapping to a different index scheme). | |
slicePosition | The slice position in the tile. |
Reimplemented from SoVolumeReader.