Skip to content

Commit

Permalink
fix: marching_cubes changed in skimage 0.13, fixes #52
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbreddels committed Aug 15, 2017
1 parent 63d48d3 commit 1278b89
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ipyvolume/pylab.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,14 @@ def plot_isosurface(data, level=None, color=default_color, wireframe=True, surfa
from skimage import measure
if level is None:
level = np.median(data)
verts, triangles = measure.marching_cubes(data, level)#, spacing=(0.1, 0.1, 0.1))
if hasattr(measure, 'marching_cubes_lewiner'):
values = measure.marching_cubes_lewiner(data, level)
else:
values = measure.marching_cubes(data, level)
values = measure.marching_cubes_lewiner(data, level)#, spacing=(0.1, 0.1, 0.1))
verts, triangles = values[:2] # version 0.13 returns 4 values, normals, values
# in the future we may want to support normals and the values (with colormap)
# and require skimage >= 0.13
x, y, z = verts.T
mesh = plot_trisurf(x, y, z, triangles=triangles, color=color)
if controls:
Expand Down

0 comments on commit 1278b89

Please sign in to comment.