Skip to content

Clarify: "as many axes as array ndim" only applies to multiscales intrinsic system - #227

Open
btbest wants to merge 1 commit into
ome:0.9devfrom
btbest:fix-coordsys-ndim-intrinsic-only
Open

btbest wants to merge 1 commit into
ome:0.9devfrom
btbest:fix-coordsys-ndim-intrinsic-only

Conversation

@btbest

@btbest btbest commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Accompanies forum post https://forum.image.sc/t/ome-zarr-0-6-and-newer-accidentally-forbid-ndim-changes/123425

This PR merges into 0.9dev, because that's the minimum where it should be fixed. The problem it addresses already exists in the 0.6 text, so it could be considered if this should also be post-fixed onto 0.6.


Post duplicated here for convenience:

I had an agent on an unrelated task; it noticed a little problem in the spec phrasing:

("axes" metadata)
The values in the `name` fields MUST be unique within the same coordinate system.
The length of “axes” MUST be equal to the number of dimensions of the arrays that contain the image data.

This plainly forbids defining coordinate systems whose number of axes does not match "the image data", and it's a blanket statement in the general "axes" section, i.e. it applies to both multiscales and scenes.

The same requirement is reiterated specifically for multiscales later, also without a qualifier that it only applies to the multiscale's "intrinsic" system (i.e. it applies to all of the multiscale's systems):

("multiscales" metadata)
The `coordinateSystems` field is a JSON array containing [coordinate system metadata](https://ngff.openmicroscopy.org/specifications/0.6/index.html#coordinate-systems-md) The following conditions apply to all coordinate systems inside multiscales metadata:
* The length of `axes` must be between 2 and 5 and MUST be equal to the dimensionality of the Zarr arrays storing the image data (see `datasets:path`).

The problem: I do think the point of defining coordinate transformations that can change dimensionality ("projectAxis", "affine", "coordinates" and "byDimension") was to enable coordinate systems with different numbers of axes. In the context of scenes, requiring coordinate systems to match "the image data" could be interpreted as requiring all image data in the scene to have the same ndim.

I don't actually think anyone intended this restriction. I don't recall it ever being mentioned, and neither ngff-zarr nor the official conformance tester enforce it. The conformance tester even supplies a projectAxis example that contradicts this phrasing, and calls it valid. The spec phrasing is quite unambiguous though.

Fix: I'm assuming this was really an accident, so I'm optimistic that no one would object to fixing the phrasing. The text change I'd propose is very small, and I've put it in a PR. The reason I'm posting here is to see if there are objections, because if it was an intentional rule, removing it is a serious change.

The concrete proposed text changes:

  1. In the "axes" section, the point about dimensionality is removed and instead specifies "axes" MUST contain at least one object".
  2. In the "multiscales" section, the two bullet points about "axes" array length and ordering are removed from the "applies to all coordinate systems" paragraph. They are instead moved to a new "applies to the intrinsic coordinate system" paragraph directly below.

Related (same point): fideus-labs/ngff-zarr#859

@btbest
btbest marked this pull request as draft December 3, 2026 09:53
@imagesc-bot

Copy link
Copy Markdown

This pull request has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/ome-zarr-0-6-and-newer-accidentally-forbid-ndim-changes/123425/1

@lubianat
lubianat requested a review from jo-mueller December 3, 2026 13:52
@bogovicj

bogovicj commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Thanks @btbest !

I do think the point of defining coordinate transformations that can change dimensionality... was to enable coordinate systems with different numbers of axes.

Correct.

As you wrote, the purpose of the most strict text was to ensure that for images, the intrinsic coordinate system has the same number of dimensions as the array. Your edits reflect that, so I approve!

@btbest

btbest commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor Author

I edited the PR description to add the point regarding 0.6; I've set this up to merge into the 0.9dev branch, but I think since this is more of a clarification of original intention, it would be justified to also backport it to 0.6.

@btbest
btbest marked this pull request as ready for review December 3, 2026 15:42

This branch has not been deployed

No deployments
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.

3 participants