23#ifndef _SO_VOLUME_READER_
24#define _SO_VOLUME_READER_
27#pragma warning( push )
28#pragma warning(disable:4251)
35#include <Inventor/STL/vector>
36#include <Inventor/STL/map>
871 virtual SbBool readTile(
int SO_UNUSED_PARAM(index),
unsigned char*& SO_UNUSED_PARAM(buffer),
const SbBox3i32& SO_UNUSED_PARAM(tilePosition)) {
return FALSE; }
911 void lockFileMutex();
912 void unlockFileMutex();
926 void convertDataRange(
bool doRange,
double min,
double max );
928 virtual int getNumBytesPerDatum();
934 virtual bool isLDMReader() {
return false; }
935 virtual bool isVolumeMaskReader() {
return false; }
937 virtual bool hasDeadCell() {
return false; }
939 virtual bool isDead(
int i,
int j,
int k);
941 virtual uint8_t* getCellGridState() {
return NULL; }
943 virtual int getNbCell() {
return 0; }
945 virtual uint64_t getTileSizeFromFid(
int fileId);
951 bool hasPerTileMinMaxComputed();
1050 static void swapBytesN(
void *buffer,
int numElements,
int numBytesPerElement );
1070#ifndef HIDDEN_FROM_DOC
1087 SbBool m_directCoordSysAutoDetect;
1092 std::vector<SoDataSet::DatumElement> m_datum;
1093 int m_bytesPerVoxel;
1095 double m_rangeMin, m_rangeMax;
1102 std::vector<float> m_rectilinearCoordinates[3];
1117 int64_t m_fmmoffset;
1118 unsigned int m_fmmsize;
1119 bool m_hasPerTileMinMaxComputed;
1122 void bestmap(int64_t);
1127 typedef std::map<SbString,SoType> SoVolumeReaderExtensionAssociationMap;
1128 static SoVolumeReaderExtensionAssociationMap s_volumeReaderExtensionAssociation;
1131 template <
typename TypeInt,
typename TypeOut>
1132 void convert_range(
size_t size,
void* bufferIn,
void* bufferOut, int64_t outMin, int64_t outMax);
1135 template <
typename TypeOut>
1136 void convert_out(
size_t size,
void* bufferIn,
void* bufferOut, int64_t outMin, int64_t outMax);
1139 template <
typename TypeIn>
1140 void convert_in(
size_t size,
void* bufferIn,
void* bufferOut, int64_t outMin, int64_t outMax);
1177 return m_ignoredFile;
1201 return m_directCoordSysAutoDetect;
1213 return m_directCoordSys;
1217SoVolumeReader::isDead(
int,
int,
int)
1223SoVolumeReader::getTileSizeFromFid(
int)
1229#pragma warning( pop )
#define FALSE
Possible value of SbBool.
#define SO_FIELDCONTAINER_ABSTRACT_HEADER(className)
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D box class.
Class for smart character strings.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable mutex c...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 2D vector class ...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
DataType
Supported data type.
Abstract base class for objects that contain fields.
Stores runtime type information.
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Abstract...
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.
virtual SbString getOriginalFilename() const
Returns original file name from which the data has been converted to LDM format if stored in file.
static SbBox3f adjustFlatExtent(const SbString &fileName, const SbBox3f &extent, const SbVec3i32 &dim)
VolumeViz doesn't handles empty extent (for ex.
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 void reloadTileMinMax()
SoDEPRECATED SbBool m_dataConverted
SoVolumeReader()
Constructor.
static bool unregisterVolumeReaderExtensions(const SoType &readerType)
Unregister all filename extensions associated with the specified SoVolumeReader class.
virtual SbBool isRGBA() const
Returns TRUE if the data set contains RGBA color values.
virtual SoVolumeReader::ReaderType getReaderType()
Returns the reader type.
virtual SoBufferObject * readTile(int index, const SbBox3i32 &tilePosition)
Given an index, reads a tile if the data is organized in tiles (for LDM).
void setRectilinearCoordinates(const float *x, const float *y, const float *z)
Sets rectilinear coordinates for the data set.
virtual int setFilename(const SbString &filename)
Specifies the path of the file.
const float * getRectilinearCoordinates(Axis axis) const
Returns the coordinates for the specified axis.
virtual SbBool setDirectCoorSys(SbBool directCoord)
Specify if the coordinate system used is direct or not.
virtual SbBool getHistogram(std::vector< int64_t > &numVox)
Returns histogram if available.
void setRGBA(const SbBool flag)
Specifies if data must be considered as RGBA.
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 da...
virtual SbBool isDataConverted() const
Returns TRUE if the data is already organized in tiles for the LDM module.
Axis
Which axis to handle.
static int bytesToInt(const unsigned char *ptr, int sizeBytes)
Utility method that returns an integer from sizeBytes bytes starting at address ptr.
int64_t fileSize()
Returns the size of the file when file I/O is handled by this class.
virtual SoDEPRECATED int getBorderFlag()
Returns border (overlap) value if stored in file.
virtual void restoreAllHandles()
Restore resources that were closed by closeAllHandles().
SbVec3i32 getSizeToAllocate(const SbVec3i32 &realSize, const SbVec3i32 &subsamplingLevel)
Utility function provided by SoVolumeReader for subclass readers to call.
virtual SbBool setOutputDataType(SbBool doChange, SoDataSet::DataType outputType)
Sets the output data type.
static SoVolumeReader * getAppropriateReader(const SbString &filename)
Returns a preconfigured SoVolumeReader instance that can be used to load the given file (based on the...
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 getTileSize(SbVec3i32 &size)
Returns tile dimensions in voxels when using data stored in tiles.
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.
CoordinateType
Coordinate type used by this data set.
@ COORDINATES_UNIFORM
Uniform grid spacing along each axis.
@ COORDINATES_RECTILINEAR
Grid spacing defined by x, y, z values.
virtual SbBool getDirectCoordSys()
Return whether the coordinate system used is direct or not.
virtual SbBool isThreadSafe() const
Should return TRUE if the reader is thread safe.
SbString getFilename() const
Returns the path of the file.
virtual SbVec2d getTileMinMax(int index) const
Returns the minimum and maximum data values for the given tile.
virtual SbBool setDirectCoordSysAutoDetection(SbBool autoValue)
Sets whether or not the reader should automatically try to detect if the coordinate system used is di...
virtual ReadError getDataChar(SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim)=0
Gets the characteristics (file header) of the data volume.
virtual int getNumSignificantBits()
This method is optional.
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 SoBuf...
virtual void closeAllHandles()
Close all resources that are locked by the reader.
virtual ~SoVolumeReader()
Destructor.
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.
SbVec3i32 getNumVoxels(const SbVec3i32 &realSize, const SbVec3i32 &subsamplingLevel)
Utility function provided by SoVolumeReader for subclass readers to call.
ReaderType
Available reader type.
@ RASTERSTACK
Raster Stack.
virtual SbBool getMinMax(int64_t &min, int64_t &max)
Returns min and max for integer data type, if available.
static bool registerVolumeReaderExtension(const SbString &fileExtension, const SoType &readerType)
Register an SoVolumeReader class to handle a file extension.
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 getDirectCoordSysAutoDetection()
Return automatic detection value.
virtual SbBool isIgnoredFile() const
Should return TRUE if at least one file has been ignored during reading.
virtual SoVolumeWriter * getConfiguredWriter()
Returns a volume writer that corresponds to this reader (same format, parameters,...
static SbBool isValidFloat(const float val)
Utility method to check if value is a valid IEEE 754 floating point number.
CoordinateType getCoordinateType()
Returns coordinate type used by the data set.
virtual void getSubSlice(const SbBox2i32 &subSlice, int sliceNumber, SoBufferObject *dataBuffer)
Same as getSubSlice( const SbBox2i32& subSlice, int sliceNumber, void * data ) but using an SoBufferO...
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 f...
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 refe...
@ RD_UNSUPPORTED_DATA_TYPE_ERROR
Unsupported data type (but the data is valid).
@ RD_INVALID_DATA_ERROR
Invalid data.
@ RD_FILE_NOT_FOUND_ERROR
The data file is not found.
@ RD_UNKNOWN_ERROR
Unknown error.
@ RD_FILE_FORMAT_NOT_VALID_ERROR
Some error were detected in the file making it impossible to read.
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Abstract...