class_docstr: Applying a mask to extract time-series from Niimg-like objects.
  
  NiftiMasker is useful when preprocessing (detrending, standardization,
  resampling, etc.) of in-mask :term:`voxels<voxel>` is necessary.
  Use case: working with time series of :term:`resting-state` or task maps.
  
  Parameters
  ----------
  mask_img : Niimg-like object, optional
      See :ref:`extracting_data`.
      Mask for the data. If not given, a mask is computed in the fit step.
      Optional parameters (mask_args and mask_strategy) can be set to
      fine tune the mask extraction.
      If the mask and the images have different resolutions, the images
      are resampled to the mask resolution.
      If target_shape and/or target_affine are provided, the mask is
      resampled first. After this, the images are resampled to the
      resampled mask.
  
  runs : :obj:`numpy.ndarray`, optional
      Add a run level to the preprocessing. Each run will be
      detrended independently. Must be a 1D array of n_samples elements.
  %(smoothing_fwhm)s
  %(standardize_maskers)s
  %(standardize_confounds)s
  high_variance_confounds : :obj:`bool`, default=False
      If True, high variance confounds are computed on provided image with
      :func:`nilearn.image.high_variance_confounds` and default parameters
      and regressed out.
  %(detrend)s
  %(low_pass)s
  %(high_pass)s
  %(t_r)s
  target_affine : 3x3 or 4x4 :obj:`numpy.ndarray`, optional
      This parameter is passed to image.resample_img. Please see the
      related documentation for details.
  
  target_shape : 3-:obj:`tuple` of :obj:`int`, optional
      This parameter is passed to 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='background'.
  
  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.
  
  dtype : {dtype, "auto"}, optional
      Data type toward which the data should be converted. If "auto", the
      data will be converted to int32 if dtype is discrete and float32 if it
      is continuous.
  %(memory)s
  %(memory_level1)s
  %(verbose0)s
  reports : :obj:`bool`, default=True
      If set to True, data is saved in order to produce a report.
  
  %(masker_kwargs)s
  
  Attributes
  ----------
  mask_img_ : :obj:`nibabel.nifti1.Nifti1Image`
      The mask of the data, or the computed one.
  
  affine_ : 4x4 :obj:`numpy.ndarray`
      Affine of the transformed image.
  
  n_elements_ : :obj:`int`
      The number of voxels in the mask.
  
      .. versionadded:: 0.9.2
  
  See Also
  --------
  nilearn.masking.compute_background_mask
  nilearn.masking.compute_epi_mask
  nilearn.image.resample_img
  nilearn.image.high_variance_confounds
  nilearn.masking.apply_mask
  nilearn.signal.clean
