feat(converter): automatic channel color detection#47
Open
BrianWhitneyAI wants to merge 3 commits into
Open
Conversation
Add bioio_conversion.channel_colors with get_channel_colors(), which derives an OME-Zarr display color per channel, and wire it into OmeZarrConverter so channels are colored automatically instead of all defaulting to white. Color policy (per channel): - Brightfield / transmitted-light channels -> white, and do not consume a fluorescent palette slot. Detected via OME contrast_method / illumination_type with a channel-name fallback. - Recognized fluorophores -> their true emission color via the FLUOROPHORE_COLORS table (e.g. GFP -> green, AF647 -> red). - Remaining channels -> a count-based, perceptually-distinct palette (green / green+magenta / cyan-yellow-magenta / +Okabe-Ito), ordered by emission wavelength when available. Black is never assigned. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
BrianWhitneyAI
force-pushed
the
feature/auto-channel-colors
branch
from
June 17, 2026 16:46
59b4fd6 to
3ac9b69
Compare
Base automatically changed from
feature/v3-direct-czi-read
to
feature/v3-sharding-policy
June 17, 2026 19:54
BrianWhitneyAI
marked this pull request as ready for review
July 6, 2026 21:51
BrianWhitneyAI
requested review from
SeanDuHare,
aswallace,
kmitcham,
pgarrison and
toloudis
July 6, 2026 21:51
kmitcham
reviewed
Jul 7, 2026
| """Lower-case ``text`` and strip every non-alphanumeric character. | ||
|
|
||
| This collapses fluorophore spellings to a canonical token so that, e.g., | ||
| ``"Alexa Fluor 488"`` and ``"AF-488"`` both reduce to a comparable form. |
There was a problem hiding this comment.
This comment confused me; the outputs of the two examples would "af488"
"alexafluor488" don't compare to each other, but rather match a value in the COLORS dict.
Maybe the example should be
"Alexa Fluor 488" and "ALEXA FLUOR-488" collapse to "alexafluor488" to allow a match with value in FLUOROPHORE_COLORS
kmitcham
approved these changes
Jul 7, 2026
…colors # Conflicts: # bioio_conversion/__init__.py # bioio_conversion/converters/ome_zarr_converter.py
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
Resolves #25
Adds automatic channel display color detection to the OME-Zarr converter. Previously every channel was written with a hardcoded white (
#FFFFFF) OMERO color; now each channel gets a meaningful color derived from its metadata.This ports the recipe from #42 (the standalone
get_channel_colorsexperiment) and wires it intoOmeZarrConverterso colors are assigned during conversion without any caller changes.Color policy (applied per channel)
contrast_method/illumination_type, with a channel-name fallback (BF,TL,DIC, "phase contrast", …).FLUOROPHORE_COLORStable (e.g. GFP → green, TaRFP → orange, AF647 → red). Matches the OMEfluorfield or the channel name.So identity wins when known, and the distinct palette fills the rest.
Changes
bioio_conversion/channel_colors.py—get_channel_colors()plus the fluorophore/brightfield/palette helpers. Exported from the package__init__.OmeZarrConverter._resolve_channels— derives per-channel colors viaget_channel_colorsinstead of hardcoding white. Explicit user-suppliedchannels=still take precedence; no-channel-axis behavior unchanged.bioio_conversion/tests/test_channel_colors.py— 24 tests.Verification
s_3_t_1_c_3_z_5.czi: EGFP→green, TaRFP→orange (FFA500), Bright→white — confirmed in the written OMERO metadata.🤖 Generated with Claude Code