Repository navigation
Fix skimage.io.imread returns incorrect dimensions - #1498
Conversation
|
/cc @blink1073 |
There was a problem hiding this comment.
why img.shape[-3] and not img.shape[0]?
There was a problem hiding this comment.
This is based on the convention in tifffile.py for multi-page TIFFs, where the first dimension may be the number of pages.
There was a problem hiding this comment.
I got this error still in python 3.6. Is it fixed in any new version?
"io" needs to access the metadata. Otherwise some labeling annotations might get it wrong when doing the segmentation for object detection applications. The labels where rotated 90º when having vertical images. It took me a while to find out where was the bug :( ... That's what the metadata is for. Why should we assume anything when we can get certainty?
I would suggest to use exiftool.
Regards
There was a problem hiding this comment.
@JavierClearImageAI wow, this issue is a blast from the past! And yet, as you noted, very much still an issue.
The main problem with metadata is that it is inconsistent between different file formats, or even different variants of the same format. We don't have enough person-hours to pursue all the possible formats and metadata tags, and the lack of clarity over where to start has prevented real efforts from getting started here. See the following issues in imageio for more context:
imageio is the right place to start thinking about and contributing to a solution.
Thank you for the ping!
|
I think we need a test with a multi-page RGB TIFF to really iron this out. |
|
I can add the multi-page TIFF in another PR, I am fine with this one as-is, once @emmanuelle concurs. |
|
👍 |
|
Thanks @cgohlke! |
Fix skimage.io.imread returns incorrect dimensions
Fixes #1496
Note that since imread does not have access to metadata, such as the TIFF PlanarConfiguration tag, this patch uses a heuristic approach based on the image shape. Also, the returned ndimage array might be non-contiguous.