Closed sk1p closed 1 year ago
I agree that some form of auto-set for outliers would be good, perhaps tied to a button. I will integrate the holo code upstream.
I assume you've seen the colormap controls in the image toolbox ?
The layout of this floatpanel needs some work but it does at least let you adjust the range manually. There will be a way to make outlier clipping the default state, deactivatable by the user, and applicable on command with a button press.
I have an 'Auto-range' button in a branch which works for on-demand outlier correction:
Making this automatic is more delicate as computing the mean / std of a big array is fairly costly, and if the image is being updated frequently then this could actually slow down the display. I'm already computing the min/max internally, accounting for NaN data in a 'reasonable' way, and I'd have to do the same for the mean/std. In the case of a static or manually changing image it's perfectly feasible of course, I just need to figure out where to provide some sort of config / toggle to enable it (on the backend).
I assume you've seen the colormap controls in the image toolbox ?
Yup. It was a bit fiddly to use, as in the specific case, the outliers were way outside of the normal range, so vmin/vmax were very close on the slider, and you have to remember to "freeze color limits" afterwards, as you lose your settings otherwise when navigating/zooming around.
I have an 'Auto-range' button in a branch which works for on-demand outlier correction:
Great!
Making this automatic is more delicate as computing the mean / std of a big array is fairly costly, and if the image is being updated frequently then this could actually slow down the display. I'm already computing the min/max internally, accounting for NaN data in a 'reasonable' way, and I'd have to do the same for the mean/std. In the case of a static or manually changing image it's perfectly feasible of course, I just need to figure out where to provide some sort of config / toggle to enable it (on the backend).
Yeah, I'm already happy with the manual button approach, everything else is more in the nice-to-have category I think.
you have to remember to "freeze color limits" afterwards, as you lose your settings otherwise when navigating/zooming around.
This is definitely undesirable, I will make sure that navigation doesn't change the colour scale, only image updates.
While I'm at it I'll add the colorbar in image-viewer.
It was a bit fiddly to use, as in the specific case, the outliers were way outside of the normal range, so vmin/vmax were very close on the slider
I noticed this too, in the autorange implementation it actually modifies the slider min/max as well as the currently applied range so it's a bit nicer to use!
Closed through upstream PR
With some data, it's common to have outliers that will make the automatic histogram stretching almost useless. An option to clip these outliers would be very useful. Maybe this code can be adapted/stolen for this (as I'm the author, I hereby re-license this code as MIT, FWIW):
https://github.com/LiberTEM/LiberTEM-holo/blob/47ddc00aa0fd7deda74d65e4c940bebee396e6ae/src/libertem_holo/base/filters.py#L14-L31
(I'm not sure, maybe this also belongs in the LiberTEM-panel-ui project, just let me know or move it over as you like)