code: def test_nifti_maps_masker_overlap():
      """Test resampling in NiftiMapsMasker."""
      affine = np.eye(4)
      shape_maps = (5, 5, 5, 2)
      shape_data = (5, 5, 5, 10)
  
      fmri_img, _ = data_gen.generate_random_img(
          shape_data, affine=affine
      )
  
      non_overlapping_maps = np.zeros(shape_maps)
      non_overlapping_maps[:2, :, :, 0] = 1.0
      non_overlapping_maps[2:, :, :, 1] = 1.0
      non_overlapping_maps_img = nibabel.Nifti1Image(
          non_overlapping_maps,
          affine,
      )
  
      overlapping_maps = np.zeros(shape_maps)
      overlapping_maps[:3, :, :, 0] = 1.0
      overlapping_maps[2:, :, :, 1] = 1.0
      overlapping_maps_img = nibabel.Nifti1Image(
          overlapping_maps, affine
      )
  
      overlapping_masker = NiftiMapsMasker(
          non_overlapping_maps_img,
          allow_overlap=True,
      )
      overlapping_masker.fit_transform(fmri_img)
  
      overlapping_masker = NiftiMapsMasker(
          overlapping_maps_img,
          allow_overlap=True,
      )
      overlapping_masker.fit_transform(fmri_img)
  
      non_overlapping_masker = NiftiMapsMasker(
          non_overlapping_maps_img,
          allow_overlap=False,
      )
      non_overlapping_masker.fit_transform(fmri_img)
  
      non_overlapping_masker = NiftiMapsMasker(
          overlapping_maps_img,
          allow_overlap=False,
      )
      with pytest.raises(ValueError, match="Overlap detected"):
          non_overlapping_masker.fit_transform(fmri_img)
  
file_path: nilearn/nilearn/maskers/tests/test_nifti_maps_masker.py
imports: import warnings
  import nibabel
  import numpy
  import pytest
  from nilearn._utils import data_gen, testing
  from nilearn._utils.exceptions import DimensionError
  from nilearn.image import get_data
  from nilearn.maskers import NiftiMapsMasker
label_desc: Use image node_id 7 for calling a global function with example usage: test_nifti_maps_masker_overlap() without return types