class_docstr: Base class for NiftiMaskers.
class_docstr_tok: ["Base","class","for","NiftiMaskers","."]
docstr: Fit to data, then transform it.
  
  Parameters
  ----------
  X : Niimg-like object
      See :ref:`extracting_data`.
  
  y : numpy array of shape [n_samples], optional
      Target values.
  
  confounds : list of confounds, optional
      List of confounds (2D arrays or filenames pointing to CSV
      files). Must be of same length than imgs_list.
  
  sample_mask : list of sample_mask, optional
      List of sample_mask (1D arrays) if scrubbing motion outliers.
      Must be of same length than imgs_list.
  
          .. versionadded:: 0.8.0
  
  Returns
  -------
  X_new : numpy array of shape [n_samples, n_features_new]
      Transformed array.
docstr_tok: ["Fit","to","data",",","then","transform","it",".","Parameters","--","--","--","--","--","X",":","Niimg-like","object","See",":","ref",":","`","extracting_data","`",".","y",":","numpy","array","of","shape","[","n_samples","]",",","optional","Target","values",".","confounds",":","list","of","confounds",",","optional","List","of","confounds","(","2D","arrays","or","filenames","pointing","to","CSV","files",")",".","Must","be","of","same","length","than","imgs_list",".","sample_mask",":","list","of","sample_mask",",","optional","List","of","sample_mask","(","1D","arrays",")","if","scrubbing","motion","outliers",".","Must","be","of","same","length","than","imgs_list",".","..","versionadded",":",":","0.8.0","Returns","--","--","--","-","X_new",":","numpy","array","of","shape","[","n_samples",",","n_features_new","]","Transformed","array","."]
code: def fit_transform(
      self, X, y=None, confounds=None, sample_mask=None, **fit_params
  ):
      """Fit to data, then transform it.
  
      Parameters
      ----------
      X : Niimg-like object
          See :ref:`extracting_data`.
  
      y : numpy array of shape [n_samples], optional
          Target values.
  
      confounds : list of confounds, optional
          List of confounds (2D arrays or filenames pointing to CSV
          files). Must be of same length than imgs_list.
  
      sample_mask : list of sample_mask, optional
          List of sample_mask (1D arrays) if scrubbing motion outliers.
          Must be of same length than imgs_list.
  
              .. versionadded:: 0.8.0
  
      Returns
      -------
      X_new : numpy array of shape [n_samples, n_features_new]
          Transformed array.
  
      """
      # non-optimized default implementation; override when a better
      # method is possible for a given clustering algorithm
      if y is None:
          # fit method of arity 1 (unsupervised transformation)
          if self.mask_img is None:
              return self.fit(X, **fit_params).transform(
                  X, confounds=confounds, sample_mask=sample_mask
              )
  
          return self.fit(**fit_params).transform(
              X, confounds=confounds, sample_mask=sample_mask
          )
  
      # fit method of arity 2 (supervised transformation)
      if self.mask_img is None:
          return self.fit(X, y, **fit_params).transform(
              X, confounds=confounds, sample_mask=sample_mask
          )
  
      warnings.warn(
          f"[{self.__class__.__name__}.fit] "
          "Generation of a mask has been"
          " requested (y != None) while a mask has"
          " been provided at masker creation. Given mask"
          " will be used."
      )
      return self.fit(**fit_params).transform(
          X, confounds=confounds, sample_mask=sample_mask
      )
  
file_path: nilearn/nilearn/maskers/base_masker.py
imports: import abc
  import warnings
  import numpy
  from joblib import Memory
  from sklearn.base import BaseEstimator, TransformerMixin
  from nilearn.image import high_variance_confounds
  from ..None import _utils, image, masking, signal
  from .._utils import stringify_path
  from .._utils.cache_mixin import CacheMixin, cache
  from .._utils.class_inspect import enclosing_scope_name
label_desc: Use image node_id 3 for calling the BaseMasker obj's underlying member method code with example usage: obj.fit_transform(X, y, confounds, sample_mask) and returns: self, self, self, self