harpy.qc.segmentation_coverage

harpy.qc.segmentation_coverage#

harpy.qc.segmentation_coverage(sdata, labels_name, microns_per_pixel=1)#

Calculate coverage statistics for a segmentation labels element.

This function summarizes how much of the image area is covered by labeled pixels and how many segmented instances are present in the selected labels element.

Parameters:
  • sdata (SpatialData) – SpatialData object containing the segmentation labels element.

  • labels_name (str) – Name of the labels element in sdata for which coverage statistics are computed.

  • microns_per_pixel (float (default: 1)) – Pixel size used to convert areas from pixels to square microns. When set to 1, area values are reported in pixels.

Return type:

DataFrame

Returns:

: pandas.DataFrame containing the labels element name, the total number of instances, the total image area, the covered area, and the covered area percentage.

Examples

import harpy as hp

sdata = hp.datasets.pixie_example()

hp.qc.segmentation_coverage(
    sdata,
    labels_name="label_nuclear_fov0",
    microns_per_pixel=1,
)