Abstract
Spatially resolved omics technologies are transforming our understanding of biological tissues. However, the handling of uni- and multimodal spatial omics datasets remains a challenge owing to large data volumes, heterogeneity of data types and the lack of flexible, spatially aware data structures. Here we introduce SpatialData, a framework that establishes a unified and extensible multiplatform file-format, lazy representation of larger-than-memory data, transformations and alignment to common coordinate systems. SpatialData facilitates spatial annotations and cross-modal aggregation and analysis, the utility of which is illustrated in the context of multiple vignettes, including integrative analysis on a multimodal Xenium and Visium breast cancer study.
Introduction
The field of spatial omics is currently experiencing a rapid expansion, often referred to as a "Wild West" phase. Technologies such as 10x Visium, Xenium, and MERFISH generate vast, heterogeneous datasets comprising gigabyte-scale histology images, millions of individual molecular coordinates, and complex segmentation masks. The primary bottleneck in the field is not just the sheer volume of data, but the lack of a standardized infrastructure. Different modalities frequently utilize proprietary formats and disparate coordinate systems, making integration—such as querying RNA transcripts within specific tissue regions identified via H&E staining—computationally expensive and reliant on ad-hoc "glue code."
SpatialData addresses these challenges by providing an open-source, universal framework designed to unify the fragmented spatial omics landscape. It offers a standardized file format and a Python library that enables researchers to align, query, and analyze massive, multi-modal datasets without the need to load them entirely into memory.
The SpatialData Framework
Core Primitives and Storage
The framework organizes all spatial information into five fundamental primitives:
- Images: Raster data representing histology or fluorescence.
- Labels: Segmentation masks for cells or organelles.
- Points: Individual molecular coordinates (e.g., transcripts).
- Shapes: Polygons or circles defining regions of interest (ROIs).
- Tables: Gene expression counts and associated metadata.
To handle large-scale data, SpatialData leverages the Zarr file format and OME-NGFF specifications. This architecture supports "lazy loading," allowing the software to read only the specific data chunks required for a given calculation. This capability is essential for analyzing datasets that exceed a workstation's RAM capacity.
Coordinate Transformations and Spatial Queries
A defining feature of SpatialData is its robust handling of coordinate systems. The library allows researchers to define and chain transformations—such as translation, scaling, and rotation—to align multiple data layers into a Common Coordinate System (CCS). Crucially, these transformations are applied lazily, preserving the integrity of the raw data while enabling real-time spatial alignment.
This spatially aware infrastructure simplifies cross-modal aggregation. For instance, a "Shape" defined in a Visium experiment can be used to "crop" or aggregate "Points" from a Xenium run, facilitating modality-agnostic analysis.
Applications and Benchmarking
The authors demonstrated the framework's utility through several high-impact use cases:
- Multimodal Breast Cancer Integration: By aligning H&E images, 10x Visium, and Xenium data from consecutive tissue sections, the team identified consistent spatial domains across technologies.
- Large-Scale Prostate Cancer Mapping: 15 Visium fields-of-view were integrated into a single global coordinate system, demonstrating the framework's scalability.
- Community Resources: To lower the barrier to entry, the authors provided over 40 pre-formatted SpatialData objects from eight different technologies, including CosMx and CyCIF.
Key Results and Insights
- High Concordance: Analysis of Xenium replicates showed a median Pearson’s $R$ of 0.88 in cell-type abundance estimates, validating the framework's reliability.
- Cross-Platform Validation: Aggregating Xenium transcripts into Visium-sized regions revealed a strong correlation ($R = 0.62$) in gene expression quantification between the two platforms.
- Interactive and AI-Ready: Integration with the
napariviewer allows for manual ROI annotation that is immediately available for quantitative analysis. Furthermore, a built-inPyTorchDataset class enables direct training of deep learning models, such asDenseNet, for cell-type prediction.
Limitations and Future Directions
While SpatialData represents a significant advancement, several areas for development remain. Current work focuses on enhancing interoperability with the R/Bioconductor ecosystem and expanding support for volumetric (3D) and time-series (5D) data. Additionally, future updates aim to incorporate multiscale polygonal meshes for complex tissue architectures and improve cloud-based data access to accommodate the next generation of massive spatial datasets.
Summary updated