Repository navigation
Conversation
|
cc @LucaMarconato @will-moore @joshmoore I know there are other ways of doing this, but I think any other change would require a change in both ome-zarr-py and dependent libraries (though SpatialData could be the only one in this case effected) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #491 +/- ##
=======================================
Coverage 87.02% 87.02%
=======================================
Files 13 13
Lines 1772 1772
=======================================
Hits 1542 1542
Misses 230 230 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks for approving! Would there be any timeline for a release? Right now zarr v3 in SpatialData is blocked by this as we can't have backward compatibility without this. |
|
Just to understand your usage a bit better... Your I'm wondering if doing |
|
correct, so that would seemingly be an alternative right now, though I would not be able to predict if in the future we have a similar situation while the format is then still |
|
One possible issue in the future is that "0.10" startswith "0.1", although I expect we'll remove support for writing "0.1" by the time we get to "0.10". As far as I can understand, following your PR link above, all your But in your So you have If so, then my suggestion of checking for I'm just trying to work out the best way of not breaking your usage in future, but I don't know which of the checks was the one that broke your usage, or exactly why. Or maybe I'm over-thinking this and we can just go with the fixes as they are now. |
|
Not all Format classes are based on current format. TLDR We need this to allow our users to update their zarr v2 data to zarr v3. I don't foresee any problems once we have given the time for our users to update. The main reason why it is broken now is that our RasterFormatV02 which was used with zarr v2 does not write metadata to |
|
Also, just for the record, thank you for thinking along:) |
|
|
||
| attrs = group.attrs | ||
| if fmt.version not in ("0.1", "0.2", "0.3", "0.4"): | ||
| if not fmt.version.startswith(("0.1", "0.2", "0.3", "0.4")): |
There was a problem hiding this comment.
@will-moore This is the check that was really the main dealbreaker for allowing backward compatibility for now in SpatialData. If fmt.version does not exactly match here, the ome key is assumed in attrs.
There was a problem hiding this comment.
maybe we should just do:
if "ome" in attrs:
attrs = attrs.get("ome", {})
There was a problem hiding this comment.
it would be less explicit regarding versions though, so I am not certain whether that would be favorable.
There was a problem hiding this comment.
FWIW version 0.4 of the OME-Zarr specification places no restrictions on version numbers, saying:
Each "multiscales" dictionary SHOULD contain the field "name". It SHOULD contain the field "version", which indicates the version of the multiscale metadata of this image (current version is 0.4).
(and similar SHOULD statements for other metadata), so it would possibly be fine to not be explicit regarding the version?
There was a problem hiding this comment.
Ahh - but here we're not reading the version from an OME-Zarr (where the version could be missing), we're writing the OME-Zarr according to a format version that we specify.
And I realise that checking for "ome" in attrs for set_metadata() won't always work as the group may not have any existing attributes.
So let's go with the proposed changes and we can think about a more fancy version parser in future as needed.
There was a problem hiding this comment.
Great, would be happy to contribute if it is required.
|
Hi there! I wonder if there's any progress on this? Or is there anything that I can help with? |
|
I will close this PR, after talking yesterday together with @joshmoore , @jo-mueller and @LucaMarconato to discuss the potential implications and concerns of @sbesson, we have chosen for the option of overwriting the Prior to reading we then also check the metadata for the version and then request the corresponding ome-zarr version when calling This leaves still the issue that there should be a way to deviate in case of ome development versions and that there should be a way to indicate something like:
However, this is a RFC process. |
|
Thanks @melonora for the summary. Reflecting a bit on the discussions I had with various OME members here, I believe what happened here was the outcome of a classical conflict between:
From OME's previous experience with formats, this type of tension is not specific to OME-Zarr by any means. In my opinion, the approach described in #491 (comment) i.e. use this library with a canonical OME-Zarr version and then let the SpatialData library override the metadata/binary data wherever applicable is a solid workaround which respects the requirements/needs of each library. To the last point, I am very supportive of defining development OME-Zarr versions formally moving forward. The main concern was to effectively make these decisions implicitly by encoding them in a implementation. I think this topic deserves its own RFC. This might be very timely given the current discussions around the OME-Zarr 1.0 roadmap as I suspect another point to codift over the next few months will be the expectations in terms of compatibility between the different OME-Zarr versions. |
In SpatialData we use
RasterFormatversions for writing images and labels. In discussion with @joshmoore and @bogovicj the version forRasterFormatV02is0.4-dev-spatialdata(PR here). This leads to problems with newer ome-zarr-py versions that support zarr v3. Reason for this is checks inwriter.pythat check things like the following:fmt.version not in ("0.1", "0.2", "0.3", "0.4"):, which leadsomemetadata to be written which is specifically for Formats supporting zarr v3. This PR uses.startswithto check for the version in the string.In SpatialData I already checked whether this re-enables compatibility with zarr, which it does.
Note: In SpatialData so far all formats were based on FormatV04. Therefore, there are no issues with the other formats. Changing from FormatV04 to FormatV05 gives the problem at the moment and then only when it was using RasterFormatV02, given that the version here is not
0.4, but0.4-dev-spatialdata. RasterFormatV01 does not have this issue as the version here was specificied as0.4.Alternatives
if "ome" in attrs: attrs = attrs.get("ome", {}). This is not explicit regarding versions.0.4and "0.5" (later when there is a "0.6) which to the best of my knowledge is the only case in which an alternative version name was accepted that previously worked. Comment the reason for this exception and that this will not be supported for other versions. Reason for0.5as well is that we do not expect to be entirely compliant yet.Globalif present. Then we can handle the matching on our side.