Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
VolumeMarchingCubes.h
1// Simple Marching Cubes for VolumeViz
2
4//
5// This class is part of the Open Inventor Medical utility library.
6//
7// The medical utility classes are provided as a prebuilt library named
8// "fei_inventor_medical", that can be used directly in an Open Inventor
9// application. The classes in the prebuilt library are documented and
10// supported by Thermo Fisher Scientific. These classes are also provided as source code.
11//
12// Please see $OIVHOME/include/Medical/InventorMedical.h for the full text.
13//
15
16#ifndef _VOLUME_MARCHING_CUBES_
17#define _VOLUME_MARCHING_CUBES_
18
19#include <Medical/InventorMedical.h>
20
21#include <Inventor/nodes/SoTriangleSet.h>
22#include <VolumeViz/nodes/SoVolumeData.h>
23#include <LDM/SoLDMTileID.h>
24#include <LDM/SoLDMDataAccess.h>
25
26#include <vector>
27
28class SoLDMTopoOctree;
29
30
109class INVENTORMEDICAL_API VolumeMarchingCubes
110{
111public:
114
117
125 SoTriangleSet* getIsosurface( const SoVolumeData& volume, float isovalue );
126
130 size_t getNumTriangles() const;
131
135 float getIsovalue() const;
136
137private:
143 void marchVolume();
144
150 void marchTile( SbVec3i32 tileDim, SbVec3f tileMin, SbVec3f tileMax, void* tileData );
151
168 int marchCube( SbVec3f& corner, SbVec3f& size, float values[8], float isoval, SbVec3f vertices[15] );
169
176 float getVoxelValue( int i, int j, int k);
177
178 // Volume properties
179 SbVec3i32 m_voldim; // IJK dimensions
180 SbBox3f m_volext; // XYZ extent
181 SbVec3i32 m_tiledim; // IJK dimensions
182 SbVec3f m_tileSize; // XYZ size
183 SbVec3f m_voxelSize; // XYZ size
184 unsigned int m_voxelBytes;
185 SoDataSet::DataType m_voxelType;
186
187 // Stuff to handle multiple tiles
188 SoVolumeData* m_volData;
189 SoLDMDataAccess::DataInfo* m_dataInfo; // Data for current locked tile (if any).
190 SbVec3i32 m_tileMin;
191 SbVec3i32 m_tileMax;
192
193 // Only used during extraction. Should be hidden in an impl class.
194 std::vector<SbVec3f> m_vertices;
195
196 // Other
197 float m_isoValue;
198 int m_resolution;
199 size_t m_numTriangles;
200};
201
202#endif
3D box class.
Definition SbBox.h:649
3D vector class.
Definition SbVec.h:932
3D vector class.
Definition SbVec.h:1517
DataType
Supported data type.
Definition SoDataSet.h:664
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Octree t...
Set of triangles shape node.
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Volume data property ...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> (Preview feature...
size_t getNumTriangles() const
Returns number of triangles in most recently generated isosurface.
VolumeMarchingCubes()
Constructor.
SoTriangleSet * getIsosurface(const SoVolumeData &volume, float isovalue)
Returns the geometry for an isosurface with the specified value.
~VolumeMarchingCubes()
Destructor.
float getIsovalue() const
Returns isovalue of most recently generated isosurface.
Information about returned data when directly accessing the data rather than copying the data.