Skip to content

Commit da9fc85

Browse files
committed
feat: Catch missing fieldmap metadata, point to CLI option
1 parent 32478f8 commit da9fc85

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

fmriprep/workflows/base.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -615,15 +615,26 @@ def init_single_subject_wf(subject_id: str):
615615
from sdcflows.workflows.base import init_fmap_preproc_wf
616616

617617
fallback_trt = config.workflow.fallback_total_readout_time
618-
fmap_wf = init_fmap_preproc_wf(
619-
use_metadata_estimates=fallback_trt == 'estimated',
620-
fallback_total_readout_time=fallback_trt if isinstance(fallback_trt, float) else None,
621-
debug='fieldmaps' in config.execution.debug,
622-
estimators=fmap_estimators,
623-
omp_nthreads=omp_nthreads,
624-
output_dir=fmriprep_dir,
625-
subject=subject_id,
626-
)
618+
try:
619+
fmap_wf = init_fmap_preproc_wf(
620+
use_metadata_estimates=fallback_trt == 'estimated',
621+
fallback_total_readout_time=fallback_trt
622+
if isinstance(fallback_trt, float)
623+
else None,
624+
debug='fieldmaps' in config.execution.debug,
625+
estimators=fmap_estimators,
626+
omp_nthreads=omp_nthreads,
627+
output_dir=fmriprep_dir,
628+
subject=subject_id,
629+
)
630+
except RuntimeError:
631+
message = (
632+
'Missing readout time information. '
633+
'See documentation for `--fallback-total-readout-time`.'
634+
)
635+
config.loggers.workflow.critical(message, exc_info=True)
636+
sys.exit(os.EX_DATAERR)
637+
627638
fmap_wf.__desc__ = f"""
628639
629640
Preprocessing of B<sub>0</sub> inhomogeneity mappings

0 commit comments

Comments
 (0)