code: def _iter_signals_from_spheres(
      seeds, niimg, radius, allow_overlap, mask_img=None
  ):
      """Iterate over spheres.
  
      Parameters
      ----------
      seeds : :obj:`list` of triplets of coordinates in native space
          Seed definitions. List of coordinates of the seeds in the same space
          as the images (typically MNI or TAL).
  
      niimg : 3D/4D Niimg-like object
          See :ref:`extracting_data`.
          Images to process.
          If a 3D niimg is provided, a singleton dimension will be added to
          the output to represent the single scan in the niimg.
  
      radius: float
          Indicates, in millimeters, the radius for the sphere around the seed.
  
      allow_overlap: boolean
          If False, an error is raised if the maps overlaps (ie at least two
          maps have a non-zero value for the same voxel).
  
      mask_img : Niimg-like object, optional
          See :ref:`extracting_data`.
          Mask to apply to regions before extracting signals.
  
      """
      X, A = _apply_mask_and_get_affinity(
          seeds, niimg, radius, allow_overlap, mask_img=mask_img
      )
      for row in A.rows:
          yield X[:, row]
  
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 2 for calling a global function with example usage: _iter_signals_from_spheres(seeds, niimg, radius, allow_overlap, mask_img) without return types