code: def _get_clusters_st_1step(keepers, neighbors):
      """Directly calculate clusters.
  
      This uses knowledge that time points are
      only adjacent to immediate neighbors for data organized as time x space.
  
      This algorithm time increases linearly with the number of time points,
      compared to with the square for the standard (graph) algorithm.
  
      This algorithm creates clusters for each time point using a method more
      efficient than the standard graph method (but otherwise equivalent), then
      combines these clusters across time points in a reasonable way.
      """
      n_src = len(neighbors)
      n_times = len(keepers)
      # start cluster numbering at 1 for diffing convenience
      enum_offset = 1
      check = np.zeros((n_times, n_src), dtype=int)
      clusters = list()
      for ii, k in enumerate(keepers):
          c = _get_clusters_spatial(k, neighbors)
          for ci, cl in enumerate(c):
              check[ii, cl] = ci + enum_offset
          enum_offset += len(c)
          # give them the correct offsets
          c = [cl + ii * n_src for cl in c]
          clusters += c
  
      # now that each cluster has been assigned a unique number, combine them
      # by going through each time point
      for check1, check2, k in zip(check[:-1], check[1:], keepers[:-1]):
          # go through each one that needs reassignment
          inds = k[check2[k] - check1[k] > 0]
          check1_d = check1[inds]
          n = check2[inds]
          nexts = np.unique(n)
          for num in nexts:
              prevs = check1_d[n == num]
              base = np.min(prevs)
              for pr in np.unique(prevs[prevs != base]):
                  _reassign(check1, clusters, base, pr)
              # reassign values
              _reassign(check2, clusters, base, num)
      # clean up clusters
      clusters = [cl for cl in clusters if len(cl) > 0]
      return clusters
  
imports: import numpy
  from scipy import ndimage, sparse
  from scipy.sparse.csgraph import connected_components
  from scipy.stats import f
  from scipy.stats import t
  from ..fixes import has_numba, jit
  from ..parallel import parallel_func
  from ..source_estimate import MixedSourceEstimate, SourceEstimate, VolSourceEstimate
  from ..source_space import SourceSpaces
  from ..utils import ProgressBar, _check_option, _pl, _validate_type, check_random_state, logger, split_list, verbose, warn
  from .parametric import f_oneway, ttest_1samp_no_p
label_desc: Use image node_id 9 for calling a global function with example usage: _get_clusters_st_1step(keepers, neighbors) and returns: clusters