Repository navigation
Make differing channel names at one channel number an error - #42
Conversation
Channels are matched by number: the table's per-channel columns, pooling and later bricks' scaling. With channel 0 named "DAPI" in one image and "Actin" in another, both were pooled as one channel and only a warning said so. channel_names_differ is now an error that blocks check and run, with an action to fix the channel order or exclude the images. Only named channels are compared, as before. Contract §2/§8/§9/§11, user guide, plan Q1 (revised decision), AGENTS.md and the notebook text are updated. Fixes #37 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Scma6W3LC11s3qjXHZuGDm
Review of #42 (issue #37): - OME-Zarr copies wrote the placeholder label "Channel <i>" for channels their source leaves unnamed, so re-reading the copies (for example beside the copy of a named image) failed the now exact channel_names_differ check. Copies now write a label only for names from the source's metadata, and a copy carrying placeholder labels counts as changed and is converted again (copy_channels_current). Its rows do not change. - Names stay compared exactly (no normalization, no override). When they differ only in whitespace, the message quotes them and says so, since the difference is otherwise invisible. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VbytvBRB9CmKQ5AAkhEFcv
Owner decision on #42 (issue #37): channel names stay compared exactly with no override, but leading and trailing whitespace is removed when names are read, uniformly for every image (OME-TIFF, OME-Zarr and this brick's own copies), so "DAPI " and "DAPI" are one name. Whitespace inside a name still counts ("DA PI" and "DAPI" differ). Trimming is recorded per file in the run manifest (channel_names_trimmed, optional key, false when absent) and logged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VbytvBRB9CmKQ5AAkhEFcv
|
Review follow-up, pushed as 99b518d and d812269:
Generated by Claude Code |
Review of #42 (issue #37): read_channel_names turned a non-text omero label (a number, list, object or boolean) into an unnamed channel, so the image silently escaped the exact channel_names_differ check. Such a label is malformed metadata; open_ngff now raises NgffError, and the image is unreadable_ome_zarr. Regression test test_channel_label_that_is_not_text_is_refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VbytvBRB9CmKQ5AAkhEFcv
|
Reviewed 99b518d/d812269 and added ea706fd (an OME-Zarr channel label that is not text is refused as Generated by Claude Code |
Summary
Fixes #37 (the preprocessing side; the issue tracks the MorphoFeature side separately).
channel_names_differis now an error. Before, it was a warning. The code name, the comparison and the listed paths are unchanged. The message says why this blocks processing: channels are matched by number, so different stains would be pooled as one channel. The action says to fix the channel order, or export again, or exclude the images.channel_nameswhen it is not empty) and §11 (runstops on it);Why
At v0.3.1, image A could name OME channel 0 "DAPI" while image B named it "Actin". Their histograms were pooled as one channel with only a warning, and a later brick could fit "DAPI" scaling on Actin pixels.
Decisions / notes for review
Tests
tests/test_metadata.py::test_differing_channel_names_are_an_error(renamed from..._are_a_warning) now checks for an error.tests/test_run.py::test_differing_channel_names_stop_the_run, with DAPI and Actin at channel 0. Nothing is written.test_manifest_records_channel_names_and_significant_bitsnow uses matching names, because differing names no longer give a manifest.test_discovery.py:472: running as root ignores file modes.ruff check .andruff format --check .are clean.Generated by Claude Code