4

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

5 Answers5

8

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)
Lucan
  • 2,907
  • 2
  • 16
  • 30
siva
  • 81
  • 2
2

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
0

You can use marching_cubes_classic(p, threshold)

0

Because the scikit-image version is too old, please replace the version above 0.16 to solve it.

pip uninstall scikit-image
pip install scikit-image==0.17.1
Pppang
  • 1
  • 2
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Ben the Coder May 10 '23 at 14:01
0

In version 0.19 there is only marching_cubes method. So try to change marching_cube_lewiner with marching_cubes and pay attention with the parameters.

reference:

https://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.marching_cubes_lewiner

ANAS.C
  • 456
  • 3
  • 7