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

Specify NGFF 0.6-dev in output data #849

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LucaMarconato
Copy link
Member

This PR monkeypatches ome_zarr.format to make it possible to use the read/write APIs of ome-zarr-py, while clarifying which OME-Zarr data version we are building on top.

Precisely, we implement the NGFF transformations specification, which, as of today, it is not merged to NGFF main yet. The timeline is to have the specification included in NGFF v0.6, hence from this PR we will write 0.6-dev instead of 0.4 (which was kept for compatibility with ome-zarr-py).

All the tests pass, the code for reproducing the documentation and paper notebooks and the data conversions from spatialdata-sandbox are currently running.

Practically, the PR will not change APIs or usage of the function of the spatialdata package and will only modify, on-disk, the version string for images and labels, as shown here (in this example I used Seqfish v2 data).

(ome311) macbook@Lucas-MacBook-Pro-2021 seqfish_v2_io % diff -r data.zarr.v4 data.zarr.v6
diff -r data.zarr.v4/images/Roi1_DAPI/.zattrs data.zarr.v6/images/Roi1_DAPI/.zattrs
91c91
<             "version": "0.4"
---
>             "version": "0.6-dev"
diff -r data.zarr.v4/labels/Roi1_Segmentation/.zattrs data.zarr.v6/labels/Roi1_Segmentation/.zattrs
3c3
<         "version": "0.4"
---
>         "version": "0.6-dev"
71c71
<             "version": "0.4"
---
>             "version": "0.6-dev"
diff -r data.zarr.v4/zmetadata data.zarr.v6/zmetadata
105c105
<                     "version": "0.4"
---
>                     "version": "0.6-dev"
157c157
<                 "version": "0.4"
---
>                 "version": "0.6-dev"
225c225
<                     "version": "0.4"
---
>                     "version": "0.6-dev"

CC @joshmoore

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.96%. Comparing base (7c280b7) to head (485b87c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #849      +/-   ##
==========================================
+ Coverage   91.95%   91.96%   +0.01%     
==========================================
  Files          47       47              
  Lines        7293     7304      +11     
==========================================
+ Hits         6706     6717      +11     
  Misses        587      587              
Files with missing lines Coverage Δ
src/spatialdata/_io/format.py 84.30% <100.00%> (+1.07%) ⬆️

pass
@property
def version(self) -> str:
return "0.6-dev"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @bogovicj in case defining a specific pre-release version (i.e. dev1 or beta1) would make detecting differences in these upcoming versions more reliable.

See also ongoing conversation around 0.5.2

Copy link
Member

@joshmoore joshmoore Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, going back and looking at the diff output in the description, I'd suggest we not use 0.6.* unless this also implements the Zarr v3 work of 0.5.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point. Any suggestion on the string to use? Maybe something more verbose like 0.4-dev-transformations?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or 0.4-dev-spatialdata .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 👍 for starting with 0.4-
  • 👍 for having "spatialdata" or similar in it
  • you might think about whether or not you have a version field from SD itself
  • I defer to you if you want "dev" in it or not (I don't think the validator, e.g., has special behavior for that. @will-moore?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @joshmoore.

you might think about whether or not you have a version field from SD itself
The SpatialData is versioned here:

SpatialDataContainerFormats = {

@will-moore I think your "no" answers to "(I don't think the validator, e.g., has special behavior for that. @will-moore?)". Do you have any preference for the 0.4- string?

Copy link
Member

@joshmoore joshmoore Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it'll need a little patching to parse the "0.4" out of a longer string if it's going to validate those.

Except this version explicitly does not validate, so perhaps it's enough that it's just not the known "0.4"?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can handle 0.4-* anything is fine.

I tried looking at some spatialdata data in the validator with...

$ ome_zarr view mouse_liver_data.zarr

...looking at the /labels/segmentation_mask/ the validator is complaining that /multiscales/0/coordinateTransformations/0 doesn't have scales or translation objects.
Instead you have "input":{"axes":[...]}, "output": {"axes":[...]}, "type": "identity"} which is heading towards the CoordinateSystems RFC-5 https://ngff.openmicroscopy.org/rfc/5/index.html but not quite the same.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will adjust the coordinate transformations metadata together with @melonora in ome-zarr-models-py.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you agree, I'd go then with 0.4-dev-spatialdata and merge this PR.

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.

Add dev on NGFF version number created by internal call of ome-zarr-py
3 participants