clean_boundary#

omnipose.utils.clean_boundary(labels, boundary_thickness=3, area_thresh=30, cutoff=0.5)[source]#

Delete boundary masks below a given size threshold within a certain distance from the boundary.

Parameters
  • boundary_thickness (int) -- labels within a stripe of this thickness along the boundary will be candidates for removal.

  • area_thresh (int) -- labels with area below this value will be removed.

  • cutoff (float) -- Fraction from 0 to 1 of the overlap with the boundary before the mask is removed. Default 0.5. Set to 0 if you want any mask touching the boundary to be removed.

Return type

label matrix with small edge labels removed.