code: def load_images_from_dir(in_dir: Union[str, Path], suffix: str = "nii.gz",
                           ) -> Iterable[SpatialImage]:
      
      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))
docs: 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.