affinity_to_boundary#

omnipose.core.affinity_to_boundary(masks, affinity_graph, coords)[source]#

Convert affinity graph to boundary map.

Internal hypervoxels are those that are fully connected to all their 3^D-1 neighbors, where D is the dimension. Boundary hypervoxels are those that are connected to fewer than this number and at least 1 other hypervoxel. Correct boundaries should have >=D connections, but the lower bound here is set to 1.

masks: ND array, int or binary

label matrix or binary foreground mask

affinity_graph: ND array, bool

hypervoxel affinity array, <3^D> by <number of foreground hypervoxels>

coords: tuple or ND array

coordinates of foreground hypervoxels, <dim>x<npix>

boundary