Re: [scikitimage] ValueError: too many values to unpack for measure.marching_cubes
Hi,
Functions in Python return objects packed in a tuple. When you write `verts, faces = marching_cubes(...)`, Python computes `marching_cubes(...)`, takes the output, and tries to unpack it (i.e. to assign to the names on the lefthand side of `=`) to 2 objects. The error tells you that the number of objects in a returned tuple is too high (>2).
Here is an example to better understand the issue:
In [1]: a, b = (1, 2) In [2]: a, b, c = (1, 2)  ValueError Traceback (most recent call last) <ipythoninput526c544669ffc> in <module>() > 1 a, b, c = (1, 2)
ValueError: not enough values to unpack (expected 3, got 2)
In [3]: a, b = (1, 2, 3)  ValueError Traceback (most recent call last) <ipythoninput62ecd6d570722> in <module>() > 1 a, b = (1, 2, 3)
ValueError: too many values to unpack (expected 2)
In skimage 0.13, as far as I remember, `marching_cubes` is actually an alias to `marching_cubes_lewiner` ( http://scikitimage.org/docs/dev/api/skimage.measure.html#skimage.measure.ma...) which returns 4 objects, not 2. In skimage 0.14dev we've already removed this alias. You should either use `marching_cubes_classic` (not recommended), or update your code to use `marching_cubes_lewiner` and unpack the output to 4 variables.
Regards, Egor
20170807 17:16 GMT+03:00 wine lover winecoding@gmail.com:
Hello,
I have been trying to follow the tutorial here https://www.kaggle.com/ gzuidhof/fullpreprocessingtutorial
However, verts, faces, , = measure.marching_cubes(p, threshold) in the function of plot_3d gives the following error message
File "guidozuidhof_fullprocessing.py", line 90, in plot_3d verts, faces = measure.marching_cubes(p, threshold) ValueError: too many values to unpack
What does that mean, and how to solve it, thanks a lot!
scikitimage mailing list scikitimage@python.org https://mail.python.org/mailman/listinfo/scikitimage
participants (1)

Egor Panfilov