get_neigh_inds#

omnipose.core.get_neigh_inds(coords, shape, steps)[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 or ND array) -- coordinates of nonzero pixels, <dim>x<npix>

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

  • steps (ND array, int) -- list or array of ND steps to neighbors

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