Improve display histogram level choice#1982
Merged
petebankhead merged 1 commit intoqupath:mainfrom Aug 23, 2025
Merged
Conversation
Avoid using extremely small pyramid levels when calculating histograms for the image display.
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.
Avoid using extremely small pyramid levels when calculating histograms for the image display.
The simple heuristic is that we choose the highest resolution that gives us an image with no more than 1024x1024 pixels - or the lowest resolution level, if no level satisfies this rule.
Previously we always chose the lowest-resolution in QuPath v0.6.0.
This addresses #1958
With the PR, the image from https://zenodo.org/records/16569043 displays sensibly.
But it also makes a difference for common OpenSlide test images OS-2.ndpi and similar.
It seems their lowest resolution level has a downsample of 4096, and dimensions of 31x18 pixels.
So histograms generated from these were terrible.
Therefore this PR helps the Brightness/Contrast dialog behave more sensibly with these images too, selecting from resolution level 8 of 13 (rather than 13).
Examples for the hematoxylin image, extracted from OS-2.ndpi using default stain vectors:
In v0.6.0

With this PR
