openlifu.nav.photoscan.preprocess_image_paths

openlifu.nav.photoscan.preprocess_image_paths(paths: List[Path], sort_by: str = 'filename', sampling_rate: int = 1) List[Path][source]

Sorts and sub-samples a list of image file paths.

Parameters:
  • paths (List[Path]) – A list of image file paths to be processed.

  • sort_by (str) – Method to sort the images. Options are: - ‘filename’: Sort by numeric values extracted from filenames. - ‘metadata’: Sort by the DateTimeOriginal field in EXIF metadata.

  • sampling_rate (int) – Return every n-th image after sorting. Must be >= 1.

Returns:

A sorted and sub-sampled list of image paths.

Return type:

List[Path]

Raises:
  • ValueError – If sort_by is not one of the valid options.

  • ValueError – If sampling_rate is less than 1.

  • ValueError – If sorting by metadata and no valid EXIF DateTimeOriginal is found.