code: def cluster_threshold(stat_map, domain, th, csize):
      """Perform a thresholding of a map at the cluster-level
  
      Parameters
      ----------
      stat_map: array of shape(nbvox)
           the input data
      domain: Nifti1Image instance,
            referential- and domain-defining image
      th (float): cluster-forming threshold
      csize (int>0): cluster size threshold
  
      Returns
      -------
      binary array of shape (nvox): the binarized thresholded map
  
      Notes
      -----
      Should be replaced by a more standard function in the future
      """
      if stat_map.shape[0] != domain.size:
          raise ValueError("incompatible dimensions")
  
      # first build a domain of supra_threshold regions
      thresholded_domain = domain.mask(stat_map > th)
  
      # get the connected components
      label = thresholded_domain.connected_components()
  
      binary = -np.ones(domain.size)
      binary[stat_map > th] = label
      nbcc = len(np.unique(label))
      for i in range(nbcc):
          if np.sum(label == i) < csize:
              binary[binary == i] = -1
  
      binary = binary > -1
      return binary
  
imports: import numpy
  from nipy.io.nibcompat import get_affine
  from nipy.labs.spatial_models.discrete_domain import grid_domain_from_binary_array
label_desc: Use image node_id 2 for calling a global function with example usage: cluster_threshold(stat_map, domain, th, csize) and returns: binary