class_docstr: Learn :term:`parcellations<parcellation>`     on :term:`fMRI` images.
  
  Five different types of clustering methods can be used:
  kmeans, ward, complete, average and rena.
  kmeans will call MiniBatchKMeans whereas
  ward, complete, average are used within in Agglomerative Clustering and
  rena will call ReNA.
  kmeans, ward, complete, average are leveraged from scikit-learn.
  rena is built into nilearn.
  
  .. versionadded:: 0.4.1
  
  Parameters
  ----------
  method : {'kmeans', 'ward', 'complete', 'average', 'rena',         'hierarchical_kmeans'}
      A method to choose between for brain parcellations.
      For a small number of parcels, kmeans is usually advisable.
      For a large number of parcellations (several hundreds, or thousands),
      ward and rena are the best options. Ward will give higher quality
      parcels, but with increased computation time. ReNA is most useful as a
      fast data-reduction step, typically dividing the signal size by ten.
  
  n_parcels : :obj:`int`, default=50
      Number of parcels to divide the data into.
  
  %(random_state)s
      Default=0.
  
  mask : Niimg-like object or :class:`nilearn.maskers.NiftiMasker`,           :class:`nilearn.maskers.MultiNiftiMasker`, optional
      Mask/Masker used for masking the data.
      If mask image if provided, it will be used in the MultiNiftiMasker.
      If an instance of MultiNiftiMasker is provided, then this instance
      parameters will be used in masking the data by overriding the default
      masker parameters.
      If None, mask will be automatically computed by a MultiNiftiMasker
      with default parameters.
  %(smoothing_fwhm)s
      Default=4.0.
  %(standardize_false)s
  %(detrend)s
  
      .. note::
          This parameter is passed to :func:`nilearn.signal.clean`.
          Please see the related documentation for details.
  
      Default=False.
  %(low_pass)s
  
      .. note::
          This parameter is passed to :func:`nilearn.signal.clean`.
          Please see the related documentation for details.
  
  %(high_pass)s
  
      .. note::
          This parameter is passed to :func:`nilearn.signal.clean`.
          Please see the related documentation for details.
  
  %(t_r)s
  
      .. note::
          This parameter is passed to :func:`nilearn.signal.clean`.
          Please see the related documentation for details.
  
  %(target_affine)s
  
      .. note::
          This parameter is passed to :func:`nilearn.image.resample_img`.
          Please see the related documentation for details.
  
      .. note::
          The given affine will be considered as same for all
          given list of images.
  
  %(target_shape)s
  
      .. note::
          This parameter is passed to :func:`nilearn.image.resample_img`.
          Please see the related documentation for details.
  
  %(mask_strategy)s
  
      .. note::
           Depending on this value, the mask will be computed from
           :func:`nilearn.masking.compute_background_mask`,
           :func:`nilearn.masking.compute_epi_mask`, or
           :func:`nilearn.masking.compute_brain_mask`.
  
      Default='epi'.
  
  mask_args : :obj:`dict`, optional
      If mask is None, these are additional parameters passed to
      masking.compute_background_mask or masking.compute_epi_mask
      to fine-tune mask computation. Please see the related documentation
      for details.
  
  scaling : :obj:`bool`, default=False
      Used only when the method selected is 'rena'. If scaling is True, each
      cluster is scaled by the square root of its size, preserving the
      l2-norm of the image.
  
  n_iter : :obj:`int`, default=10
      Used only when the method selected is 'rena'. Number of iterations of
      the recursive neighbor agglomeration.
  %(memory)s
  %(memory_level)s
  %(n_jobs)s
  %(verbose0)s
  
  Attributes
  ----------
  labels_img_ : :class:`nibabel.nifti1.Nifti1Image`
      Labels image to each parcellation learned on fmri images.
  
  masker_ : :class:`nilearn.maskers.NiftiMasker` or                 :class:`nilearn.maskers.MultiNiftiMasker`
      The masker used to mask the data.
  
  connectivity_ : :class:`numpy.ndarray`
      Voxel-to-voxel connectivity matrix computed from a mask.
      Note that this attribute is only seen if selected methods are
      Agglomerative Clustering type, 'ward', 'complete', 'average'.
  
  Notes
  -----
  * Transforming list of Nifti images to data matrix takes few steps.
    Reducing the data dimensionality using randomized SVD, build brain
    parcellations using KMeans or various Agglomerative methods.
  
  * This object uses spatially-constrained AgglomerativeClustering for
    method='ward' or 'complete' or 'average' and spatially-constrained
    ReNA clustering for method='rena'. Spatial connectivity matrix
    (voxel-to-voxel) is built-in object which means no need of explicitly
    giving the matrix.
