aicsimageio icon indicating copy to clipboard operation
aicsimageio copied to clipboard

AICSImage Initialization with 6 Dimensions (RGB)

Open MosGeo opened this issue 3 years ago • 3 comments

System and Software

  • aicsimageio Version: 4.9.2
  • Python Version: 3.10
  • Operating System: Windows 11 64Bit

Description

This is a 'bug' related to the fuzzy world of RGB images and the sixth dimension of AICSImage :)

The following works as expected

data = da.random.random((1, 1,1,512,512))*256
data = data.astype(int)
img = AICSImage(data)

However, this following raises an error ValueError: different number of dimensions on data and dims: 6 vs 1

data = da.random.random((1, 1,1,512,512,3))*256
data = data.astype(int)
img = AICSImage(data)

Expected Behavior

Image is created.

Reproduction

from aicsimageio.aics_image import AICSImage
import dask.array as da

data = da.random.random((1, 1,1,512,512,3))*256
data = data.astype(int)
img = AICSImage(data)

MosGeo avatar Aug 28 '22 06:08 MosGeo

@MosGeo we are all a bit busy right now. Feel free to make a PR!

evamaxfield avatar Aug 29 '22 19:08 evamaxfield

I haven't tried this but is there a possible workaround by specifying the dims along with the data in the constructor?

toloudis avatar Aug 29 '22 20:08 toloudis

@evamaxfield no worries, I will check it out. Thanks!

@toloudis dims didn't help.

MosGeo avatar Aug 30 '22 05:08 MosGeo

I opened a PR to ideally fix this without having to change your sample code, but for what it is worth, this modified sample below does not raise an error (I added the dim_order parameter).

Using:

  • python 3.10
  • most current aicsimagio (at time of writing) 4.9.4
  • MacOS
from aicsimageio.aics_image import AICSImage
import dask.array as da

data = da.random.random((1, 1,1,512,512,3))*256
data = data.astype(int)
img = AICSImage(data, dim_order="TCZYXS")

SeanDuHare avatar Mar 14 '23 21:03 SeanDuHare