Skip to content

Commit 9d3abce

Browse files
authored
ENH: Improve fieldmap support (#205)
* MAINT: Bump black to avoid click dependency issues * ENH: Add flag to control maximum volumes topup uses * FIX: Re-enable reverse-PE EPI fieldmaps Co-authored by: Christopher J. Markiewicz <[email protected]>
1 parent 74e80e1 commit 9d3abce

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ repos:
77
- id: check-yaml
88
- id: check-added-large-files
99
- repo: https://github.com/psf/black
10-
rev: 22.1.0
10+
rev: 22.3.0
1111
hooks:
1212
- id: black

nibabies/cli/parser.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,12 @@ def _slice_time_ref(value, parser):
442442
default=True,
443443
help="do not remove median (within mask) from fieldmap",
444444
)
445+
g_fmap.add_argument(
446+
"--topup-max-vols",
447+
default=5,
448+
type=int,
449+
help="maximum number of volumes to use with TOPUP, per-series (EPI or BOLD)",
450+
)
445451

446452
# SyN-unwarp options
447453
g_syn = parser.add_argument_group("Specific options for SyN distortion correction")

nibabies/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,8 @@ class workflow(_Config):
557557
spaces = None
558558
"""Keeps the :py:class:`~niworkflows.utils.spaces.SpatialReferences`
559559
instance keeping standard and nonstandard spaces."""
560+
topup_max_vols = 5
561+
"""Maximum number of volumes to use with TOPUP, per-series (EPI or BOLD)."""
560562
use_aroma = None
561563
"""Run ICA-:abbr:`AROMA (automatic removal of motion artifacts)`."""
562564
use_bbr = False

nibabies/workflows/base.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -484,21 +484,20 @@ def init_single_subject_wf(subject_id):
484484
if estimator.method in (fm.EstimatorType.MAPPED, fm.EstimatorType.PHASEDIFF):
485485
continue
486486

487-
suffices = set(s.suffix for s in estimator.sources)
488-
489-
if estimator.method == fm.EstimatorType.PEPOLAR and sorted(suffices) == ["epi"]:
490-
getattr(fmap_wf.inputs, f"in_{estimator.bids_id}").in_data = [
491-
str(s.path) for s in estimator.sources
492-
]
493-
getattr(fmap_wf.inputs, f"in_{estimator.bids_id}").metadata = [
494-
s.metadata for s in estimator.sources
495-
]
496-
continue
487+
suffices = [s.suffix for s in estimator.sources]
497488

498489
if estimator.method == fm.EstimatorType.PEPOLAR:
499-
raise NotImplementedError(
500-
"Sophisticated PEPOLAR schemes (e.g., using DWI+EPI) are unsupported."
501-
)
490+
if set(suffices) == {"epi"} or sorted(suffices) == ["bold", "epi"]:
491+
fmap_wf_inputs = getattr(fmap_wf.inputs, f"in_{estimator.bids_id}")
492+
fmap_wf_inputs.in_data = [str(s.path) for s in estimator.sources]
493+
fmap_wf_inputs.metadata = [s.metadata for s in estimator.sources]
494+
495+
flatten = fmap_wf.get_node(f"wf_{estimator.bids_id}.flatten")
496+
flatten.inputs.max_trs = config.workflow.topup_max_vols
497+
else:
498+
raise NotImplementedError(
499+
"Sophisticated PEPOLAR schemes (e.g., using DWI+EPI) are unsupported."
500+
)
502501

503502
return workflow
504503

0 commit comments

Comments
 (0)