Marching Cubes implementation


I’m trying to implementation the marching cubes algorithm in c++; without any external libraries.

I’m looking for a good reference, so I can follow step by step this algorithm.

There is a lot of papers talking about this algorithm, but so hard to understand.

Also, I would like to know if 3DSlicer integrate the vtk solution or another one ?

I appreciate your help

Slicer has been using marching cubes algorithm for image->mesh conversion, but recently we switched to flying edges algorithm, which is implemented in a way that is better optimized for multi-core CPUs. Slicer uses VTK’s implementation for both. You can still try marching cubes in Slicer-4.8.1, and flying edges in latest nightly.

You may have looked at this already, but you may be able to understand it by comparing what’s in the papers you’ve looked at with the VTK C++ code:


Thank you for your feedback.

@lassoan @mschumaker; In fact, I tried both vtkMarchingCubes and vtkFlyingEdges3D directly on vtk; and results comes basically similar. wall time and output file.
Do you know any others MC implementations without vtk?

@lassoan; is there any available documentations of MarchingCubes / vtkFlyingEdges3D implementation under 3DSlicer.

Do you mean, that MarchingCubes implementation under previous 3DSlicer release, doesn’t support multi-core CPUs ?

Please, how can I test both algorithm with 4.8.1; and there is any documentation on those implementation ?

Also, I takes a look on this topic :

Thank you

See the first reference here (paper by one of the original VTK authors):

Flying edges was published in IEEE so it’s not open, but there is a PDF on ResearchGate.

It is important that vtkFlyingEdges3D only uses multiple CPU cores if VTK is built with Threading Building Blocks (TBB) as SMP backend. By default VTK is built with Sequential SMP backend, which means no parallelization. My experience is that flying edges is significantly faster than marching cubes. Flying edges can also provide surface normals, so you can save time because there is no need for extra polydata normals computation.

Also note that for all labelmap conversions we use discrete versions of marching cubes and flying edges filters.