-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
Milestone
Description
Description
I recently mentioned on the mailing list that a large proportion of our errors come from new (and old!) users surprised by the behavior of our data type conversions.
Although they are documented, this documentation is not prominent enough. Indeed, we barely even cover these in our scikit-image tutorials! Additionally, our own code base really is not careful enough to guide users along.
I want this issue to compile both common errors due to data types and proposed solutions, including a to-do list of consensus solutions.
Common errors
(Please add links here if you find them.)
- User has a 12-bit image that is encoded in a uint16 array. When this is converted to uint8 or float, the result is an image that has much lower contrast (16x) than expected.
- User has a float image with values falling outside the range [0, 1] or [-1, 1]. Some scikit-image functions fail altogether with this kind of input, while others warn. In almost all cases, these warnings are unnecessary.
- User wants to apply scikit-image functions to an integer array. This array, by default, is of type int32 or int64. scikit-image converts the values in the array to float by dividing by 2^31, resulting in tiny values (which for example are impossible to encode in common image formats)
Proposed solutions
- Figure out image metadata format and handling. Having correct metadata (
bit_depth=12, for example) would alleviate many issues. - Clearer separation of data viewing and data processing. See email by @ds604. Specifically, we could tweak
io.imshowto clearly display characteristics of the input data, including text info in the figure title/subtitle, colorbar, dtype, etc. Perhaps revisitingskimage.vieweras an integral part of skimage is warranted.
Rejected proposals
To-do list
- Add an FAQ section to the website homepage.
- Audit the code base to make sure that float images work unimpeded wherever it's possible. (Search for
img_as_floatcalls.) (Detailed suggestion by @grlee77 here.) - Remove automatic range conversion for int32 and int64 images.
- Warn on conversion of uint16 images where no value exceeds 4096 (possible 12-bit image)
- Add bit-depth option to
in_rangeandout_rangeparameters forexposure.rescale_intensity.
Metadata
Metadata
Assignees
Labels
Projects
Status
In progress