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"]
code: def __init__(
      self,
      mask_img=None,
      runs=None,
      smoothing_fwhm=None,
      standardize=False,
      standardize_confounds=True,
      detrend=False,
      high_variance_confounds=False,
      low_pass=None,
      high_pass=None,
      t_r=None,
      target_affine=None,
      target_shape=None,
      mask_strategy="background",
      mask_args=None,
      dtype=None,
      memory_level=1,
      memory=Memory(location=None),
      verbose=0,
      reports=True,
      **kwargs,
  ):
      # Mask is provided or computed
      self.mask_img = mask_img
      self.runs = runs
      self.smoothing_fwhm = smoothing_fwhm
      self.standardize = standardize
      self.standardize_confounds = standardize_confounds
      self.high_variance_confounds = high_variance_confounds
      self.detrend = detrend
      self.low_pass = low_pass
      self.high_pass = high_pass
      self.t_r = t_r
      self.target_affine = target_affine
      self.target_shape = target_shape
      self.mask_strategy = mask_strategy
      self.mask_args = mask_args
      self.dtype = dtype
  
      self.memory = memory
      self.memory_level = memory_level
      self.verbose = verbose
      self.reports = reports
      self._report_content = {
          "description": (
              "This report shows the input Nifti image overlaid "
              "with the outlines of the mask (in green). We "
              "recommend to inspect the report for the overlap "
              "between the mask and its input image. "
          ),
          "warning_message": None,
      }
      self._overlay_text = (
          "\n To see the input Nifti image before resampling, "
          "hover over the displayed image."
      )
      self._shelving = False
      self.clean_kwargs = {
          k[7:]: v for k, v in kwargs.items() if k.startswith("clean__")
      }
  
      self.cmap = kwargs.get("cmap", "CMRmap_r")
  
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 1 to create a new NiftiMasker object from inherited base classes: BaseMasker, _utils with example: obj = NiftiMasker(mask_img, runs, smoothing_fwhm, standardize, standardize_confounds, detrend, high_variance_confounds, low_pass, high_pass, t_r, target_affine, target_shape, mask_strategy, mask_args, dtype, memory_level, memory, verbose, reports)