troutpy.pp.cosmx_converter#
- troutpy.pp.cosmx_converter(sdata, copy_data=False)#
Convert a CosMx multi-FOV SpatialData object into a unified single-coordinate-system object.
Stitches image and label tiles, concatenates transcript tiles, remaps all per-FOV cell IDs to globally unique integers, and repacks the result into a standard SpatialData structure with a single image, label, points, shapes, and table layer.
- Parameters:
sdata (spatialdata.SpatialData) – Raw CosMx SpatialData object with per-FOV images, labels, points, and a
"table"AnnData. The table’sobsmust contain"fov"and"cell_ID"columns for cell ID remapping.copy_data (bool, optional) – If
True, operate on a deep copy ofsdataand return it. Otherwise modify in place and returnNone. Defaults toFalse.
- Return type:
- Returns:
spatialdata.SpatialData or None Converted SpatialData object if
copy_data=True; otherwiseNone.- Raises:
ValueError – If
sdata.table.obsdoes not contain a"fov"column required for cell ID remapping.