Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoVRVoxFileReader.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : M. Heck (Jul 2003)
22**=======================================================================*/
23#ifndef _SO_VR_VOX_FILE_READER_
24#define _SO_VR_VOX_FILE_READER_
25
28
29
62{
64
65 public:
68
73 virtual int setFilename( const SbString& filename );
74
79
83 virtual void getSubSlice( const SbBox2i32& subSlice, int sliceNumber, void * data );
84
92 virtual int getNumSignificantBits()
93 { return m_numSigBits; }
94
100
101 private:
102
107 void convertFromTo(void* inBuffer, void* outBuffer, size_t numElements, SoDataSet::DataType inDataType, SoDataSet::DataType outDataType, char inEndianness);
108
113 template<typename FROM_TYPE>
114 void convertFromTo(FROM_TYPE* inBuffer, void* outBuffer, size_t numElements, SoDataSet::DataType outDataType, char inEndianness);
115
120 template<typename FROM_TYPE, typename TO_TYPE>
121 void convertFromTo(FROM_TYPE* inBuffer, TO_TYPE* outBuffer, size_t numElements, char inEndianness);
122
123 SbBox3f m_size;
124 SbVec3i32 m_dim;
125
126 // File may store data as int8 but this volume may be seen as int16.
127 // For. when file is uint8 but offset is -2000, actual data may be in [-2000, 0] so have
128 // to be encode in signed 16 bits.
129 SoDataSet::DataType m_fileDataType;
130 SoDataSet::DataType m_volumeDataType;
131
132 int m_offsetToData;
133
134 // Specific data from vox file
135 SbString m_volumeTitle;
136 SbString m_volumeCopyright;
137 int m_volumeCount;
138 SbVec3f m_volumeScale;
139 SbVec3f m_volumePosition;
140 char m_endian;
141 SbMatrix m_volumeMatrix;
142
143 // Scale and offset to rescale data:
144 // outData = scale * inData + offset.
145 double m_voxelScale;
146 double m_voxelOffset;
147
148 int m_numSigBits;
149
150 SbString m_userFilename;
151
152 // If true, apply scale and offset to data in the getSubSlice. Linked to LDM_VOX_READER_APPLY_SCALE_OFFSET.
153 static bool s_applyScaleOffset;
154};
155
156#endif // _SO_VR_VOX_FILE_READER_
157
158
#define SO_FIELDCONTAINER_HEADER(className)
2D box class.
Definition SbBox.h:2383
3D box class.
Definition SbBox.h:649
4x4 matrix class.
Definition SbMatrix.h:309
Class for smart character strings.
Definition SbString.h:202
3D vector class.
Definition SbVec.h:932
3D vector class.
Definition SbVec.h:1517
DataType
Supported data type.
Definition SoDataSet.h:604
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> VOX file reader.
SoVRVoxFileReader()
Constructor.
virtual ReadError getDataChar(SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim) override
Gets the characteristics (file header) of the data volume.
virtual int getNumSignificantBits()
This method is optional.
virtual SoVolumeReader::ReaderType getReaderType()
Returns the reader type.
virtual int setFilename(const SbString &filename)
Specifies the path of the file.
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...
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Abstract...
ReaderType
Available reader type.
ReadError
Read error.
size_t size() const