visium_hd() Error
The visium_hd function from spatialdata-io is currently returning an error importing the images from spaceranger output.
This is the error I am running into
File /data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/spatialdata/models/models.py:189, in RasterSchema.parse(cls, data, dims, transformations, scale_factors, method, chunks, **kwargs)
[183](https://vscode-remote+ssh-002dremote-002bcn4247.vscode-resource.vscode-cdn.net/data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/spatialdata/models/models.py:183) raise ValueError(
[184](https://vscode-remote+ssh-002dremote-002bcn4247.vscode-resource.vscode-cdn.net/data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/spatialdata/models/models.py:184) f"Cannot transpose arrays to match `dims`: {dims}.",
[185](https://vscode-remote+ssh-002dremote-002bcn4247.vscode-resource.vscode-cdn.net/data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/spatialdata/models/models.py:185) "Try to reshape `data` or `dims`.",
[186](https://vscode-remote+ssh-002dremote-002bcn4247.vscode-resource.vscode-cdn.net/data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/spatialdata/models/models.py:186) ) from e
[188](https://vscode-remote+ssh-002dremote-002bcn4247.vscode-resource.vscode-cdn.net/data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/spatialdata/models/models.py:188) # finally convert to spatial image
--> [189](https://vscode-remote+ssh-002dremote-002bcn4247.vscode-resource.vscode-cdn.net/data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/spatialdata/models/models.py:189) data = to_spatial_image(array_like=data, dims=cls.dims.dims, **kwargs)
[190](https://vscode-remote+ssh-002dremote-002bcn4247.vscode-resource.vscode-cdn.net/data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/spatialdata/models/models.py:190) # parse transformations
[191](https://vscode-remote+ssh-002dremote-002bcn4247.vscode-resource.vscode-cdn.net/data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/spatialdata/models/models.py:191) _parse_transformations(data, transformations)
TypeError: to_spatial_image() got an unexpected keyword argument 'rgb'
The argument rgb in spatial_image.to_spatial_image() has been added in spatial-image==1.1.0. I will bump up the spatialdata requirement of spatialdata-io so at the next version the install will be automatic.
In your case please install the spatial-image==1.1.0 (available both in conda and pip).
Hi @LucaMarconato! Just wanted to let you know I encountered the same error with Xenium data. The latest spatial-image in Conda is 1.0.0, see here, so pip install is the only option (which I confirm fixes the issue).
Thank you @wlason for reporting, we will make a new release soon (which will add the correct minimum requirement for spatial-image within spatialdata-io) and update the conda version.