class_docstr_tok: ["Applying","a","mask","to","extract","time-series","from","Niimg-like","objects",".","NiftiMasker","is","useful","when","preprocessing","(","detrending",",","standardization",",","resampling",",","etc",".",")","of","in-mask",":","term",":","`","voxels","<","voxel",">","`","is","necessary",".","Use","case",":","working","with","time","series","of",":","term",":","`","resting-state","`","or","task","maps",".","Parameters","--","--","--","--","--","mask_img",":","Niimg-like","object",",","optional","See",":","ref",":","`","extracting_data","`",".","Mask","for","the","data",".","If","not","given",",","a","mask","is","computed","in","the","fit","step",".","Optional","parameters","(","mask_args","and","mask_strategy",")","can","be","set","to","fine","tune","the","mask","extraction",".","If","the","mask","and","the","images","have","different","resolutions",",","the","images","are","resampled","to","the","mask","resolution",".","If","target_shape","and\/or","target_affine","are","provided",",","the","mask","is","resampled","first",".","After","this",",","the","images","are","resampled","to","the","resampled","mask",".","runs",":",":","obj",":","`","numpy.ndarray","`",",","optional","Add","a","run","level","to","the","preprocessing",".","Each","run","will","be","detrended","independently",".","Must","be","a","1D","array","of","n_samples","elements",".","%","(","smoothing_fwhm",")","s","%","(","standardize_maskers",")","s","%","(","standardize_confounds",")","s","high_variance_confounds",":",":","obj",":","`","bool","`",",","default=False","If","True",",","high","variance","confounds","are","computed","on","provided","image","with",":","func",":","`","nilearn.image.high_variance_confounds","`","and","default","parameters","and","regressed","out",".","%","(","detrend",")","s","%","(","low_pass",")","s","%","(","high_pass",")","s","%","(","t_r",")","s","target_affine",":","3x3","or","4x4",":","obj",":","`","numpy.ndarray","`",",","optional","This","parameter","is","passed","to","image.resample_img",".","Please","see","the","related","documentation","for","details",".","target_shape",":","3-",":","obj",":","`","tuple","`","of",":","obj",":","`","int","`",",","optional","This","parameter","is","passed","to","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='background","'",".","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",".","dtype",":","{","dtype",",","``","auto","''","}",",","optional","Data","type","toward","which","the","data","should","be","converted",".","If","``","auto","''",",","the","data","will","be","converted","to","int32","if","dtype","is","discrete","and","float32","if","it","is","continuous",".","%","(","memory",")","s","%","(","memory_level1",")","s","%","(","verbose0",")","s","reports",":",":","obj",":","`","bool","`",",","default=True","If","set","to","True",",","data","is","saved","in","order","to","produce","a","report",".","%","(","masker_kwargs",")","s","Attributes","--","--","--","--","--","mask_img_",":",":","obj",":","`","nibabel.nifti1.Nifti1Image","`","The","mask","of","the","data",",","or","the","computed","one",".","affine_",":","4x4",":","obj",":","`","numpy.ndarray","`","Affine","of","the","transformed","image",".","n_elements_",":",":","obj",":","`","int","`","The","number","of","voxels","in","the","mask",".","..","versionadded",":",":","0.9.2","See","Also","--","--","--","--","nilearn.masking.compute_background_mask","nilearn.masking.compute_epi_mask","nilearn.image.resample_img","nilearn.image.high_variance_confounds","nilearn.masking.apply_mask","nilearn.signal.clean"]
docstr: Apply mask, spatial and temporal preprocessing.
  
  Parameters
  ----------
  imgs : 3D/4D Niimg-like object
      See :ref:`extracting_data`.
      Images to process.
      If a 3D niimg is provided, a singleton dimension will be added to
      the output to represent the single scan in the niimg.
  
  confounds : CSV file or array-like or :obj:`pandas.DataFrame`, optional
      This parameter is passed to signal.clean. Please see the related
      documentation for details: :func:`nilearn.signal.clean`.
      shape: (number of scans, number of confounds)
  
  sample_mask : Any type compatible with numpy-array indexing, optional
      shape: (number of scans - number of volumes removed, )
      Masks the niimgs along time/fourth dimension to perform scrubbing
      (remove volumes with high motion) and/or non-steady-state volumes.
      This parameter is passed to signal.clean.
  
  copy : :obj:`bool`, default=True
      Indicates whether a copy is returned or not.
  
  Returns
  -------
  region_signals : 2D :obj:`numpy.ndarray`
      Signal for each :term:`voxel` inside the mask.
      shape: (number of scans, number of voxels)
  
  Warns
  -----
  DeprecationWarning
      If a 3D niimg input is provided, the current behavior
      (adding a singleton dimension to produce a 2D array) is deprecated.
      Starting in version 0.12, a 1D array will be returned for 3D
      inputs.
