code: def trim_disconnected_blobs(im, inlets):
      r
      temp = sp.zeros_like(im)
      temp[inlets] = True
      labels, N = spim.label(im + temp)
      im = im ^ (clear_border(labels=labels) > 0)
      return im
docs: r"""
      Removes foreground voxels not connected to specified inlets
  
      Parameters
      ----------
      im : ND-array
          The array to be trimmed
      inlets : ND-array of tuple of indices
          The locations of the inlets.  Any voxels *not* connected directly to
          the inlets will be trimmed
  
      Returns
      -------
      image : ND-array
          An array of the same shape as ``im``, but with all foreground
          voxels not connected to the ``inlets`` removed.