fix(lif): drop stale tile Y/X coords in grid- and stage-stitch reassemblers (cut v0.6.0)#44
Merged
Merged
Conversation
…mblers
reassemble_grid and reassemble_stage both preserved every input coord whose
dims didn't touch M, which meant a per-tile Y/X pixel-space coord — attached
by real bioio-lif readers — was carried onto a canvas of a different size,
tripping xarray's dim/coord validator with
CoordinateValidationError: conflicting sizes for dimension 'Y':
length 6144 on the data but length 2048 on coordinate 'Y'
The synthetic FakeReader fixtures never attach Y/X coords, so this only
surfaced on a real 3x3 Leica LIF (2048x2048 tiles -> 6144x6144 canvas).
Fix: drop any coord whose dims touch Y or X, alongside the M-indexed ones.
Non-spatial coords (T/C/Z, channel names) still survive untouched.
Add regression tests to test_lif_tiles.py that attach tile-sized Y/X
coords before calling each reassembler; both would have failed pre-fix.
Cut v0.6.0 in CHANGELOG.md, bundling this fix with the unreleased #40
stage-stitch feature. Minor bump because #40 added a fourth public value
on lif_mosaic since v0.5.0 — pure patch under-signals the surface change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix:
reassemble_gridandreassemble_stageboth preserved every input coord whose dims didn't touchM, which meant a per-tile Y/X pixel-space coord — attached by real bioio-lif readers — was carried onto a canvas of a different size. On the astrocytes LIF (48 scenes, 3x3 mosaics, 2048x2048 tiles → 6144x6144 canvas) that tripped xarray's dim/coord validator with:Fix: drop any coord whose dims touch Y or X, alongside the M-indexed ones. Non-spatial coords (T/C/Z, channel names) still survive untouched.
Regression tests: two new tests in
test_lif_tiles.pyattach tile-sized Y/X coords before calling each reassembler; both would have crashed pre-fix. The syntheticFakeReaderfixtures don't attach Y/X coords, which is why CI stayed green while the real Leica LIF blew up.Cut v0.6.0: bundles this fix with the unreleased
#40stage-stitch feature. Minor bump because#40added a fourth public value onlif_mosaicsince v0.5.0 — pure patch would under-signal the surface change.Test plan
uv run pytest tests/test_lif_tiles.py tests/test_lif_grid_stitch.py tests/test_lif_stage_stitch.py— 70 passed locallyuv run pytest— full suite: 324 passedv0.6.0on the merge commit and re-run the astrocytes-LIF three-way comparison (auto-stitchvsgrid-stitchvsstage-stitch) that motivated this fix — that's the actual#41deliverable🤖 Generated with Claude Code