-
Notifications
You must be signed in to change notification settings - Fork 6
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
brightness percentiles set in live viewer images #1973
Conversation
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.
Looking good. A couple of comments.
- Could you add a test
@@ -166,3 +170,8 @@ def update_sibling_histograms(self): | |||
for img_view in self.histogram_siblings: | |||
with BlockQtSignals(img_view.hist): | |||
img_view.hist.setLevels(*hist_range) | |||
|
|||
def use_brightness_percentiles(self, image: np.ndarray, percent_low: int, percent_high: int, *args, **kwargs): |
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.
We don't need the *args, **kwargs
part here, as its not being passed through in the this method.
@@ -35,7 +35,8 @@ def show_image(self, image: np.ndarray) -> None: | |||
Show the image in the image view. | |||
@param image: The image to show | |||
""" | |||
self.image.setImage(image) | |||
self.image.use_brightness_percentiles(image, 5, 95) | |||
self.image.setImage(image, levels=self.image.brightLevels) |
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.
Can MIMiniImageView.setImage()
do a check to see if the percentiles are being used, so that levels does not need to be passed in from outside. So this part would be
self.image.use_brightness_percentiles(image, 5, 95)
self.image.setImage(image)
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.
Thanks. Looks good.
Issue
Closes #1964
Description
In the Live Viewer, the brightness of the image is now set using the 5th and 95th percentiles rather than min/max. This removes outliers and makes the brightness of the images consistent and easier to compare as data is read in.
Percentiles can be changed via
self.image.use_brightness_percentiles(image, low, high)
inmantidimaging/gui/windows/live_viewer/live_view_widget.py
wherelow
andhigh
are the lower and higher percentiles respectively. The brightness levels are then passed thoughself.image.setImage(image, levels=self.image.brightLevels)
in the Live Viewer only put are left as min/max elsewhere.No slowdown has been noticed due to the percentile calculations.
Testing
Data was fed through the Live Viewer to verify the outliers where left out and the image brightness was consistent. This auto levelling is not done in normal operations outside of the Live Viewer.
Acceptance Criteria
Check standard tests and check brightness levels are correct in the Live Viewer.