docstr: Extract signals from :term:`parcellations<parcellation>` learned         on :term:`fMRI` images.
  
  Parameters
  ----------
  %(imgs)s
      Images to process.
  
  confounds : :obj:`list` of CSV files, arrays-like, or :class:`pandas.DataFrame`, optional
      Each file or numpy array in a list should have shape
      (number of scans, number of confounds)
      Must be of same length as imgs.
  
      .. note::
          This parameter is passed to :func:`nilearn.signal.clean`.
          Please see the related documentation for details.
  
  Returns
  -------
  region_signals : :obj:`list` of or 2D :class:`numpy.ndarray`
      Signals extracted for each label for each image.
      Example, for single image shape will be
      (number of scans, number of labels)
docstr_tok: ["Extract","signals","from",":","term",":","`","parcellations","<","parcellation",">","`","learned","on",":","term",":","`","fMRI","`","images",".","Parameters","--","--","--","--","--","%","(","imgs",")","s","Images","to","process",".","confounds",":",":","obj",":","`","list","`","of","CSV","files",",","arrays-like",",","or",":","class",":","`","pandas.DataFrame","`",",","optional","Each","file","or","numpy","array","in","a","list","should","have","shape","(","number","of","scans",",","number","of","confounds",")","Must","be","of","same","length","as","imgs",".","..","note",":",":","This","parameter","is","passed","to",":","func",":","`","nilearn.signal.clean","`",".","Please","see","the","related","documentation","for","details",".","Returns","--","--","--","-","region_signals",":",":","obj",":","`","list","`","of","or","2D",":","class",":","`","numpy.ndarray","`","Signals","extracted","for","each","label","for","each","image",".","Example",",","for","single","image","shape","will","be","(","number","of","scans",",","number","of","labels",")"]
code: def transform(self, imgs, confounds=None):
      """Extract signals from :term:`parcellations<parcellation>` learned \
          on :term:`fMRI` images.
  
          Parameters
          ----------
          %(imgs)s
              Images to process.
  
          confounds : :obj:`list` of CSV files, arrays-like,\
   or :class:`pandas.DataFrame`, optional
              Each file or numpy array in a list should have shape
              (number of scans, number of confounds)
              Must be of same length as imgs.
  
              .. note::
                  This parameter is passed to :func:`nilearn.signal.clean`.
                  Please see the related documentation for details.
  
          Returns
          -------
          region_signals : :obj:`list` of or 2D :class:`numpy.ndarray`
              Signals extracted for each label for each image.
              Example, for single image shape will be
              (number of scans, number of labels)
  
          """
      self._check_fitted()
      imgs, confounds, single_subject = _check_parameters_transform(
          imgs, confounds
      )
      # Requires for special cases like extracting signals on list of
      # 3D images
      imgs_list = iter_check_niimg(imgs, atleast_4d=True)
  
      masker = NiftiLabelsMasker(
          self.labels_img_,
          mask_img=self.masker_.mask_img_,
          smoothing_fwhm=self.smoothing_fwhm,
          standardize=self.standardize,
          detrend=self.detrend,
          low_pass=self.low_pass,
          high_pass=self.high_pass,
          t_r=self.t_r,
          resampling_target="data",
          memory=self.memory,
          memory_level=self.memory_level,
          verbose=self.verbose,
      )
  
      region_signals = Parallel(n_jobs=self.n_jobs)(
          delayed(
              self._cache(
                  _labels_masker_extraction, func_memory_level=2
              )
          )(img, masker, confound)
          for img, confound in zip(imgs_list, confounds)
      )
  
      return region_signals[0] if single_subject else region_signals
  
imports: import warnings
  import numpy
  from joblib import Memory, Parallel, delayed
  from sklearn.base import clone
  from sklearn.feature_extraction import image
  from nilearn.maskers import NiftiLabelsMasker
  from .._utils import fill_doc, stringify_path
  from .._utils.niimg import safe_get_data
  from .._utils.niimg_conversions import iter_check_niimg
  from ..decomposition._multi_pca import _MultiPCA
  from .hierarchical_kmeans_clustering import HierarchicalKMeans
  from .rena_clustering import ReNA
label_desc: Use image node_id 4 for calling the Parcellations obj's underlying member method code with example usage: obj.transform(imgs, confounds) and returns: unknown