crop_bbox#

omnipose.utils.crop_bbox(mask, pad=10, iterations=3, im_pad=0, area_cutoff=0, max_dim=inf, get_biggest=False, binary=False)[source]#

Take a label matrix and return a list of bounding boxes identifying clusters of labels.

Parameters
  • mask (matrix of integer labels) --

  • pad (amount of space in pixels to add around the label (does not extend beyond image edges, will shrink for consistency)) --

  • iterations (number of dilation iterations to merge labels separated by this number of pixel or less) --

  • im_pad (amount of space to subtract off the label matrix edges) --

  • area_cutoff (label clusters below this area in square pixels will be ignored) --

  • max_dim (if a cluster is above this cutoff, quit and return the original image bounding box) --

Returns

slices

Return type

list of bounding box slices with padding