-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with aray shape when using dask_image.imread
(and dask.array.image.imread
) vs. imageio.imread
#239
Comments
dask_image.imread
(and dask.array.image.imread
) vs. imageio.imread
dask_image.imread
(and dask.array.image.imread
) vs. imageio.imread
Thank you for the report (and binder example!) @habi My best suggestion is to squeeze the array to remove the singleton dimension(s) if they're causing you problems. import numpy as np
squeezed_imgdask = np.squeeze(imgdask)
squeezed_imgdask.shape
# (100, 100) Since this has no effect if no singleton dimensions are present, you would be able to add this generally to your code. Then you'll get the same output, regardless of whether you happen to be using dask or not. |
That's good to hear, thanks |
I'm again having an issue with this, with a fresh installation of
When I load an image (one of thousands :) with
I get (3072, 3072) for imageio and (1, 3072, 3072, 4) for dask_image. |
Guessing that we are getting some RGBA or similar img.view(np.uint32).squeeze() More broadly we are looking at moving over to |
Thanks for the comment @jakirkham! The underlying issue is more that I'm using
to lazily load +10000 of images from disk (several samples with each a folder of +1000 reconstructions). From these I then generate files as necessary (axial views and MIPs), but do not |
I'm loading a big bunch of tomographic data in a preview/analysis notebook.
As we keep scanning samples, the dataframe I put the preview images in gets larger and larger.
I've been using
imageio.imread
to load the preview images (middle axial slices and MIPs) from disk.I'd like to switch to
dask_image.imread
for this, as I'm loading the full datasets with it and generate the preview files from the full stacks loaded like this.I now saw that loading an image with
imageio.imread
returns an image with two coordinates (size of the image), whiledask_image.imread
(anddask.array.image.imread
return an image with three coordinates, the first one being 1, the second and third being the size of the image.I'm very well aware that I can just
.squeeze()
the array before displaying withmatplotlib
, but expect that all theimread
functions return the same kind of array.Minimal Complete Verifiable Example:
I've made a gist which shows my issue fully self-contained, it can be found here and can be started in Binder:
It boils down to
returning different
shape
s.This is closely related to #229 :)
The text was updated successfully, but these errors were encountered: