Open elevans opened 6 months ago
To be clear: in the case of img
being an Img
, there is no "reordering" happening, but rather dimensional assignment to match the given dim_order
. So this case should IMHO be easy to do. The trickier one is if you call to_dataset
on something that is already an ImgPlus
or Dataset
—then what? Is the user expecting the dimensions to be swapped around? Or just relabeled? (When passing an xarray, what do we do? I forgot.)
We can do better here and detect what the input image is and take the appropriate steps to re-order the dataset. If you try to re-order an imglib2 image with
to_dataset(img, dim_order=['X', 'Y', 'Channel'])
only the first two dimensions will be appropriately assigned. All other dimensions are discarded andunknown
is assigned as the dimension label.