code: def test_nifti_spheres_masker_inverse_overlap(rng):
      # Test overlapping data in inverse_transform
      affine = np.eye(4)
      shape = (5, 5, 5)
  
      data = rng.random(shape + (5,))
      fmri_img = nibabel.Nifti1Image(data, affine)
  
      # Apply mask image - to allow inversion
      mask_img = new_img_like(fmri_img, np.ones(shape))
      seeds = [(0, 0, 0), (2, 2, 2)]
      # Inverse data
      inv_data = rng.random(len(seeds))
  
      overlapping_masker = NiftiSpheresMasker(
          seeds, radius=1, allow_overlap=True, mask_img=mask_img
      ).fit()
      overlapping_masker.inverse_transform(inv_data)
  
      overlapping_masker = NiftiSpheresMasker(
          seeds, radius=2, allow_overlap=True, mask_img=mask_img
      ).fit()
  
      overlap = overlapping_masker.inverse_transform(inv_data)
  
      # Test whether overlapping data is averaged
      assert_array_almost_equal(
          get_data(overlap)[1, 1, 1], np.mean(inv_data)
      )
  
      noverlapping_masker = NiftiSpheresMasker(
          seeds, radius=1, allow_overlap=False, mask_img=mask_img
      ).fit()
  
      noverlapping_masker.inverse_transform(inv_data)
      noverlapping_masker = NiftiSpheresMasker(
          seeds, radius=2, allow_overlap=False, mask_img=mask_img
      ).fit()
  
      with pytest.raises(ValueError, match="Overlap detected"):
          noverlapping_masker.inverse_transform(inv_data)
  
imports: import warnings
  import nibabel
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from nilearn._utils import data_gen
  from nilearn.image import get_data, new_img_like
  from nilearn.maskers import NiftiSpheresMasker
label_desc: Use image node_id 10 for calling a global function with example usage: test_nifti_spheres_masker_inverse_overlap(rng) without return types