get_masks#

omnipose.core.get_masks(p, bd, dist, mask, inds, nclasses=2, cluster=False, diam_threshold=12.0, eps=None, hdbscan=False, verbose=False)[source]#

Omnipose mask recontruction algorithm.

This function is called after dynamics are run. The final pixel coordinates are provided, and cell labels are assigned to clusters found by labeling the pixel clusters after rounding the coordinates (snapping each pixel to the grid and labeling the resulting binary mask) or by using DBSCAN or HDBSCAN for sub-pixel clustering.

Parameters
  • p (float32, ND array) -- final locations of each pixel after dynamics

  • bd (float, ND array) -- boundary field

  • dist (float, ND array) -- distance field

  • mask (bool, ND array) -- binary cell mask

  • inds (int, ND array) -- initial indices of pixels for the Euler integration [npixels x ndim]

  • nclasses (int) -- number of prediciton classes

  • cluster (bool) -- use DBSCAN clustering instead of coordinate thresholding

  • diam_threshold (float) -- mean diameter under which clustering will be turned on automatically

  • eps (float) -- internal espilon parameter for (H)DBSCAN

  • hdbscan (bool) -- use better, but much SLOWER, hdbscan clustering algorithm

  • verbose (bool) -- option to print more info to log file

Returns

  • mask (int, ND array) -- label matrix

  • labels (int, list) -- all unique labels