scikit-image/scikit-image — pull request #469 by JDWarner (2013-03-17 02:34:50+00:00)
Title: 3D Marching Cubes

This was built upon the excellent existing `find_contours` algorithm, which uses a similar theory in 2D (marching squares). Extending to 3D required extending from 15 cases to 127; as an aside I apologize for the nearly 1,000 line Cython file. It runs much faster than it looks! This was a side project that ended up taking more than a little time...

This is a direct reimplementation of the original Lorensen publication. I didn't include any improvements, because I know the original is well out of patent protection but most of the derivatives likely remain snarled in IP limbo. Thus, it retains the familiar MC ambiguities and does not guarantee a closed contour. However, it is still very often used as a benchmark and I believe we should have it here! Even if the model isn't completely perfect, visually, the surface area estimate is very good.

In addition to generating 3D graphics, it should be noted that this version works with anisotropic arrays (via `sampling=(double, double, double)` kwarg). This resulted in somewhat higher complexity, however, it enabled true surface area quantification from "real world" volumetric data - which is rarely isotropic.

To accomplish surface area quantification, I also include `mesh_surface_area` which accepts the output from `marching_cubes` and computes the unit-correct surface area, validating this algorithm's place in the `skimage.measure` subpackage.

I would be happy to add this last feature to `find_contours` as well, so unit-correct contour lengths could be computed given known pixel samplings.