code: def extract_clusters_from_graph(T, G, th):
      """
      This returns a label vector of same size as T,
      defining connected components for subgraph of
      weighted graph G containing vertices s.t. T >= th
      """
      labels = np.zeros(len(T), int) - 1
      I = T >= th
      nlabels = I.sum()
      if nlabels > 0:
          labels[I] = G.subgraph(I).cc()
      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 5 for calling a global function with example usage: extract_clusters_from_graph(T, G, th) and returns: labels