remove_bad_flow_masks#

cellpose_omni.dynamics.remove_bad_flow_masks(masks, flows, threshold=0.4, use_gpu=False, device=None)[source]#

remove masks which have inconsistent flows

Uses metrics.flow_error to compute flows from predicted masks and compare flows to predicted flows from network. Discards masks with flow errors greater than the threshold.

Parameters
  • masks (int, 2D or 3D array) -- labelled masks, 0=NO masks; 1,2,...=mask labels, size [Ly x Lx] or [Lz x Ly x Lx]

  • flows (float, 3D or 4D array) -- flows [axis x Ly x Lx] or [axis x Lz x Ly x Lx]

  • threshold (float (optional, default 0.4)) -- masks with flow error greater than threshold are discarded.

Returns

masks -- masks with inconsistent flow masks removed, 0=NO masks; 1,2,...=mask labels, size [Ly x Lx] or [Lz x Ly x Lx]

Return type

int, 2D or 3D array