Skip to content

Restore RGB mosaic-view save (closes the untracked R7-cited regression) - #615

Open
maragall wants to merge 1 commit into
Cephla-Lab:masterfrom
maragall:mosaic-rgb-save
Open

Restore RGB mosaic-view save (closes the untracked R7-cited regression)#615
maragall wants to merge 1 commit into
Cephla-Lab:masterfrom
maragall:mosaic-rgb-save

Conversation

@maragall

Copy link
Copy Markdown
Contributor

The mosaic-view save currently SKIPS RGB layers with a comment citing plan R7 - but R7's deferred-work list never mentions RGB overview saving; this was an untracked regression, not a planned deferral. Consequence: with a gray MULTIPOINT_BF_SAVING_OPTION (RGB2GRAY / Green Channel Only), the per-frame color is destroyed at save AND no colored overview survives, so nothing downstream can ever restore it. Older Squid wrote rgb_channel_names / rgb_view_files plus a colored PNG in the mosaic sidecar, and SquidXplorer's stain-color reconstruction reads exactly those keys (verified against a customer acquisition from the older version).

This restores the RGB overview save: snapshot_for_save collects RGB (H,W,3) layers instead of skipping; write_save_snapshot writes one PNG per RGB layer (mosaic{mode}{res}_{name}.png, RGB48 uint16 canvases converted to 8-bit) and appends rgb_channel_names / rgb_view_files to the sidecar in the old spelling and order. The monochrome ome.tiff path is byte-identical; per-well TIFFs untouched.

Tests: 4 new in tests/control/test_unified_mosaic_widget.py (13 total in the file, green under native cocoa; the first pre-existing napari test segfaults under offscreen GL on macOS, pre-existing and unrelated). Honest caveat: this restores the ~2 um colored OVERVIEW record only - a gray saving option still destroys per-frame color, so Raw remains the recommendation for colorimetric work.

🤖 Generated with Claude Code

The unified mosaic/plate refactor dropped RGB layers from the mosaic-view
save entirely (_snapshot_for_save skipped them with 'not supported yet',
deferred as plan R7). With MULTIPOINT_BF_SAVING_OPTION set to RGB2GRAY or
Green Channel Only, the per-frame color is already destroyed at save time,
so the colored mosaic-view PNG that older Squid wrote was the ONLY
surviving record of BF stain color. Downstream consumers, e.g.
SquidXplorer's stain-color reconstruction, read the sidecar's
rgb_channel_names / rgb_view_files keys to restore it; current Squid
acquisitions gave them nothing to read.

RGB layers are now collected alongside the monochrome channels and, when
SAVE_DOWNSAMPLED_OVERVIEW is on, written as 8-bit RGB PNGs
(mosaic_<mode>_<N>um_<name>.png, spaces to underscores like elsewhere in
the repo) with rgb_channel_names / rgb_view_files recorded in the yaml
sidecar under the exact key spelling older Squid used, so existing
consumers read the new sidecars unchanged. The monochrome path is
untouched: same ome.tiff, same sidecar keys, and per-well TIFFs stay
monochrome-only. A snapshot is now skipped only when BOTH lists are empty.

Tests: TestRGBMosaicSave in test_unified_mosaic_widget.py covers snapshot
collection, PNG + sidecar writes, the RGB-only case (uint16 RGB48 scaled
to 8-bit), and that mono-only sidecars carry no rgb keys.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant