Skip to content

Commit

Permalink
Merge pull request #2688 from effigies/enh/max_trs
Browse files Browse the repository at this point in the history
ENH: Add --topup-max-vols flag to control TOPUP runtime
  • Loading branch information
effigies authored Jan 20, 2022
2 parents 32dac40 + 0e3d978 commit 0caba88
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
7 changes: 7 additions & 0 deletions fmriprep/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,13 @@ def _slice_time_ref(value, parser):
default=True,
help="do not remove median (within mask) from fieldmap",
)
g_fmap.add_argument(
"--topup-max-vols",
action="store",
default=5,
type=int,
help="maximum number of volumes to use with TOPUP, per-series (EPI or BOLD)",
)

# SyN-unwarp options
g_syn = parser.add_argument_group("Specific options for SyN distortion correction")
Expand Down
2 changes: 2 additions & 0 deletions fmriprep/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ class workflow(_Config):
spaces = None
"""Keeps the :py:class:`~niworkflows.utils.spaces.SpatialReferences`
instance keeping standard and nonstandard spaces."""
topup_max_vols = 5
"""Maximum number of volumes to use with TOPUP, per-series (EPI or BOLD)."""
use_aroma = None
"""Run ICA-:abbr:`AROMA (automatic removal of motion artifacts)`."""
use_bbr = None
Expand Down
14 changes: 8 additions & 6 deletions fmriprep/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,14 @@ def init_single_subject_wf(subject_id):

if estimator.method == fm.EstimatorType.PEPOLAR:
if set(suffices) == {"epi"} or sorted(suffices) == ["bold", "epi"]:
getattr(fmap_wf.inputs, f"in_{estimator.bids_id}").in_data = [
str(s.path) for s in estimator.sources
]
getattr(fmap_wf.inputs, f"in_{estimator.bids_id}").metadata = [
s.metadata for s in estimator.sources
]
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]

# 21.0.x hack to change the number of volumes used
# The default of 50 takes excessively long
flatten = fmap_wf.get_node(f"wf_{estimator.bids_id}.flatten")
flatten.inputs.max_trs = config.workflow.topup_max_vols
else:
raise NotImplementedError(
"Sophisticated PEPOLAR schemes are unsupported."
Expand Down

0 comments on commit 0caba88

Please sign in to comment.