From fd66f7c827841624766431205e81c005a39924fa Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Sun, 3 Nov 2024 09:01:42 +0100 Subject: [PATCH 1/3] enh: flexibilize "sophisticated" pepolar to allow monomodal execution --- fmriprep/workflows/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index 01664861..22fb0b72 100644 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -580,7 +580,10 @@ def init_single_subject_wf(subject_id: str): suffices = [s.suffix for s in estimator.sources] if estimator.method == fm.EstimatorType.PEPOLAR: - if len(suffices) == 2 and all(suf in ('epi', 'bold', 'sbref') for suf in suffices): + if ( + len(set(suffices)) == 1 + or (len(suffices) == 2 and all(suf in ('epi', 'bold', 'sbref') for suf in suffices)) + ): wf_inputs = getattr(fmap_wf.inputs, f'in_{estimator.bids_id}') wf_inputs.in_data = [str(s.path) for s in estimator.sources] wf_inputs.metadata = [s.metadata for s in estimator.sources] From 82e9f8b7ac3395272070ce9b408d8a771521fd27 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Sun, 3 Nov 2024 15:00:53 +0100 Subject: [PATCH 2/3] enh: comment code for maintainability --- fmriprep/workflows/base.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index 22fb0b72..8710e694 100644 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -580,9 +580,18 @@ def init_single_subject_wf(subject_id: str): suffices = [s.suffix for s in estimator.sources] if estimator.method == fm.EstimatorType.PEPOLAR: + # "Sophisticated" PEPOLAR schemes should be run "manually" with SDCFlows + # The following two cases are not considered sophisticated: + # 1. All PEPOLAR entities are the same modality + # (typically, more than two EPI PE directions), or + # 2. Two modalities are involved, with at most two images to pass + # into FSL TOPUP. if ( len(set(suffices)) == 1 - or (len(suffices) == 2 and all(suf in ('epi', 'bold', 'sbref') for suf in suffices)) + or ( + len(suffices) == 2 + and all(suf in ('epi', 'bold', 'sbref') for suf in suffices) + ) ): wf_inputs = getattr(fmap_wf.inputs, f'in_{estimator.bids_id}') wf_inputs.in_data = [str(s.path) for s in estimator.sources] From 729b5b923599bc80d9d2de6d8fe0e957d4337cab Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Sun, 3 Nov 2024 09:52:44 -0500 Subject: [PATCH 3/3] STY: ruff [ignore-rev] --- fmriprep/workflows/base.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index 8710e694..1cdac46a 100644 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -586,12 +586,8 @@ def init_single_subject_wf(subject_id: str): # (typically, more than two EPI PE directions), or # 2. Two modalities are involved, with at most two images to pass # into FSL TOPUP. - if ( - len(set(suffices)) == 1 - or ( - len(suffices) == 2 - and all(suf in ('epi', 'bold', 'sbref') for suf in suffices) - ) + if len(set(suffices)) == 1 or ( + len(suffices) == 2 and all(suf in ('epi', 'bold', 'sbref') for suf in suffices) ): wf_inputs = getattr(fmap_wf.inputs, f'in_{estimator.bids_id}') wf_inputs.in_data = [str(s.path) for s in estimator.sources]