code: def test_is_nifti_spheres_masker_give_nans(rng):
      affine = np.eye(4)
  
      data_with_nans = np.zeros((10, 10, 10), dtype=np.float32)
      data_with_nans[:, :, :] = np.nan
  
      data_without_nans = rng.random((9, 9, 9))
      indices = np.nonzero(data_without_nans)
  
      # Leaving nans outside of some data
      data_with_nans[indices] = data_without_nans[indices]
      img = nibabel.Nifti1Image(data_with_nans, affine)
      seed = [(7, 7, 7)]
  
      # Interaction of seed with nans
      masker = NiftiSpheresMasker(seeds=seed, radius=2.0)
      assert not np.isnan(np.sum(masker.fit_transform(img)))
  
      mask = np.ones((9, 9, 9))
      mask_img = nibabel.Nifti1Image(mask, affine)
      # When mask_img is provided, the seed interacts within the brain, so no nan
      masker = NiftiSpheresMasker(
          seeds=seed, radius=2.0, mask_img=mask_img
      )
      assert not np.isnan(np.sum(masker.fit_transform(img)))
  
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 7 for calling a global function with example usage: test_is_nifti_spheres_masker_give_nans(rng) without return types