Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

When “Mark as cell(s)” in the plugin, there is an error: ‘Selection’ object is not subscriptable. #21

Closed
adamltyson opened this issue May 20, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@adamltyson
Copy link
Member

New bug with napari v0.4.8

https://forum.image.sc/t/cellfinder-napari-crashes-with-segmentation-fault-on-macos-when-saving-training-data-in-curation/52978/

@adamltyson adamltyson added the bug Something isn't working label May 20, 2021
@adamltyson adamltyson self-assigned this May 20, 2021
@kailynkfields
Copy link

I am also seeing this error (without any crashing like the original post in the forum).
`TypeError Traceback (most recent call last)
/opt/anaconda3/envs/brainglobe/lib/python3.8/site-packages/cellfinder_napari/curation.py in mark_as_cell(self=<cellfinder_napari.curation.CurationWidget object>)
268
269 def mark_as_cell(self):
--> 270 self.mark_point_as_type("cell")
self.mark_point_as_type = <bound method CurationWidget.mark_point_as_type of <cellfinder_napari.curation.CurationWidget object at 0x7f3f546b7f70>>
271
272 def mark_as_non_cell(self):

/opt/anaconda3/envs/brainglobe/lib/python3.8/site-packages/cellfinder_napari/curation.py in mark_point_as_type(self=<cellfinder_napari.curation.CurationWidget object>, point_type='cell')
286
287 if len(self.viewer.layers.selected) == 1:
--> 288 layer = self.viewer.layers.selected[0]
layer = undefined
self.viewer.layers.selected = Selection({<Points layer 'Cells' at 0x7f3f54080ac0>})
289 if type(layer) == napari.layers.Points:
290

TypeError: 'Selection' object is not subscriptable
`

@adamltyson
Copy link
Member Author

Can you try downgrading to napari version 0.4.7? This should fix it until I get time to look into this properly.

@kailynkfields
Copy link

Tentatively that seemed to work. Thank you!

@sofroniewn
Copy link

We've deprecated 'viewer.layers.selected', now 'viewer.layers.selection' should be used. It's now a set, so you might need to do list(viewer.layers.selection)[0] to recover the above behaviour. Sorry for that breaking change

@adamltyson
Copy link
Member Author

Thanks @sofroniewn, this is fixed in df63b31.

@kailynkfields this will be in version 0.0.12 by the end of the day.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants