API reference

API reference#

This page documents the functions used in the tutorial notebooks: the two entry points for pulling raw Xenium data and converting it to a SpatialData zarr store, the one entry point for converting whole-slide images to pyramidal OME-TIFF, and the two that carry an H&E slide through nucleus segmentation. The first four are importable directly off the top-level package; the segmentation pair is reached through spatialrefinery.segmentation, since it needs the optional segmentation extra.

Downloading#

Fetch a 10x Genomics Xenium study’s raw asset bundle from a curl -O <url> manifest.

download_xenium_study

Download a Xenium study's raw asset bundle.

Converting#

Convert raw vendor bundles and whole-slide images into analysis-ready formats: a SpatialData zarr store for Xenium, and pyramidal OME-TIFF for microscopy images.

xenium_to_spatialdata

Convert 10x Xenium raw data to SpatialData zarr format.

xenium_to_spatialdata_zip

Convert Xenium data to SpatialData zarr and create a zip archive.

convert_to_ometiff

Convert one image file to pyramidal OME-TIFF, dispatching on suffix.

Segmenting#

Segment nuclei in an H&E whole-slide image with InstanSeg, then package the boundaries as a SpatialData zarr store. Needs the optional segmentation extra – see Installation.

segment_wsi

Segment nuclei in one whole-slide image and return the GeoJSON path.

geojson_to_spatialdata

Assemble and write the SpatialData zarr for one segmented slide.

Note

This reference is deliberately narrow. spatialrefinery.core and spatialrefinery.io contain additional lower-level machinery – the technology/converter registry, BaseDownloader, XeniumConverter, and the pseudo-spot helpers in core.utils – that other modules build on but that isn’t part of the documented, stable surface yet. Expect it to change without notice; the functions above are the supported way to use spatialrefinery.