docstr: Return the weights to assign each i,j point
  
  Assign each pixel in the labels mask to the nearest i,j and return
  the number of pixels assigned to each i,j
docstr_tok: ["Return","the","weights","to","assign","each","i",",","j","point","Assign","each","pixel","in","the","labels","mask","to","the","nearest","i",",","j","and","return","the","number","of","pixels","assigned","to","each","i",",","j"]
code: def get_weights(self, i, j, labels_mask):
      """Return the weights to assign each i,j point
  
      Assign each pixel in the labels mask to the nearest i,j and return
      the number of pixels assigned to each i,j
      """
      #
      # Create a mapping of chosen points to their index in the i,j array
      #
      total_skel = numpy.zeros(labels_mask.shape, int)
      total_skel[i, j] = numpy.arange(1, len(i) + 1)
      #
      # Compute the distance from each chosen point to all others in image,
      # return the nearest point.
      #
      ii, jj = scipy.ndimage.distance_transform_edt(
          total_skel == 0, return_indices=True, return_distances=False
      )
      #
      # Filter out all unmasked points
      #
      ii, jj = [x[labels_mask] for x in (ii, jj)]
      if len(ii) == 0:
          return numpy.zeros(0, numpy.int32)
      #
      # Use total_skel to look up the indices of the chosen points and
      # bincount the indices.
      #
      result = numpy.zeros(len(i), numpy.int32)
      bc = numpy.bincount(total_skel[ii, jj])[1:]
      result[: len(bc)] = bc
      return result
  
imports: from functools import reduce
  import centrosome.cpmorphology
  import centrosome.fastemd
  import centrosome.filter
  import centrosome.index
  import centrosome.propagate
  import numpy
  import scipy.ndimage
  import scipy.sparse
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT
  from cellprofiler_core.module import Module
  from cellprofiler_core.setting import Binary
  from cellprofiler_core.setting.choice import Choice
  from cellprofiler_core.setting.subscriber import LabelSubscriber
  from cellprofiler_core.setting.text import Integer
  from cellprofiler.modules import _help
label_desc: Use image node_id 10 for calling the MeasureObjectOverlap obj's underlying member method code with example usage: obj.get_weights(i, j, labels_mask) and returns: result, numpy