spatialdata_io.steinbock

Contents

spatialdata_io.steinbock#

spatialdata_io.steinbock(path, labels_kind='deepcell', imread_kwargs=mappingproxy({}), image_models_kwargs=mappingproxy({}))#

Read a Steinbock output into a SpatialData object.

See also

Parameters:
  • path (str | Path) – Path to the dataset.

  • labels_kind (Literal['deepcell', 'ilastik'] (default: 'deepcell')) – Kind of labels to use. Either deepcell or ilastik.

  • imread_kwargs (Mapping[str, Any] (default: mappingproxy({}))) – Keyword arguments to pass to the image reader.

  • image_models_kwargs (Mapping[str, Any] (default: mappingproxy({}))) – Keyword arguments to pass to the image models.

Return type:

SpatialData

Returns:

: spatialdata.SpatialData

Notes

Mandatory outputs of the Steinbock pipeline required by this reader:

  • cells.h5ad: the AnnData object in the main working directory

  • ome/: directory containing the steinbock OME-TIFF images (*.ome.tiff)

  • masks_deepcell/ or masks_ilastik/: the masks directory, selected via the labels_kind parameter (only one is used at a time)

When exporting to AnnData with steinbock export anndata, the --info option (default: images.csv) controls whether image metadata is embedded. When present, steinbock copies the image column from images.csv into adata.obs.image for every cell; this reader requires that column to map cells to their source image. Without it, adata.obs.image will not exist and the reader will fail. images.csv is generated automatically by steinbock preprocess imc images when starting from .mcd files. Users who start from TIFF images must hand-craft images.csv with at least the columns image, width_px, height_px, and num_channels as described in the Steinbock file types documentation.

All AnnData tables, masks, and OME-TIFFs must follow the steinbock naming conventions so that the reader can correctly match all instances.