sparrow.sh.add_shapes_layer

sparrow.sh.add_shapes_layer#

sparrow.sh.add_shapes_layer(sdata, input, output_layer, transformations=None, overwrite=False)#

Add a shapes layer to a SpatialData object.

This function allows you to add a shapes layer to sdata. The shapes layer can be derived from a Dask array or a GeoDataFrame. If sdata is backed by a zarr store, the resulting shapes layer will be backed to the zarr store.

Parameters:
  • sdata (SpatialData) – The SpatialData object to which the new shapes layer will be added.

  • input (Array | GeoDataFrame) – The input data containing the shapes, either as an array (i.e. segmentation masks) or a GeoDataFrame.

  • output_layer (str) – The name of the output layer where the shapes data will be stored.

  • transformations (Optional[dict[str, BaseTransformation]] (default: None)) – Transformations that will be added to the resulting output_layer.

  • overwrite (bool (default: False)) – If True, overwrites the output layer if it already exists in sdata.

Return type:

SpatialData

Returns:

: The sdata object with the shapes layer added.