class_docstr: Class for brain region extraction.
  
  Region Extraction is a post processing technique which
  is implemented to automatically segment each brain atlas maps
  into different set of separated brain activated region.
  Particularly, to show that each decomposed brain maps can be
  used to focus on a target specific Regions of Interest analysis.
  
  See :footcite:t:`Abraham2014`.
  
  .. versionadded:: 0.2
  
  Parameters
  ----------
  maps_img : 4D Niimg-like object
      Image containing a set of whole brain atlas maps or statistically
      decomposed brain maps.
  
  mask_img : Niimg-like object or None, optional
      Mask to be applied to input data, passed to NiftiMapsMasker.
      If None, no masking is applied.
  
  min_region_size : :obj:`float`, default=1350
      Minimum volume in mm3 for a region to be kept.
      For example, if the voxel size is 3x3x3 mm
      then the volume of the voxel is 27mm^3.
      The default of 1350mm^3 means
      we take minimum size of 1350 / 27 = 50 voxels.
  
  threshold : number, default=1.0
      A value used either in ratio_n_voxels or img_value or percentile
      `thresholding_strategy` based upon the choice of selection.
  
  thresholding_strategy : :obj:`str`                             {'ratio_n_voxels', 'img_value', 'percentile'},                             default='ratio_n_voxels'
      If default 'ratio_n_voxels', we apply thresholding that will keep
      the more intense nonzero brain voxels (denoted as n_voxels)
      across all maps (n_voxels being the number of voxels in the brain
      volume). A float value given in `threshold` parameter indicates
      the ratio of voxels to keep meaning (if float=2. then maps will
      together have 2. x n_voxels non-zero voxels). If set to
      'percentile', images are thresholded based on the score obtained
      with the given percentile on the data and the voxel intensities
      which are survived above this obtained score will be kept. If set
      to 'img_value', we apply thresholding based on the non-zero voxel
      intensities across all maps. A value given in `threshold`
      parameter indicates that we keep only those voxels which have
      intensities more than this value.
  %(extractor)s
  %(smoothing_fwhm)s
      Use this parameter to smooth an image
      to extract most sparser regions.
  
      .. note::
  
          This parameter is passed to
          :func:`nilearn.regions.connected_regions`.
          It will be used only if ``extractor='local_regions'``.
  
      .. note::
  
          Please set this parameter according to maps resolution,
          otherwise extraction will fail.
  
      Default=6mm.
  %(standardize_false)s
  
      .. note::
          Recommended to set to True if signals are not already standardized.
          Passed to :class:`~nilearn.maskers.NiftiMapsMasker`.
  
  %(standardize_confounds)s
  
  %(detrend)s
  
      .. note::
          Passed to :func:`nilearn.signal.clean`.
  
      Default=False.
  
  %(low_pass)s
  
      .. note::
          Passed to :func:`nilearn.signal.clean`.
  
  %(high_pass)s
  
      .. note::
          Passed to :func:`nilearn.signal.clean`.
  
  %(t_r)s
  
      .. note::
          Passed to :func:`nilearn.signal.clean`.
  
  %(memory)s
  %(memory_level)s
  %(verbose0)s
  
  Attributes
  ----------
  index_ : :class:`numpy.ndarray`
      Array of list of indices where each index value is assigned to
      each separate region of its corresponding family of brain maps.
  
  regions_img_ : :class:`nibabel.nifti1.Nifti1Image`
      List of separated regions with each region lying on an
      original volume concatenated into a 4D image.
  
  References
  ----------
  .. footbibliography::
  
  See Also
  --------
  nilearn.regions.connected_label_regions : A function can be readily
      used for extraction of regions on labels based atlas images.
code: def __init__(
      self,
      maps_img,
      mask_img=None,
      min_region_size=1350,
      threshold=1.0,
      thresholding_strategy="ratio_n_voxels",
      extractor="local_regions",
      smoothing_fwhm=6,
      standardize=False,
      standardize_confounds=True,
      detrend=False,
      low_pass=None,
      high_pass=None,
      t_r=None,
      memory=Memory(location=None),
      memory_level=0,
      verbose=0,
  ):
      super().__init__(
          maps_img=maps_img,
          mask_img=mask_img,
          smoothing_fwhm=smoothing_fwhm,
          standardize=standardize,
          standardize_confounds=standardize_confounds,
          detrend=detrend,
          low_pass=low_pass,
          high_pass=high_pass,
          t_r=t_r,
          memory=memory,
          memory_level=memory_level,
          verbose=verbose,
      )
      self.maps_img = maps_img
      self.min_region_size = min_region_size
      self.thresholding_strategy = thresholding_strategy
      self.threshold = threshold
      self.extractor = extractor
      self.smoothing_fwhm = smoothing_fwhm
  
imports: import collections.abc
  import numbers
  import numpy
  from joblib import Memory
  from scipy.ndimage import label
  from scipy.stats import scoreatpercentile
  from nilearn.maskers import NiftiMapsMasker
  from ..None import masking
  from .._utils import check_niimg, check_niimg_3d, check_niimg_4d, fill_doc
  from .._utils.ndimage import peak_local_max
  from .._utils.niimg import safe_get_data
  from .._utils.niimg_conversions import check_same_fov
  from .._utils.segmentation import random_walker
  from ..image import new_img_like, resample_img
  from ..image.image import concat_imgs, smooth_array, threshold_img
label_desc: Use image node_id 1 to create a new RegionExtractor object from inherited base classes: NiftiMapsMasker with example: obj = RegionExtractor(maps_img, mask_img, min_region_size, threshold, thresholding_strategy, extractor, smoothing_fwhm, standardize, standardize_confounds, detrend, low_pass, high_pass, t_r, memory, memory_level, verbose)