after each set of annotation napari crashes
Closed this issue · 3 comments
I do annotations with the minimal contour tool. Everything works fine for the annotation of a single image. Now it is not possible to save all layers simultaneously, so I save each layer separatly (the original image, the labels and the anchors)
Next I would like to load a new image, to do so I close the image and the label layer and then napari crashes.
Besides that, for the time being, I just restart napari, and I love this tool.
Hey @fabricesenger,
I checked it, and it seems that the error occurs on deleting a layer, and it might be related to hiding layers from the layer list (there's a brief summary on what might cause it in the end). Currently I don't know what would be the best option to fix this issue. So in order to get around it, you shouldn't delete layers when some of them are hidden. This can be done two ways:
- Create a layer BEFORE opening the Annotation Toolbox plugin. That way some auxiliary layers will appear in the list (which are originally hidden). Important: Do not delete or modify these directly! That would break the plugin. (These are the layers which have
<hidden>
in their name.) - Do not delete any layers. What you can do is to hide the layers which were already processed, and open the new ones without deleting these. However, its downside is that the layer list will become cluttered, which is not only annoying, but also might fill up memory (actually I'm not sure if this really happens, I can imagine that napari has some smart way of handling this).
Please check if these solutions work for you!
So the explanation:
Napari doesn't have a built-in functionality for hiding layers from the layer list, but there are some layers which should not be touched by the user (they are there to show some intermediate results/information). So I implemented this functionality based on this comment. Unfortunately this involves accessing directly the GUI framework (Qt), and I guess this is what napari cannot handle.
I'm sorry to say that there's no easy solution to this problem. Until napari doesn't provide built-in functionality to hide layers from the list, this is the best we can do. Another option is to expose the auxiliary layers and hope that users don't (accidentally) alter them.
Hi there,
thank you for that quick reply. I think I will open an issue as well for napari, to have some feedback about layer management.
I will try what you suggested. In the end closing napari between two annotations isn't that annoying, I was just wondering if there was not a more elegant way.
Thanks again,
Fabrice.
Hey @fabricesenger,
in the new version of the plugin (from 0.1.0) utility layers are not hidden from the layer list. This change solves the problem which caused napari to crash when deleting layers. So you don't need to close napari between annotating images. Try it out, and contact me if any error occurs!
Best wishes,
David