Napari: to_labels broken in nD_shapes.py

Created on 27 Jan 2020  路  3Comments  路  Source: napari/napari

>

Hi Nicolas,

Thanks for building such a great visualization tool for python!

I have been trying to use (napari version 0.2.10+7.g47af135) the .to_labels functionality on an image stack and not getting the behavior I expected. For example, if I add the line print(np.unique(labels)) at line number 36 of the nD_shapes.py example, expecting this to reflect the labels of all unique shapes, the output that I get is array([0]), indicating no labels present.

If I change line 34 to read:
labels = layer.to_labels(labels_shape=(128, 128))
I get an index for all 128 shapes, but of course they are now compressed into one image plane, but if line 34 reads:
labels = layer.to_labels()
I again get only zeros (but with shape (127,128,128)).

It does seem that to_labels is meant to be compatible with n-dimensional images, am I expecting the wrong behavior, or otherwise misusing this functionality?

_Originally posted by @miketaormina in https://github.com/napari/napari-tutorials/issues/46#issuecomment-578882563_

bug

All 3 comments

Sounds like a bug, I can look into it

@kevinyamauchi if you have time and are interested can you take this one too? Will force you into the Shapes layer a bit :-) :-)

No problem. On it!

Was this page helpful?
0 / 5 - 0 ratings