masks_to_flows_cpu#

cellpose_omni.dynamics.masks_to_flows_cpu(masks, device=None)[source]#

convert masks to flows using diffusion from center pixel Center of masks where diffusion starts is defined to be the closest pixel to the median of all pixels that is inside the mask. Result of diffusion is converted into flows by computing the gradients of the diffusion density map. :param masks: labelled masks 0=NO masks; 1,2,...=mask labels :type masks: int, 2D array

Returns

  • mu (float, 3D array) -- flows in Y = mu[-2], flows in X = mu[-1]. if masks are 3D, flows in Z = mu[0].

  • mu_c (float, 2D array) -- for each pixel, the distance to the center of the mask in which it resides