Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: module 'skimage.measure' has no attribute 'marching_cubes'

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
like image 751
Thilini Thillekerathne Avatar asked Jan 26 '23 22:01

Thilini Thillekerathne


2 Answers

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)
like image 156
siva Avatar answered Feb 01 '23 12:02

siva


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
like image 34
Thilini Thillekerathne Avatar answered Feb 01 '23 12:02

Thilini Thillekerathne