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
- adata
AnnData 2um bin VisiumHD object.
- labels_npz_path
filepath Path to sparse labels generated by
b2c.stardist().- basis
str, 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_key
str, 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.- mpp
floatorNone, 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_key
str, optional (default:"labels") .obskey to store the labels under.
- adata