code: def extract_clusters_from_thresh(T, XYZ, th, k=18):
      """
      Extract clusters from statistical map
      above specified threshold
      In:  T      (p)     statistical map
           XYZ    (3,p)   voxels coordinates
           th     <float> threshold
           k      <int>   the number of neighbours considered. (6,18 or 26)
      Out: labels (p)     cluster labels
      """
      labels = -np.ones(len(T), int)
      I = np.where(T >= th)[0]
      if len(I) > 0:
          SupraThreshXYZ = XYZ[:, I]
          CC_label = wgraph_from_3d_grid(SupraThreshXYZ.T, k).cc()
          labels[I] = CC_label
      return labels
  
imports: import numpy
  import warnings
  from nipy.algorithms.graph import wgraph_from_3d_grid
  from nipy.algorithms.graph.field import Field, field_from_graph_and_data
  from ..utils import zscore
  from .onesample import stat
  from .onesample import stat_mfx
  from .twosample import stat
  from .twosample import stat_mfx
label_desc: Use image node_id 1 for calling a global function with example usage: extract_clusters_from_thresh(T, XYZ, th, k) and returns: labels