code: def get_cluster_position_from_thresholded_map(
      stat_map, domain, thr=3.0, csize=10
  ):
      """
      the clusters above thr of size greater than csize in
      18-connectivity are computed
  
      Parameters
      ----------
      stat_map : array of shape (nbvox),
             map to threshold
      mask: Nifti1Image instance,
            referential- and domain-defining image
      thr: float, optional,
           cluster-forming threshold
      cisze=10: int
                cluster size threshold
  
      Returns
      -------
      positions array of shape(k,anat_dim):
                the cluster positions in physical coordinates
                where k= number of clusters
                if no such cluster exists, None is returned
      """
      # if no supra-threshold voxel, return
      if (stat_map <= thr).all():
          return None
  
      # first build a domain of supra_threshold regions
      thresholded_domain = domain.mask(stat_map > thr)
  
      # get the connected components
      label = thresholded_domain.connected_components()
  
      # get the coordinates
      coord = thresholded_domain.get_coord()
  
      # get the barycenters
      baryc = []
      for i in range(label.max() + 1):
          if np.sum(label == i) >= csize:
              baryc.append(np.mean(coord[label == i], 0))
  
      if len(baryc) == 0:
          return None
  
      baryc = np.vstack(baryc)
      return baryc
  
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 3 for calling a global function with example usage: get_cluster_position_from_thresholded_map(stat_map, domain, thr, csize) and returns: baryc, None, None