Skip to content

Feature: PCA aggregation for n >= 4 channels in render_images #451

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

timtreis
Copy link
Member

I think the current implementation doesn't correctly handle images with 3+ channels, for example resulting in the following warning when rendering a 5 channel image:

Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers). Got range [0.01870049980776624..2.4537485582468284].
image

This PR proposes an alternative in which PCA is used to reduce an arbitrary amount of channels to 3 so that we can treat them as RGB:

image

@timtreis timtreis linked an issue Apr 22, 2025 that may be closed by this pull request
@timtreis
Copy link
Member Author

@Sonja-Stockhaus did we discuss this at one point? I've been ignoring that warning for a long time because it's thrown my matplotlib and doesn't fail

@timtreis
Copy link
Member Author

image
This PR also introduces a bg_threshold parameter based on which we can exclude pixels for the PCA normalisation, f.e. in this composite

@timtreis timtreis marked this pull request as draft April 23, 2025 12:30
@Sonja-Stockhaus
Copy link
Collaborator

@Sonja-Stockhaus did we discuss this at one point? I've been ignoring that warning for a long time because it's thrown my matplotlib and doesn't fail

Nope. I also don't remember ever trying to render sth with 3+ channels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: PCA aggregation for n >= 4 channels in render_images
2 participants