00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _SO_VR_VOX_FILE_READER_
00024 #define _SO_VR_VOX_FILE_READER_
00025
00026 #include <LDM/readers/SoVolumeReader.h>
00027 #include <VolumeViz/nodes/SoVolumeData.h>
00028
00029
00061 class SoVRVoxFileReader : public SoVolumeReader
00062 {
00063 SO_FIELDCONTAINER_HEADER(SoVRVoxFileReader);
00064
00065 public:
00067 SoVRVoxFileReader();
00068
00073 virtual int setFilename( const SbString& filename );
00074
00081 virtual ReadError getDataChar( SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim );
00082
00089 virtual void getSubSlice( const SbBox2i32& subSlice, int sliceNumber, void * data );
00090
00098 virtual int getNumSignificantBits()
00099 { return m_numSigBits; }
00100
00104 virtual SoVolumeReader::ReaderType getReaderType ()
00105 {return VOX;};
00106
00107 private:
00108
00113 void convertFromTo(void* inBuffer, void* outBuffer, size_t numElements, SoDataSet::DataType inDataType, SoDataSet::DataType outDataType, char inEndianness);
00114
00119 template<typename FROM_TYPE>
00120 void convertFromTo(FROM_TYPE* inBuffer, void* outBuffer, size_t numElements, SoDataSet::DataType outDataType, char inEndianness);
00121
00126 template<typename FROM_TYPE, typename TO_TYPE>
00127 void convertFromTo(FROM_TYPE* inBuffer, TO_TYPE* outBuffer, size_t numElements, char inEndianness);
00128
00129 SbBox3f m_size;
00130 SbVec3i32 m_dim;
00131
00132
00133
00134
00135 SoDataSet::DataType m_fileDataType;
00136 SoDataSet::DataType m_volumeDataType;
00137
00138 int m_offsetToData;
00139
00140
00141 SbString m_volumeTitle;
00142 SbString m_volumeCopyright;
00143 int m_volumeCount;
00144 SbVec3f m_volumeScale;
00145 SbVec3f m_volumePosition;
00146 char m_endian;
00147 SbMatrix m_volumeMatrix;
00148
00149
00150
00151 double m_voxelScale;
00152 double m_voxelOffset;
00153
00154 int m_numSigBits;
00155
00156 SbString m_userFilename;
00157
00158
00159 static bool s_applyScaleOffset;
00160 };
00161
00162 #endif // _SO_VR_VOX_FILE_READER_
00163
00164
00165