This function uses a vectorized version of the marching cubes algorithm to compute a triangulated mesh of the isosurface within a given 3D matrix of scalar values at a given isosurface value. The output is a triangulated mesh specified in terms of a face list and a vertex list. The orientation of the triangles is chosen such that the normals point from the higher values to the lower values. Optional arguments COLORS ans COLS can be used to produce interpolated mesh face colors.
This function was used to create a surface mesh from the CT scan dataset for the Stanford bunny, a 461 x 339 x 330 array of floats. See uploaded image. Elapsed time on an AMD Opteron 64-bit computer with 4 GB of RAM is 24.7 seconds. For comparison, a surface mesh was computed from the same dataset using Matlab's isosurface function, and the elapsed time was 98.6 seconds.
This function was adapted for Matlab by Peter Hammer in 2011 by making minor syntax changes to an Octave function written by Martin Helm <firstname.lastname@example.org> in 2009 (http://www.mhelm.de/octave/m/marching_cube.m)
Revised 30 September, 2011 to add code by Oliver Woodford for removing
Peter Hammer (2023). Marching Cubes (https://www.mathworks.com/matlabcentral/fileexchange/32506-marching-cubes), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
- AI, Data Science, and Statistics > Statistics and Machine Learning Toolbox > Industrial Statistics >
- Industries > Medical Devices > DICOM Format >
- MATLAB > Graphics > 2-D and 3-D Plots > Surfaces, Volumes, and Polygons > Volume Visualization > Scalar Volume Data >
- Engineering > Biomedical Engineering > Biomedical Imaging >
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Changed description to include benchmarking results, and changed help section of mfile to more explicitly describe input arguments.
Revised 30 September, 2011 to add code by Oliver Woodford for removing duplicate vertices.
Added image of Stanford bunny meshed using this function. Added text describing this example to description.