bin2cell.insert_labels

bin2cell.insert_labels(adata, labels_npz_path, basis='spatial', spatial_key='spatial', mpp=None, labels_key='labels')

Load StarDist segmentation results and store them in the object. Labels will be stored as integers, with 0 being unassigned to an object.

Input

adataAnnData

2um bin VisiumHD object.

labels_npz_pathfilepath

Path to sparse labels generated by b2c.stardist().

basisstr, optional (default: "spatial")

Whether the image represents "spatial" or "array" coordinates. The former is the source morphology image, the latter is a GEX-based grid representation.

spatial_keystr, optional (default: "spatial")

Only used with basis="spatial". Needs to be present in .obsm. Rounded coordinates will be used to represent each bin when retrieving labels.

mppfloat or None, optional (default: None)

The mpp value that was used to generate the segmented image. Mandatory for GEX (basis="array"), if not provided with morphology (basis="spatial") will assume full scale image.

labels_keystr, optional (default: "labels")

.obs key to store the labels under.