code: def mask_images(
      images: Iterable[SpatialImage],
      mask: np.ndarray,
      image_type: Optional[type] = None,
  ) -> Iterable[np.ndarray]:
      """Mask images.
  
      Parameters
      ----------
      images:
          Images to mask.
      mask:
          Mask to apply.
      image_type:
          Type to cast images to.
  
      Yields
      ------
      np.ndarray
          Masked image.
      """
      for imgs in multimask_images(images, (mask,), image_type):  # type: ignore
          yield imgs[0]
  
file_path: brainiak/brainiak/image.py
imports: import itertools
  from typing import Optional, Iterable, Sequence, Type, TypeVar
  import numpy
  from nibabel.spatialimages import SpatialImage
label_desc: Use image node_id 3 for calling a global function with example usage: mask_images(images, mask, image_type) without return types