[PREVIEW] [Medical] Class for computing an isosurface from a VolumeViz data set. More...
#include <Medical/helpers/VolumeMarchingCubes.h>
Public Member Functions | |
VolumeMarchingCubes () | |
~VolumeMarchingCubes () | |
SoTriangleSet * | getIsosurface (const SoVolumeData &volume, float isovalue) |
size_t | getNumTriangles () const |
float | getIsovalue () const |
This class contains a simple implementation of the classic Marching Cubes algorithm that computes the geometry (triangles) of an isosurface from a VolumeViz data set. It returns a shape node (e.g. SoTriangleSet) with an attached SoVertexProperty node containing the vertices.
The computed geometry can be exported using the usual Open Inventor tools, for example SoSTLWriteAction will write an STL format file.
This class is not intended to be used for rendering an isosurface and therefore is not implemented as an Open Inventor node. The computed geometry may be rendered, if desired, by adding the returned node to the scene graph. However, the SoVolumeIsosurface node is a much better tool for rendering isosurfaces. Using the GPU, SoVolumeIsosurface can render multiple isosurfaces simultaneously with interactive performance. We recommend using SoVolumeIsosurface for rendering and using this class only when the actual geometry is needed for export.
There are faster and better implementations of isosurface extraction, including the one in Open Inventor's MeshVizXLM extension. You can use that implementation by following the "VolumeMesh" example provided with the Open Inventor SDK. The intent here is for the code to be easy to understand so that applications can extend and modify.
Notes:
Limitations:
VolumeMarchingCubes::VolumeMarchingCubes | ( | ) |
Constructor.
VolumeMarchingCubes::~VolumeMarchingCubes | ( | ) |
Destructor.
SoTriangleSet* VolumeMarchingCubes::getIsosurface | ( | const SoVolumeData & | volume, | |
float | isovalue | |||
) |
Returns the geometry for an isosurface with the specified value.
The vertices are stored in an SoVertexProperty node which can be accessed in the vertexProperty field of the returned shape node.
Returns null if any error occurs (for example accessing volume data). Returns null if volume contains RGBA data.
float VolumeMarchingCubes::getIsovalue | ( | ) | const |
Returns isovalue of most recently generated isosurface.
Returns zero if no isosurface has been extracted.
size_t VolumeMarchingCubes::getNumTriangles | ( | ) | const |
Returns number of triangles in most recently generated isosurface.
Returns zero if no isosurface has been extracted.