Skip to content

reading array of shape (512, 512, 30) with a pathlib path returns array of shape (512, 30) #4138

@rbavery

Description

@rbavery

Description

I'm reading a tif with a pathlib path. When I convert the pathlib path to a string with the as_posix() method, the array is correctly read in with shape (512, 512, 30)

Way to reproduce

import skimage.io as skio
import numpy as np
from pathlib import Path
arr = np.ones((512, 512, 30))

skio.imsave("test.tif", arr)

skio.imread(Path("test.tif")).shape

The shape is wrong, the first dim is dropped.

And if you try this with an array that has a third axis of size 3 it actually works for some reason.

import skimage.io as skio
import numpy as np
from pathlib import Path
arr = np.ones((512, 512, 30))

skio.imsave("test.tif", arr)

skio.imread(Path("test.tif")).shape

Version information

3.7.3 | packaged by conda-forge | (default, Jul  1 2019, 21:52:21) 
[GCC 7.3.0]
Linux-4.15.0-1056-azure-x86_64-with-debian-stretch-sid
scikit-image version: 0.15.0
numpy version: 1.17.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions