Restore RGB mosaic-view save (closes the untracked R7-cited regression) - #615
Open
maragall wants to merge 1 commit into
Open
Restore RGB mosaic-view save (closes the untracked R7-cited regression)#615maragall wants to merge 1 commit into
maragall wants to merge 1 commit into
Conversation
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>
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.
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