-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] volume rendering: sigma_clip normalization #3984
[BUG] volume rendering: sigma_clip normalization #3984
Conversation
nz = im[im > 0.0] | ||
nim = im / (nz.mean() + sigma_clip * np.std(nz)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a note to reviewers: this was the source of the bug. It should only normalize based on the RGB channels (i.e., im[:,:,:3]
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome. Nice catch. I never got around to digging deeper, so I'll happily review your PR ;)
I confirmed the output that this works as expected. Nice work @chrishavlin !! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job ! Found one caveat that can be fixed easily. I’ll merge when it’s dealt with
Co-authored-by: Clément Robert <cr52@protonmail.com>
…lipping [BUG] volume rendering: sigma_clip normalization
This closes #3979 and fixes an unreported bug in which not providing a
sigma_clip
value while trying to save a non-png results in a crash.There were several spots where
sigma_clip
was used to calculated a clipping value, the version insave_annotated
incorrectly included the alpha channel in the calculation. I added aImageArray._clipping_value
method to cut down on some of the duplicate code.Here's a script based on the cookbook example mentioned in #3979
The
save_annotated
andsave
versions now match: