View xenium images in napari

I used the spatialdata_io xenium function to load in my xenium data, which appears to work exactly as described. However, when I try to view my xenium image using:
Interactive([adata])
The napari viewer is empty. I am able to render images when using the included visium H&E datasets, so I don’t think there is anything going on with my environment. Any suggestions would be very much appreciated!

Dylan

Hi Dylan, thanks for reaching out.

Please use Interactive(sdata) (or Interactive([sdata])), as differently from squidpy, napari-spatialdata visualizes SpatialData objects, not AnnData objects.

Hi Luca,

To clarify here - I just saved the output from the xenium call as adata (so it is a spatial data object).

So I ran: adata=xenium(“pathtoobj”)

Sorry for the confusion. My first go with spatial data!

Dylan

Thanks for the updated details.

Please save the SpatialData object to disk and read it again before using napari, because until you save and re-read you won’t be exploiting the performance of Zarr. It could be that you see black because the image takes long to load.

Otherwise I would suggest trying installing the latest mail (pip install git+https://) of spatialdata, spatialdata-io, napari-spatialdata and spatialdata-plot.

Hi Luca,

Unfortunately after attempting both changing my workflow and installing the latest mail I am unable to view in napari.

To confirm I am doing it correctly, would this be your suggested workflow?

import napari_spatialdata as nps
import spatialdata as sp
from spatialdata_io import xenium
import spatialdata_plot

sdata = xenium("/Users/xenium_folder/")
sdata.write("/Users/test.zarr")
zarr_data = sp.read_zarr("/Users/test.zarr")
nps.Interactive([zarr_data])

Yes, the code is correct. I would need more details, please do the following: