Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after each set of annotation napari crashes #38

Closed
fabricesenger opened this issue Oct 5, 2022 · 3 comments
Closed

after each set of annotation napari crashes #38

fabricesenger opened this issue Oct 5, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@fabricesenger
Copy link

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.

@fabricesenger fabricesenger added the bug Something isn't working label Oct 5, 2022
@bauerdavid
Copy link
Owner

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:

  1. 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.)
  2. 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.

@fabricesenger
Copy link
Author

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.

@bauerdavid
Copy link
Owner

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

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

No branches or pull requests

2 participants