code: def cluster_level_inference(
      stat_img, mask_img=None, threshold=3.0, alpha=0.05, verbose=False
  ):
      """Report the proportion of active voxels for all clusters \
      defined by the input threshold.
  
      This implements the method described in :footcite:t:`Rosenblatt2018`.
  
      Parameters
      ----------
      stat_img : Niimg-like object or None, optional
         statistical image (presumably in z scale)
  
      mask_img : Niimg-like object, optional,
          mask image
  
      threshold : list of floats, default=3.0
         Cluster-forming threshold in z-scale.
  
      alpha : float or list, default=0.05
          Level of control on the true positive rate, aka true discovery
          proportion.
  
      verbose : bool, default=False
          Verbosity mode.
  
      Returns
      -------
      proportion_true_discoveries_img : Nifti1Image
          The statistical map that gives the true positive.
  
      References
      ----------
      .. footbibliography::
  
      """
      if not isinstance(threshold, list):
          threshold = [threshold]
  
      if mask_img is None:
          masker = NiftiMasker(mask_strategy="background").fit(stat_img)
      else:
          masker = NiftiMasker(mask_img=mask_img).fit()
      stats = np.ravel(masker.transform(stat_img))
      hommel_value = _compute_hommel_value(
          stats, alpha, verbose=verbose
      )
  
      # embed it back to 3D grid
      stat_map = get_data(masker.inverse_transform(stats))
  
      # Extract connected components above threshold
      proportion_true_discoveries_img = math_img(
          "0. * img", img=stat_img
      )
      proportion_true_discoveries = masker.transform(
          proportion_true_discoveries_img
      ).ravel()
  
      for threshold_ in sorted(threshold):
          label_map, n_labels = label(stat_map > threshold_)
          labels = label_map[get_data(masker.mask_img_) > 0]
  
          for label_ in range(1, n_labels + 1):
              # get the z-vals in the cluster
              cluster_vals = stats[labels == label_]
              proportion = _true_positive_fraction(
                  cluster_vals, hommel_value, alpha
              )
              proportion_true_discoveries[labels == label_] = proportion
  
      proportion_true_discoveries_img = masker.inverse_transform(
          proportion_true_discoveries
      )
      return proportion_true_discoveries_img
  
file_path: nilearn/nilearn/glm/thresholding.py
imports: import warnings
  import numpy
  from scipy.ndimage import label
  from scipy.stats import norm
  from nilearn.image import get_data, math_img, threshold_img
  from nilearn.maskers import NiftiMasker
label_desc: Use image node_id 4 for calling a global function with example usage: cluster_level_inference(stat_img, mask_img, threshold, alpha, verbose) and returns: proportion_true_discoveries_img