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

Save metadata in-place in limited cases #36

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

andy-sweet
Copy link
Owner

@andy-sweet andy-sweet commented Mar 13, 2023

This enables the save button and makes it overwrite the existing metadata file associated with the layer. The motivation is to allow metadata changes that don't require rewriting all the layer data, which could be achieved through the standard Save selected layer ... option in napari.

But it's also a potentially dangerous/lossy operation, so it is only enabled if all the following conditions hold.

1. The layer was read with this plugin. This way we know it's an ome-zarr, we know what file to overwrite (the multiscale image group's zattrs), and can do so with ome-zarr's write_multiscales_metadata function.

2. The layer's file path is writable. I'm assuming this won't typically apply for ome-zarr stored on remote cloud services like S3.

3. The number of axes is the same in the layer and original file. In particular, napari-ome-zarr splits multi-channel images into multiple layers.

In the case that it is not supported, the tooltip of the save button gives a reason why.

Closes #31

@andy-sweet andy-sweet self-assigned this Mar 13, 2023
@codecov-commenter
Copy link

codecov-commenter commented Mar 13, 2023

Codecov Report

Merging #36 (e5c1db3) into main (180867b) will decrease coverage by 1.02%.
The diff coverage is 80.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main      #36      +/-   ##
==========================================
- Coverage   93.72%   92.71%   -1.02%     
==========================================
  Files          16       16              
  Lines        1371     1469      +98     
==========================================
+ Hits         1285     1362      +77     
- Misses         86      107      +21     
Impacted Files Coverage Δ
src/napari_metadata/_writer.py 76.54% <68.85%> (-23.46%) ⬇️
src/napari_metadata/_widget.py 94.11% <84.61%> (-0.54%) ⬇️
src/napari_metadata/_tests/test_widget.py 99.65% <100.00%> (+0.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow saving OME-NGFF metadata in-place
2 participants