docs: def local_minima(img, min_distance = 4):
      r"""
      Returns all local minima from an image.
      
      Parameters
      ----------
      img : array_like
          The image.
      min_distance : integer
          The minimal distance between the minimas in voxels. If it is less, only the lower minima is returned.
      
      Returns
      -------
      indices : sequence
          List of all minima indices.
      values : sequence
          List of all minima values.
      """
      # @TODO: Write a unittest for this.
      fits = numpy.asarray(img)
      minfits = minimum_filter(fits, size=min_distance) # default mode is reflect
      minima_mask = fits == minfits
      good_indices = numpy.transpose(minima_mask.nonzero())
      good_fits = fits[minima_mask]
      order = good_fits.argsort()
      return good_indices[order], good_fits[order]