when I'm executing one of code that I found from the web it's given me "AttributeError: module 'skimage.measure' has no attribute 'marching_cubes'". Do you have any idea to fix this?
Executed code segment:
from skimage import measure
def make_mesh(image, threshold=+30, step_size=1):
print "Transposing surface"
p = image.transpose(2, 1, 0)
print "Calculating surface"
verts, faces, norm, val = measure.marching_cubes(p, threshold, step_size=step_size, allow_degenerate=True)
return verts, faces
In the new version, there are two methods marching_cubes_lewiner
and marching_cubes_classic
. But classic doesn't take step_size
parameter. You can try this:
measure.marching_cubes_lewiner(p, threshold, step_size=step_size, allow_degenerate=True)
I've used the marching_cubes_lewiner
function to solve the problem. Please refer following code line.
print("Calculating surface")
verts, faces, norm, val = measure.marching_cubes_lewiner(p, threshold, step_size=step_size, allow_degenerate=True)
return verts, faces
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With