code: def load_images_from_dir(
      in_dir: Union[str, Path],
      suffix: str = "nii.gz",
  ) -> Iterable[SpatialImage]:
      """Load images from directory.
  
      For efficiency, returns an iterator, not a sequence, so the results cannot
      be accessed by indexing.
  
      For every new iteration through the images, load_images_from_dir must be
      called again.
  
      Parameters
      ----------
      in_dir:
          Path to directory.
      suffix:
          Only load images with names that end like this.
  
      Yields
      ------
      SpatialImage
          Image.
  
      Examples
      --------
      >>> images = list(io.load_images_from_dir("face_scene", "bet.nii.gz"))
      """
      if isinstance(in_dir, str):
          in_dir = Path(in_dir)
      files = sorted(in_dir.glob("*" + suffix))
      for f in files:
          logger.debug("Starting to read file %s", f)
          yield nib.load(str(f))
  
file_path: brainiak/brainiak/io.py
imports: from pathlib import Path
  from typing import Optional, Callable, Iterable, List, Union
  import logging
  import nibabel
  import numpy
  from nibabel.nifti1 import Nifti1Pair
  from nibabel.spatialimages import SpatialImage
  from .image import SingleConditionSpec
label_desc: Use image node_id 1 for calling a global function with example usage: load_images_from_dir(in_dir, suffix) without return types