code: def _find_clusters_1dir(
      x, x_in, adjacency, max_step, t_power, ndimage
  ):
      """Actually call the clustering algorithm."""
      if adjacency is None:
          labels, n_labels = ndimage.label(x_in)
  
          if x.ndim == 1:
              # slices
              clusters = ndimage.find_objects(labels, n_labels)
              # equivalent to if len(clusters) == 0 but faster
              if not clusters:
                  sums = list()
              else:
                  index = list(range(1, n_labels + 1))
                  if t_power == 1:
                      sums = ndimage.sum(x, labels, index=index)
                  else:
                      sums = ndimage.sum(
                          np.sign(x) * np.abs(x) ** t_power,
                          labels,
                          index=index,
                      )
          else:
              # boolean masks (raveled)
              clusters = list()
              sums = np.empty(n_labels)
              for label in range(n_labels):
                  c = labels == label + 1
                  clusters.append(c.ravel())
                  if t_power == 1:
                      sums[label] = np.sum(x[c])
                  else:
                      sums[label] = np.sum(
                          np.sign(x[c]) * np.abs(x[c]) ** t_power
                      )
      else:
          if x.ndim > 1:
              raise Exception(
                  "Data should be 1D when using a adjacency "
                  "to define clusters."
              )
          if (
              isinstance(adjacency, sparse.spmatrix)
              or adjacency is False
          ):
              clusters = _get_components(x_in, adjacency)
          elif isinstance(adjacency, list):  # use temporal adjacency
              clusters = _get_clusters_st(x_in, adjacency, max_step)
          else:
              raise ValueError(
                  "adjacency must be a sparse matrix or list"
              )
          if t_power == 1:
              sums = [_masked_sum(x, c) for c in clusters]
          else:
              sums = [
                  _masked_sum_power(x, c, t_power) for c in clusters
              ]
  
      return clusters, np.atleast_1d(sums)
  
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 15 for calling a global function with example usage: _find_clusters_1dir(x, x_in, adjacency, max_step, t_power, ndimage) and returns: clusters,  np