code: def _cluster_nearest_neighbor(ijk, labels_index, labeled):
      """Find the nearest neighbor for given points in the corresponding cluster.
  
      Parameters
      ----------
      ijk : :obj:`numpy.ndarray`
          (n_pts, 3) array of query points.
      labels_index : :obj:`numpy.ndarray`
          (n_pts,) array of corresponding cluster indices.
      labeled : :obj:`numpy.ndarray`
          3D array with voxels labeled according to cluster index.
  
      Returns
      -------
      nbrs : :obj:`numpy.ndarray`
          (n_pts, 3) nearest neighbor points.
      """
      labels = labeled[labeled > 0]
      clusters_ijk = np.array(labeled.nonzero()).T
      nbrs = np.zeros_like(ijk)
      for ii, (lab, point) in enumerate(zip(labels_index, ijk)):
          lab_ijk = clusters_ijk[labels == lab]
          dist = np.linalg.norm(lab_ijk - point, axis=1)
          nbrs[ii] = lab_ijk[np.argmin(dist)]
      return nbrs
  
file_path: nilearn/nilearn/reporting/get_clusters_table.py
imports: import warnings
  from string import ascii_lowercase
  import nibabel
  import numpy
  import pandas
  from scipy.ndimage import center_of_mass, generate_binary_structure, label, maximum_filter, minimum_filter
  from nilearn._utils import check_niimg_3d
  from nilearn._utils.niimg import safe_get_data
  from nilearn.image import new_img_like, threshold_img
  from nilearn.image.resampling import coord_transform
label_desc: Use image node_id 3 for calling a global function with example usage: _cluster_nearest_neighbor(ijk, labels_index, labeled) and returns: nbrs