omicverse.space.visium_10x_hd_cellpose_he

omicverse.space.visium_10x_hd_cellpose_he#

omicverse.space.visium_10x_hd_cellpose_he(adata, mpp=0.3, he_save_path='stardist/he_colon.tiff', prob_thresh=None, flow_threshold=0.2, gpu=True, buffer=150, backend='tifffile', method='cellpose', **kwargs)[source]#

Segment nuclei on the Visium HD H&E image and write obs['labels_he'].

Parameters:
  • adata (AnnData) – Visium HD 2 µm bin AnnData with the full-resolution H&E image path.

  • mpp (float, default=0.3) – Microns per pixel of the image that is segmented.

  • he_save_path (str) – Where the cropped, rescaled H&E TIFF is written (reused if present); labels go next to it as .npz.

  • prob_thresh (float, optional) – Detection threshold: Cellpose cellprob_threshold (default 0) or StarDist prob_thresh (default 0.01, bin2cell’s recommendation).

  • flow_threshold (float, default=0.2) – Cellpose flow-error threshold.

  • gpu (bool, default=True) – Use the GPU when the backend supports it.

  • buffer (int, default=150) – Pixels kept around the tissue when cropping.

  • backend (str, default='tifffile') – Image reader for the source H&E.

  • method (str, default='cellpose') – Segmentation backend from ov.space.seg: 'cellpose', 'stardist', 'sam', 'sam2', 'micro_sam', 'watershed' or 'cellsam'.

  • **kwargs – Forwarded to the backend (e.g. diameter, model, block_size).

Returns:

Adds obs['labels_he'] to adata in place.

Return type:

None