DiamondLightSource / httomolib

A library of data processing and reconstruction methods for tomography
https://diamondlightsource.github.io/httomolib/
BSD 3-Clause "New" or "Revised" License
0 stars 3 forks source link

Fix the ambiguity about percentile scaling in image saver #16

Closed dkazanc closed 1 month ago

dkazanc commented 1 month ago

Currently there is an ambiguity between the calculation of the percentile and the percentage when the glob_stats argument is provided OR not. Two different scaling approaches are somewhat unified.

It makes things even more confusing because of the dependency on the glob_stats argument and data rescaler function in httomolibgpu package. This rescaling function might be used before save_to_images and then there is no need to provide glob_stats to image saver to rescale the rescaled data again! However, when the glob_stats argument is NOT provided, we then use a time consuming percentile rescaling without any need for it.

Also if you rescaled once with rescale_to_int and then provide glob_stats to save_to_images, you will rescale your data again, incorrectly, I believe.

dkazanc commented 1 month ago

HTTomo solution: One possible solution is to make rescale_to_int to be a part of image_saver, however, then it must become a CPU method. Another solution is to make rescale_to_int insertable before save_to_images in HTTomo automatically based on the parameters given in the save_to_images. Slightly fiddly but the obvious thing here is that those methods need to know about the existence of each other so to avoid duplications of operations. Any other ideas?

dkazanc commented 1 month ago

17