class_docstr: Class for masking of Niimg-like objects using seeds.
  
  NiftiSpheresMasker is useful when data from given seeds should be
  extracted. Use case: Summarize brain signals from seeds that were
  obtained from prior knowledge.
  
  Parameters
  ----------
  seeds : :obj:`list` of triplet of coordinates in native space
      Seed definitions. List of coordinates of the seeds in the same space
      as the images (typically MNI or TAL).
  
  radius : :obj:`float`, default=None
      Indicates, in millimeters, the radius for the sphere around the seed.
      By default signal is extracted on a single voxel.
  
  mask_img : Niimg-like object, default=None
      See :ref:`extracting_data`.
      Mask to apply to regions before extracting signals.
  
  allow_overlap : :obj:`bool`, default=False
      If False, an error is raised if the maps overlaps (ie at least two
      maps have a non-zero value for the same voxel).
  %(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
  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
  %(masker_kwargs)s
  
  Attributes
  ----------
  n_elements_ : :obj:`int`
      The number of seeds in the masker.
  
      .. versionadded:: 0.9.2
  
  seeds_ : :obj:`list` of :obj:`list`
      The coordinates of the seeds in the masker.
  
  reports : boolean, default=True
       If set to True, data is saved in order to produce a report.
  
  See Also
  --------
  nilearn.maskers.NiftiMasker
docstr: Compute :term:`voxel` signals from spheres signals.
  
  Any mask given at initialization is taken into account. Throws an error
  if ``mask_img==None``
  
  Parameters
  ----------
  region_signals : 1D/2D :obj:`numpy.ndarray`
      Signal for each region.
      If a 1D array is provided, then the shape should be
      (number of elements,), and a 3D img will be returned.
      If a 2D array is provided, then the shape should be
      (number of scans, number of elements), and a 4D img will be
      returned.
  
  Returns
  -------
  voxel_signals : :obj:`nibabel.nifti1.Nifti1Image`
      Signal for each sphere.
      shape: (mask_img, number of scans).
docstr_tok: ["Compute",":","term",":","`","voxel","`","signals","from","spheres","signals",".","Any","mask","given","at","initialization","is","taken","into","account",".","Throws","an","error","if","``","mask_img==None","``","Parameters","--","--","--","--","--","region_signals",":","1D\/2D",":","obj",":","`","numpy.ndarray","`","Signal","for","each","region",".","If","a","1D","array","is","provided",",","then","the","shape","should","be","(","number","of","elements",",",")",",","and","a","3D","img","will","be","returned",".","If","a","2D","array","is","provided",",","then","the","shape","should","be","(","number","of","scans",",","number","of","elements",")",",","and","a","4D","img","will","be","returned",".","Returns","--","--","--","-","voxel_signals",":",":","obj",":","`","nibabel.nifti1.Nifti1Image","`","Signal","for","each","sphere",".","shape",":","(","mask_img",",","number","of","scans",")","."]
code: def inverse_transform(self, region_signals):
      """Compute :term:`voxel` signals from spheres signals.
  
      Any mask given at initialization is taken into account. Throws an error
      if ``mask_img==None``
  
      Parameters
      ----------
      region_signals : 1D/2D :obj:`numpy.ndarray`
          Signal for each region.
          If a 1D array is provided, then the shape should be
          (number of elements,), and a 3D img will be returned.
          If a 2D array is provided, then the shape should be
          (number of scans, number of elements), and a 4D img will be
          returned.
  
      Returns
      -------
      voxel_signals : :obj:`nibabel.nifti1.Nifti1Image`
          Signal for each sphere.
          shape: (mask_img, number of scans).
  
      """
      self._check_fitted()
  
      logger.log("computing image from signals", verbose=self.verbose)
  
      if self.mask_img is not None:
          mask = check_niimg_3d(self.mask_img)
      else:
          raise ValueError(
              "Please provide mask_img at initialization to "
              "provide a reference for the inverse_transform."
          )
  
      _, adjacency = _apply_mask_and_get_affinity(
          self.seeds_,
          None,
          self.radius,
          self.allow_overlap,
          mask_img=mask,
      )
      adjacency = adjacency.tocsr()
      # Compute overlap scaling for mean signal:
      if self.allow_overlap:
          n_adjacent_spheres = np.asarray(adjacency.sum(axis=0)).ravel()
          scale = 1 / np.maximum(1, n_adjacent_spheres)
          adjacency = adjacency.dot(sparse.diags(scale))
  
      img = adjacency.T.dot(region_signals.T).T
      return masking.unmask(img, self.mask_img)
  
imports: import warnings
  import numpy
  from joblib import Memory
  from scipy import sparse
  from sklearn import neighbors
  from nilearn import image, masking
  from nilearn._utils import CacheMixin, fill_doc, logger
  from nilearn._utils.class_inspect import get_params
  from nilearn._utils.niimg import img_data_dtype
  from nilearn._utils.niimg_conversions import check_niimg_3d, check_niimg_4d, safe_get_data
  from nilearn.datasets import load_mni152_template
  from nilearn.maskers._utils import compute_middle_image
  from nilearn.maskers.base_masker import BaseMasker, _filter_and_extract
label_desc: Use image node_id 8 for calling the NiftiSpheresMasker obj's underlying member method code with example usage: obj.inverse_transform(region_signals) and returns: masking