Repository navigation
Image type, fluorescence or RGB, in step 2 and the manifest (P4) - #28
Merged
Merged
Conversation
Step 2 asks for the image type once the axis roles are confirmed, with RGB suggested for TIFF images stored as RGB colour on the channel axis and confirmed with a yellow question; RGB needs three integer channels (the normalization brick's check_rgb). The manifest records image_type and channels_from_rgb_samples as optional keys (version 1); changing the type recomputes nothing. The command line takes --image-type or prints the suggestion. Plan question 29. Co-Authored-By: Claude Opus 5.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.
Follow-up P4 of the normalization plan (
docs/followup_preprocessing.md§P4 in morphobricks-normalization; its contract §5 and decision N34): the image type, fluorescence or RGB, suggested from the metadata, confirmed by the user and recorded in the run manifest. Plan §12 question 29.Summary
metadata:TiffMetadata.rgb_samples, read from the header: True for a TIFF whose first series is photometric RGB with three samples per pixel (axisS). RGB with alpha, grey samples and OME-Zarr images are False.image_type(new):FLUORESCENCE,RGB,check_image_type;review_image_type(metadata, review)gives the suggestion (RGB only when every analysed image is RGB colour with the confirmed C role on its samples axis, and RGB is possible), the reason,channels_from_rgb_samples, the channel count and why RGB is not possible (the normalization brick'scheck_rgb: three channels of an integer type);image_type_issuesgives the errorrgb_not_possible.axes:channel_countis public (was_channel_count).run:run_experiment(..., image_type=None)records the type;rgbfor images that cannot be RGB isrgb_not_possible(nothing written); any other value raisesValueError.RunResult.image_type.manifest: optional top-level keysimage_type(null without one) andchannels_from_rgb_samples; manifest version 1. Changing the type is not a rebuild reason, so nothing is recomputed.cli:run --image-type fluorescence|rgb; without it the suggestion is used and printed with its reason and how to choose the other type (or why RGB is not possible).checkprints the suggestion.run_summarynames the type.notebook_ui/notebook_style: step 2 gets an Image type card once the axis roles are confirmed: radio buttons with the suggestion preselected, a blue note with the reason (amber when the user picks the other type), and the yellow question with Yes, this is the right image type / Undo. When RGB is impossible the choice is disabled at Fluorescence with the reason (ipywidgets cannot disable a single radio option). Changing the axis roles or the folder resets it. Step 3's checklist gains "Confirm the image type (step 2)", "What will happen" names the type, and "What next?" asks for it.ConfirmToggle.confirmed_textis settable so the green message names the type. The card is the same when step 2 is embedded (question 26).Decisions
Asked of the owner before coding: the manifest key is
channels_from_rgb_samples(next toimage_type, both top-level and optional). Taken from the spec: never applied without confirmation; RGB needs three integer channels; manifest stays version 1; changing the type recomputes nothing. Taken here and recorded in question 29:run_experimenttakes the type optionally (null in the manifest without one), like the experiment design; RGB is suggested only when every analysed image has RGB samples on the C axis.Notes for review
plane_histograms.csvandexperiment_design.csvare unchanged; no schema or manifest version change.check_rgb's rule (any integer type) is used; its message says "8- or 16-bit", as does ours.embed_minimal_htmland looked at in a browser (standalone renders lack JupyterLab styles and icons). Not looked at in a real JupyterLab.Tests
ruff check .andruff format --check .clean; LF line endings.tests/test_image_type.py(header flag, suggestion, RGB rule, run and manifest, reruns read nothing); CLI, manifest round-trip and notebook tests (suggestion preselected but not used until confirmed, RGB disabled with the reason, reset on role or folder change, embedded step 2 gating).🤖 Generated with Claude Code