Re: [scikit-image] Why does img_as force incoming data
Hi Dave On Wed, Jun 21, 2017, at 15:22, David Protter wrote:
Hi all, new here and having a lot of fun using Skimage for scientific image analysis. Glad to hear it!
I’m doign some normalization on images coming in as uint16, to expand their dynamic range. After normalization, images are float64, and I’m trying to convert them back to uint16. However, it seems like all the img_as functions ignore the kind of float coming in, since anything of kind float is constrained to [-1 to 1]. Below is the section out of the convert() function that seems to do this. Floating point images are expected to be between -1 and 1, as described here: http://scikit-image.org/docs/stable/user_guide/data_types.html
However, many functions support working on data in its original range, by specifying `preserve_range=True`. To convert your data from uint16 to float without changing its range, do: img_float = img.astype(float) Best regards Stéfan
participants (1)
-
Stefan van der Walt