Warn when r/g/b channels have divergent ranges#682
Merged
Conversation
Global normalization in the RGB path silently crushed low-range channels when channels named r/g/b actually held fluorescence-like data with very different native ranges. Emit a warning when per-channel ranges differ by more than 100x so users know to rename channels or supply per-channel cmaps.
- Compute per-channel min/max on original dtype with axis=(1,2) instead of copying to float64 and reshaping. - Add tests confirming the warning also fires for RGBA, and stays quiet on the multichannel (non-r/g/b-named) and user-norm paths.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #682 +/- ##
==========================================
+ Coverage 77.79% 77.83% +0.04%
==========================================
Files 11 11
Lines 3693 3709 +16
Branches 877 881 +4
==========================================
+ Hits 2873 2887 +14
- Misses 490 491 +1
- Partials 330 331 +1
🚀 New features to boost your workflow:
|
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_images, per-channel ranges that differ by more than 100x are flagged with alogger.warningbefore global normalization runs.r/g/bis treated as a deliberate intent signal, so the existing normalization behavior is preserved — we just stop being silent when low-range channels are about to be crushed.norm(that branch already normalizes per channel).