Skip to content

feat(viewer): carry RFC-4 axis orientation through to the reader - #163

Merged
davehorsfall merged 1 commit into
test/rfc4-orientation-corpusfrom
feat/158-orientation-passthrough
Nov 5, 2026
Merged

davehorsfall merged 1 commit into
test/rfc4-orientation-corpusfrom
feat/158-orientation-passthrough

Conversation

@davehorsfall

Copy link
Copy Markdown
Member

Phase 0 of #158: RFC-4 axis orientation survives being read. Nothing in the interface uses
it yet.

Draft: this pins zod-ome-ngff to an unmerged branch.
viewer/package.json points at #feat/rfc4-axis-orientation so the work could proceed
while BioNGFF/zod-ome-ngff#2 is still open. That must go back to #dev before this
merges.

Based on test/rfc4-orientation-corpus (#160), not dev — it extends the corpus tests
added there with the orientation assertions this change makes possible.

What changed

Axes now reach SourceData as the metadata declared them, not only as a list of names, so
orientation and unit are available to whatever reads them next.

Two separate things were dropping the field, and either alone was enough to lose it:

A test that passed for the wrong reason

The first version of the offline test covered images only, and passed with the fix
reverted
. A plain image never goes through getNgffAxes at all: it reads its axes via
getDefaultCoordinateSystem, which returns them untouched. For images the schema was the
only thing stripping orientation.

getNgffAxes is on the plate and well paths. With those added, reverting the change fails
properly:

FAIL  tests/local-fixtures.test.ts > RFC-4 axis orientation survives reading a plate
FAIL  tests/local-fixtures.test.ts > RFC-4 axis orientation survives reading a well
AssertionError: expected [ null, null, null, null, null ] to deeply equal [ null, null, …(3) ]

So the test now covers an image, a plate and a well, because each reaches its axes through
different code and each has its own way of losing the field.

Fixtures

The generated fixtures gained orientation on their spatial axes, using the values from the
RFC's own example so the two can be read side by side. The time and channel axes are left
alone — RFC-4 permits orientation only on space.

This is so the offline suite covers orientation at all: the conformance corpus is the
better test of it and is remote, which means CI never runs it. The fixture diff is purely
additive.

Checks

  • pnpm test — 50 passed, up from 46
  • pnpm test:remote for the corpus — 41 passed, now asserting orientation reaches the
    viewer rather than only that the corpus declares it
  • pnpm lint, pnpm check — clean
  • Verified the change is load-bearing by reverting it, as above

Next

Phase 1 is the interface: edge labels for in-plane axes, direction on the slider for the
through-plane one. Phase 2 is the warnings. Both are described in #158.

🤖 Generated with Claude Code

Phase 0 of #158: the metadata survives being read. Nothing in the interface uses
it yet.

Axes now reach `SourceData` as the metadata declared them, rather than only as a
list of names, so orientation and unit are available to whatever reads them next.

Two separate things were dropping the field, and either alone was enough to lose
it. The schema stripped it, since a non-strict `z.object` discards what it does
not declare; that is fixed in BioNGFF/zod-ome-ngff#2. And `getNgffAxes` rebuilt
every axis from `name`, `type` and `unit`, which it now spreads instead -- the
next RFC to add a field would otherwise be lost in the same place.

WHILE THE SCHEMA PULL REQUEST IS OPEN this pins `zod-ome-ngff` to its branch.
That must go back to `#dev` before this is merged, and is why this is a draft.

A plain image, a plate and a well read their axes through different code, so each
had its own way of losing the orientation, and the tests cover all three. An
image never passes through `getNgffAxes` at all -- it reads axes through
`getDefaultCoordinateSystem`, which returns them untouched -- so a test of images
alone passed with the fix reverted. The plate and the well are what make it
load-bearing.

The generated fixtures gained orientation on their spatial axes, using the values
from the RFC's own example, so the offline suite covers it at all: the
conformance corpus is the better test and is remote, which means CI never runs
it. The time and channel axes are left alone, since RFC-4 permits orientation
only on axes of type `space`.

Offline 46 to 50 tests. The corpus tests now assert orientation reaches the
viewer rather than only that the corpus declares it.

Refs #158

Co-Authored-By: Claude Opus 5 <[email protected]>
davehorsfall added a commit that referenced this pull request Nov 3, 2026
The page used "today" to mean two different things one section apart: that an
image carrying orientation opens normally, which is true of the release, and
that TC-C_invalid_vocabulary does not open, which is only true once the reader
starts validating orientation on #163. A reader on the released viewer would
have found the second claim false and had no way to tell why.

Each behaviour now names the version it belongs to. The note about TC-C being
untested says what the choice is -- not writing a test that pins down a decision
still open -- rather than claiming the case cannot be opened at all, which is
untrue on `dev`.

Co-Authored-By: Claude Opus 5 <[email protected]>
@davehorsfall
davehorsfall marked this pull request as ready for review November 5, 2026 15:09
Copilot AI balanced review requested due to automatic review settings November 5, 2026 15:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@davehorsfall
davehorsfall merged commit 6d02da0 into test/rfc4-orientation-corpus Nov 5, 2026
@davehorsfall
davehorsfall deleted the feat/158-orientation-passthrough branch November 5, 2026 15:11
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.

2 participants