get_neigh_inds#

omnipose.utils.get_neigh_inds(neighbors, coords, shape, background_reflect=False)[source]#

For L pixels and S steps, find the neighboring pixel indexes 0,1,...,L for each step. Background index is -1. Returns:

Parameters
  • coords (tuple, int) -- coordinates of nonzero pixels, <dim>x<npix>

  • shape (tuple, int) -- shape of the image array

Returns

  • indexes (1D array) -- list of pixel indexes 0,1,...L-1

  • neigh_inds (2D array) -- SxL array corresponding to affinity graph

  • ind_matrix (ND array) -- indexes inserted into the ND image volume