scallops.segmentation.util.remove_labels_by_area

scallops.segmentation.util.remove_labels_by_area(labels, area_min=-inf, area_max=inf, relabel=False)

Keep labels with area_min < area < area_max

Parameters:
  • labels (ndarray) – An array of labels, which must be non-negative integers.

  • area_min (float) – Minimum area to include

  • area_max (float) – Maximum area to include

  • relabel (bool) – Whether to relabel the labels

Returns:

Filtered labels

Return type:

ndarray