@ashapeng (pengA) posted a new topic, subject "Error when read 3d tiff image stack with skimage.io.imread()". It read:

   Hi everyone,  
    I have the following error when I read my tiff image stack with io.imread(). But I still can print the shape and ndim of my images. I am wondering why this happens.
    
    TiffPage 0: TypeError: read_bytes() missing 3 required positional arguments: ‘dtype', ‘count', and ‘offsetsize'
    
    Thanks so much.  
    Peng

Then @stefanv (Stéfan van der Walt) said

    Hi Peng and welcome to the forum,
    
    Can you please provide a test image and the code that you are using?
    
    Thanks!

@ashapeng (pengA) replied

    Hi Stefanv,  
    thanks so much. Apparently, tiff image is not authorized for uploading. I am wondering if there is any other way I can share my test tiff image file  
    The code is just one line to read image. Here is the code:  
    from skimage import io  
    img = io.imread(“test.tif”)
    
    Thanks again.

To which @jni (Juan Nunez-Iglesias) replied

    I _think_ you can upload a .zip, so you can zip your tiff file and upload the zip?

Then @stefanv (Stéfan van der Walt) said

    I've now enabled tiff attachments, so could you please try again?

To which @ashapeng (pengA) replied

    Thanks so much @stefanv , it's no longer said tiff is not authorized. But it said new user can not send attachment. Processing: test.tif…

@ashapeng (pengA) replied

    .zip file is also not authorized. But Stefanv has enabled tiff attachments. thanks

After which, @stefanv (Stéfan van der Walt) added

    Thanks for bearing with me. New users were barred from uploading images. I updated that limit to 1, and also increased your user level; so, please try again.

After which, @ashapeng (pengA) added

    thanks so much. test.tif (56.7 KB)

To which @stefanv (Stéfan van der Walt) replied

    It looks like this error is generated by older versions of `tifffile`. After doing `pip install --upgrade tifffile` the error disappears.

To which @ashapeng (pengA) replied

    thanks so much. it worked. I am wondering how did you find the problem. thanks

Then @stefanv (Stéfan van der Walt) said

    I first tried to load the image with `imageio` and `tifffile`. I noticed the same problem in both, but realised that `imageio` must use `tifffile` under the hood. Then, I was about to file a bug against `tifffile`, but thought I should at least check whether it had been fixed in the latest version. And, indeed, it has!

Then @cgohlke (Christoph Gohlke) said

    See also TypeError using imagej_metadata · Issue #103 · cgohlke/tifffile · GitHub.

Then @ashapeng (pengA) said

    thanks a lot. good to know the thought process.


{'source': 'discourse', 'url': 'https://discuss.scientific-python.org/t/error-when-read-3d-tiff-image-stack-with-skimage-io-imread/119', 'title': 'Error when read 3d tiff image stack with skimage.io.imread()', 'views': 1632, 'has_accepted_answer': True, 'word_count': 349, 'like_count': 4, 'reply_count': 9, 'participant_count': 4, 'posts': 14, 'tags': '', 'author': '@ashapeng (pengA)', 'participants': '@ashapeng (pengA), @stefanv (Stéfan van der Walt), @jni (Juan Nunez-Iglesias), @cgohlke (Christoph Gohlke)', 'image_url': [None], 'created_at': '2021-11-02T21:01:37.405Z', 'last_posted_at': '2021-11-04T19:58:45.701Z'}