masks_to_affinity#

omnipose.core.masks_to_affinity(masks, coords, steps, inds, idx, fact, sign, dim, links=None, edges=None, dists=None, cutoff=1.4142135623730951)[source]#

Convert label matrix to affinity graph. Here the affinity graph is an NxM matrix, where N is the number of possible hypercube connections (3**dimension) and M is the number of foreground hypervoxels. Self-connections are set to 0.

idx is the central index of the kernel, inds[0]. edges is a list of tuples (y1,y2,y3,...),(x1,x2,x3,...) etc. to which all adjacent pixels should be connected concatenated masks should be paddedby 1 to make sure that doesn't cause unextpected label merging dist can be used instead for edge connectivity