Vitessce supports SpatialData
Since 2022, our team has been working hard to support visualizing SpatialData (Marconato et al., Nature Methods 2024) objects in Vitessce. We are happy to share that Vitessce now supports all five Spatial Elements defined by SpatialData: tables, points, shapes, labels, and images.
We can map these elements onto the Vitessce data model as follows:
- Tables correspond to a combination of
obsFeatureMatrix,obsSets,obsEmbedding, and so on (the same combination of data types that can be represented by an AnnData object). - Points correspond to
obsPoints. - Labels correspond to
obsSegmentations(i.e., bitmask-type segmentations). - Images correspond to the
imagedata type. - Shapes correspond to
obsSegmentations(i.e., polygon-type segmentations) when the shapes are polygons, orobsSpotswhen the shapes are circles.
Configuration
See Easy Vitessce and its example notebooks for instructions on reusing the existing SpatialData-Plot functions and plotting syntax to visualize SpatialData objects from Python.
When using the vitessce Python package, use the SpatialDataWrapper class for configuration.
Also see our example notebooks in the vitessce-python repository (look for notebooks prefixed with spatial_data) for more complex configuration options.
For developers using the JavaScript API or creating JSON configurations, visualizations of SpatialData objects can be configured using either the spatialdata.zarr or spatialdata.zarr.zip file types (docs) when using the Vitessce JSON or JavaScript configuration APIs.
Examples
10x Visium
- https://vitessce.io/#?dataset=spatialdata-visium
- https://vitessce.io/#?dataset=spatialdata-visium_io
- https://vitessce.io/#?dataset=maynard-2021
10x Visium HD
Note: There are multiple ways to store Visium HD data in a SpatialData object.
For visualization of Visium HD data in Vitessce, use the rasterize_bins and rasterize_bins_link_table_to_labels functions provided by the spatialdata Python package.
See our example notebook.
10x Xenium
Note: Xenium datasets typically contain tens of millions of points (individual transcripts with spatial coordinates). Vitessce cannot load and render all of these points at once due to browser memory limitations. To visualize this many points (i.e., tens of millions) in Vitessce, we must use a tiling approach so that only a subset of the points are loaded and rendered at any given time (e.g., only loading the points within the current viewport).
To enable tiling, Vitessce can load subsets of points when the SpatialData Points dataframe has been sorted in Morton order (along a Z-order curve). The Vitessce python package provides functions to sort the points dataframe within a SpatialData object and make the points compatible with Vitessce. For more information, see the Points section of our data troubleshooting documentation and our example notebook.
Other Examples
- https://vitessce.io/#?dataset=spatialdata-mcmicro_io
- https://vitessce.io/#?dataset=sdata-kpmp-2023 (Python notebook)
- https://github.com/vitessce/vitessce-python/blob/main/docs/notebooks/spatial_data_mouseliver.ipynb
- https://github.com/vitessce/vitessce-python/blob/main/docs/notebooks/spatial_data_mouseliver_remote.ipynb
Next Steps
We are continuing to improve Vitessce's support for SpatialData. For more information, see our GitHub issues. We welcome your feedback.