code: def _identify_subpeaks(data):
      """Identify cluster peak and subpeaks based on minimum distance.
  
      Parameters
      ----------
      data : `numpy.ndarray`
          3D array of with masked values for cluster.
  
      Returns
      -------
      ijk : `numpy.ndarray`
          (n_foci, 3) array of local maximum indices for cluster.
      vals : `numpy.ndarray`
          (n_foci,) array of values from data at ijk.
  
      Notes
      -----
      When a cluster's local maximum corresponds to contiguous voxels with the
      same values (as in a binary cluster), this function determines the center
      of mass for those voxels. If the center of mass falls outside the cluster,
      we instead report the nearest cluster voxel.
      """
      data_max = maximum_filter(data, 3)
      maxima = data == data_max
      zero_mask = data == 0
      maxima[zero_mask] = 0
  
      # Don't treat constant patches as maxima unless the entire cluster is
      # constant (as in a binary cluster).
      is_constant = np.isclose(
          data[~zero_mask].max(), data[~zero_mask].min()
      )
      if not is_constant:
          data_min = minimum_filter(data, 3)
          diff = (data_max - data_min) > 0
          maxima[diff == 0] = 0
  
      labeled, n_subpeaks = label(maxima)
      labels_index = np.arange(1, n_subpeaks + 1)
      ijk = np.array(center_of_mass(data, labeled, labels_index))
      ijk = np.round(ijk).astype(int)
      # Determine if all subpeaks are within the cluster
      # They may not be if the cluster is binary and has a shape where the COM is
      # outside the cluster, like a donut.
      subpeaks_outside_cluster = (
          labeled[ijk[:, 0], ijk[:, 1], ijk[:, 2]] != labels_index
      )
      if np.any(subpeaks_outside_cluster):
          warnings.warn(
              "Attention: At least one of the (sub)peaks falls outside of the "
              "cluster body. Identifying the nearest in-cluster voxel."
          )
          # Replace centers of mass with their nearest neighbor points in the
          # corresponding clusters. Note this is also equivalent to computing the
          # centers of mass constrained to points within the cluster.
          ijk[subpeaks_outside_cluster] = _cluster_nearest_neighbor(
              ijk[subpeaks_outside_cluster],
              labels_index[subpeaks_outside_cluster],
              labeled,
          )
      vals = data[ijk[:, 0], ijk[:, 1], ijk[:, 2]]
      return ijk, vals
  
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 2 for calling a global function with example usage: _identify_subpeaks(data) and returns: ijk,  vals