Add per-channel norm support for render_images#572
Open
Conversation
Accept a list of Normalize objects in render_images so each channel can be normalized independently — essential for multi-channel protein data with vastly different intensity ranges. The rendering pipeline already reads per-channel norms from CmapParams, so this change only widens the input validation and routes per-channel norms into the existing CmapParams creation loop. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s only - Use resolved per-element cmap for list branching so norm list works correctly when cmap is auto-replicated - Raise ValueError when norm is a list but cmap is not (no silent pass-through to _prepare_cmap_norm) - Restrict list norm validation to element_type="images" only — labels has no list-norm support - Add test for norm list without explicit cmap list Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Summary
render_imagesnow accepts a list ofNormalizeobjects for per-channel normalizationCmapParams— this change only widens validation and routes per-channel norms into the existingCmapParamscreation loopChanges
basic.py: Widennormtype tolist[Normalize] | Normalize | None, update docstring, zip norm list with cmap listutils.py: Acceptlist[Normalize]in validation, reject empty lists and non-Normalize elementstest_render_images.py: 5 new tests (per-channel norm, backward compat, length mismatch, empty list, invalid element)Usage
Test plan
ValueErrorValueErrorTypeError🤖 Generated with Claude Code