MC: docs and example fixes

This commit is contained in:
Almar Klein
2016-07-26 11:41:26 +02:00
parent 01a1e5e4b7
commit 6d0d655121
3 changed files with 23 additions and 20 deletions
+2 -2
View File
@@ -33,10 +33,10 @@ ellip_double = np.concatenate((ellip_base[:-1, ...],
ellip_base[2:, ...]), axis=0)
# Use marching cubes to obtain the surface mesh of these ellipsoids
verts, faces = measure.marching_cubes(ellip_double, 0)
verts, faces, normals, values = measure.marching_cubes(ellip_double, 0)
# Display resulting triangular mesh using Matplotlib. This can also be done
# with mayavi (see skimage.measure.marching_cubes docstring).
# with mayavi or visvis (see skimage.measure.marching_cubes docstring).
fig = plt.figure(figsize=(10, 12))
ax = fig.add_subplot(111, projection='3d')
@@ -86,24 +86,6 @@ def marching_cubes_classic(volume, level=None, spacing=(1., 1., 1.),
To quantify the area of an isosurface generated by this algorithm, pass
outputs directly into `skimage.measure.mesh_surface_area`.
Regarding visualization of algorithm output, to contour a volume
named `myvolume` about the level 0.0, using the ``mayavi`` package::
>>> from mayavi import mlab # doctest: +SKIP
>>> verts, faces = marching_cubes_classic(myvolume, 0.0) # doctest: +SKIP
>>> mlab.triangular_mesh([vert[0] for vert in verts],
... [vert[1] for vert in verts],
... [vert[2] for vert in verts],
... faces) # doctest: +SKIP
>>> mlab.show() # doctest: +SKIP
Similarly using the ``visvis`` package::
>>> import visvis as vv # doctest: +SKIP
>>> verts, faces = marching_cubes_classic(myvolume, 0.0) # doctest: +SKIP
>>> vv.mesh(np.fliplr(verts), faces) # doctest: +SKIP
>>> vv.use().Run() # doctest: +SKIP
References
----------
.. [1] Lorensen, William and Harvey E. Cline. Marching Cubes: A High
@@ -113,6 +113,27 @@ def marching_cubes(volume, level=None, spacing=(1., 1., 1.),
keeping the algorithm relatively easy. This implementation is
written in Cython, ported from Lewiner's C++ implementation.
To quantify the area of an isosurface generated by this algorithm, pass
verts and faces to `skimage.measure.mesh_surface_area`.
Regarding visualization of algorithm output, to contour a volume
named `myvolume` about the level 0.0, using the ``mayavi`` package::
>>> from mayavi import mlab # doctest: +SKIP
>>> verts, faces, normals, values = marching_cubes(myvolume, 0.0) # doctest: +SKIP
>>> mlab.triangular_mesh([vert[0] for vert in verts],
... [vert[1] for vert in verts],
... [vert[2] for vert in verts],
... faces) # doctest: +SKIP
>>> mlab.show() # doctest: +SKIP
Similarly using the ``visvis`` package::
>>> import visvis as vv # doctest: +SKIP
>>> verts, faces, normals, values = marching_cubes_classic(myvolume, 0.0) # doctest: +SKIP
>>> vv.mesh(np.fliplr(verts), faces, normals, values) # doctest: +SKIP
>>> vv.use().Run() # doctest: +SKIP
References
----------
.. [1] Thomas Lewiner, Helio Lopes, Antonio Wilson Vieira and Geovan