mantidimaging.core.io.filenames module#

class mantidimaging.core.io.filenames.FilenameGroup(directory: Path, pattern: FilenamePattern, all_indexes: list[int])[source]#

Bases: object

all_files() Iterator[Path][source]#
find_all_files() None[source]#
find_log_file() None[source]#

Find the first non-empty list of log paths matching any schema, then filter out paths containing ‘ShutterCount’ and select the shortest one

find_shutter_count_file() None[source]#

Try to find the shutter count file in directory if it exists in the parent directory.

first_file()[source]#
classmethod from_directory(path: Path | str) FilenameGroup | None[source]#
classmethod from_file(path: Path | str) FilenameGroup[source]#
classmethod get_pattern_class(path)[source]#
static valid_image_filename(f: Path) bool[source]#

Check that file is not hidden (starts with a dot) and that it has an image extension

class mantidimaging.core.io.filenames.FilenamePattern(prefix: str, digit_count: int, suffix: str)[source]#

Bases: object

Representation of a filename pattern to handle stacks of related images

Handles patterns like “aaaa_####.bbb” where # are digits

PATTERN = re.compile('^(.+?)([0-9]+)(\\.[a-zA-Z_]+)$')#
PATTERN_d = '([0-9]+)'#
PATTERN_p = '^(.+?)'#
PATTERN_s = '(\\.[a-zA-Z_]+)$'#
classmethod from_name(filename: str) FilenamePattern[source]#
generate(index: int) str[source]#
get_index(filename: str) int[source]#
match(filename: str) bool[source]#
match_metadata(filename: str) bool[source]#
class mantidimaging.core.io.filenames.FilenamePatternGolden(prefix: str, digit_count: int, suffix: str)[source]#

Bases: FilenamePattern

Representation of a filename pattern for IMAT Golden ratio scans

“aaaa_**.**_####.bbb” where . is an angle and #### is the projection number

PATTERN = re.compile('^(.+?)_([0-9\\.]+)_([0-9]+)(\\.[a-zA-Z]+)$')#
PATTERN_a = '_([0-9\\.]+)_'#
PATTERN_d = '([0-9]+)'#
PATTERN_p = '^(.+?)'#
PATTERN_s = '(\\.[a-zA-Z]+)$'#
classmethod from_name(filename: str) FilenamePattern[source]#
generate(index: int) str[source]#
get_index(filename: str) int[source]#