Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

brainprep.interfaces.morphologist._get_single_match

brainprep.interfaces.morphologist._get_single_match(workspace_dir, pattern, error_label)[source]

Return a single filesystem match for a glob pattern inside the workspace derivatives directory.

Parameters:
workspace_dirDirectory

Base workspace directory containing a ‘derivatives’ subdirectory.

patternstr

Glob pattern relative to ‘derivatives’ used to locate the file or directory.

error_labelstr

Human-readable label used in error messages.

Returns:
Path

The unique matched path.

Raises:
FileNotFoundError

If no match is found.

RuntimeError

If more than one match is found.