docstr_tok: ["Apply","mask",",","spatial","and","temporal","preprocessing",".","Parameters","--","--","--","--","--","imgs",":","3D\/4D","Niimg-like","object","See",":","ref",":","`","extracting_data","`",".","Images","to","process",".","If","a","3D","niimg","is","provided",",","a","singleton","dimension","will","be","added","to","the","output","to","represent","the","single","scan","in","the","niimg",".","confounds",":","CSV","file","or","array-like","or",":","obj",":","`","pandas.DataFrame","`",",","optional","This","parameter","is","passed","to","signal.clean",".","Please","see","the","related","documentation","for","details",":",":","func",":","`","nilearn.signal.clean","`",".","shape",":","(","number","of","scans",",","number","of","confounds",")","sample_mask",":","Any","type","compatible","with","numpy-array","indexing",",","optional","shape",":","(","number","of","scans","-","number","of","volumes","removed",",",")","Masks","the","niimgs","along","time\/fourth","dimension","to","perform","scrubbing","(","remove","volumes","with","high","motion",")","and\/or","non-steady-state","volumes",".","This","parameter","is","passed","to","signal.clean",".","copy",":",":","obj",":","`","bool","`",",","default=True","Indicates","whether","a","copy","is","returned","or","not",".","Returns","--","--","--","-","region_signals",":","2D",":","obj",":","`","numpy.ndarray","`","Signal","for","each",":","term",":","`","voxel","`","inside","the","mask",".","shape",":","(","number","of","scans",",","number","of","voxels",")","Warns","--","--","-","DeprecationWarning","If","a","3D","niimg","input","is","provided",",","the","current","behavior","(","adding","a","singleton","dimension","to","produce","a","2D","array",")","is","deprecated",".","Starting","in","version","0.12",",","a","1D","array","will","be","returned","for","3D","inputs","."]
code: def transform_single_imgs(
      self,
      imgs,
      confounds=None,
      sample_mask=None,
      copy=True,
  ):
      """Apply mask, spatial and temporal preprocessing.
  
      Parameters
      ----------
      imgs : 3D/4D Niimg-like object
          See :ref:`extracting_data`.
          Images to process.
          If a 3D niimg is provided, a singleton dimension will be added to
          the output to represent the single scan in the niimg.
  
      confounds : CSV file or array-like or :obj:`pandas.DataFrame`, optional
          This parameter is passed to signal.clean. Please see the related
          documentation for details: :func:`nilearn.signal.clean`.
          shape: (number of scans, number of confounds)
  
      sample_mask : Any type compatible with numpy-array indexing, optional
          shape: (number of scans - number of volumes removed, )
          Masks the niimgs along time/fourth dimension to perform scrubbing
          (remove volumes with high motion) and/or non-steady-state volumes.
          This parameter is passed to signal.clean.
  
      copy : :obj:`bool`, default=True
          Indicates whether a copy is returned or not.
  
      Returns
      -------
      region_signals : 2D :obj:`numpy.ndarray`
          Signal for each :term:`voxel` inside the mask.
          shape: (number of scans, number of voxels)
  
      Warns
      -----
      DeprecationWarning
          If a 3D niimg input is provided, the current behavior
          (adding a singleton dimension to produce a 2D array) is deprecated.
          Starting in version 0.12, a 1D array will be returned for 3D
          inputs.
  
      """
      # Ignore the mask-computing params: they are not useful and will
      # just invalid the cache for no good reason
      # target_shape and target_affine are conveyed implicitly in mask_img
      params = _utils.class_inspect.get_params(
          self.__class__,
          self,
          ignore=[
              "mask_img",
              "mask_args",
              "mask_strategy",
              "_sample_mask",
              "sample_mask",
          ],
      )
      params["clean_kwargs"] = self.clean_kwargs
  
      data = self._cache(
          _filter_and_mask,
          ignore=[
              "verbose",
              "memory",
              "memory_level",
              "copy",
          ],
          shelve=self._shelving,
      )(
          imgs,
          self.mask_img_,
          params,
          memory_level=self.memory_level,
          memory=self.memory,
          verbose=self.verbose,
          confounds=confounds,
          sample_mask=sample_mask,
          copy=copy,
          dtype=self.dtype,
      )
  
      return data
  
imports: import warnings
  from copy import copy
  from functools import partial
  from joblib import Memory
  from nilearn import _utils, image, masking
  from nilearn.maskers._utils import compute_middle_image
  from nilearn.maskers.base_masker import BaseMasker, _filter_and_extract
label_desc: Use image node_id 6 for calling the NiftiMasker obj's underlying member method code with example usage: obj.transform_single_imgs(imgs, confounds, sample_mask, copy) and returns: data