Skip to content

Commit d390517

Browse files
committed
enh: use sdcflows.interfaces.fmap.get_trt instead of custom function
Addressing the weak spot identified by @dPys (https://github.com/nipreps/dmriprep/pull/97/files#r416242563).
1 parent 9bad2ad commit d390517

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

dmriprep/workflows/fmap/base.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def init_pepolar_estimate_wf(debug=False, generate_report=True, name="pepolar_es
9292
from nipype.interfaces.afni import Automask
9393
from nipype.interfaces.fsl.epi import TOPUP
9494
from niworkflows.interfaces.nibabel import MergeSeries
95+
from sdcflows.interfaces.fmap import get_trt
9596
from ...interfaces.images import RescaleB0
9697
wf = Workflow(name=name)
9798

@@ -101,6 +102,10 @@ def init_pepolar_estimate_wf(debug=False, generate_report=True, name="pepolar_es
101102
name="outputnode")
102103

103104
concat_blips = pe.Node(MergeSeries(), name="concat_blips")
105+
readout_time = pe.MapNode(niu.Function(
106+
input_names=["metadata", "in_file"], function=get_trt), name="readout_time",
107+
iterfield=["metadata", "in_file"], run_without_submitting=True
108+
)
104109

105110
topup = pe.Node(TOPUP(config=_pkg_fname(
106111
"dmriprep", f"data/flirtsch/b02b0{'_quick' * debug}.cnf")), name="topup")
@@ -112,8 +117,10 @@ def init_pepolar_estimate_wf(debug=False, generate_report=True, name="pepolar_es
112117
name="post_mask")
113118
wf.connect([
114119
(inputnode, concat_blips, [("in_data", "in_files")]),
115-
(inputnode, topup, [(("metadata", _get_ro), "readout_times"),
116-
(("metadata", _get_pedir), "encoding_direction")]),
120+
(inputnode, readout_time, [("in_data", "in_file"),
121+
("metadata", "metadata")]),
122+
(inputnode, topup, [(("metadata", _get_pedir), "encoding_direction")]),
123+
(readout_time, topup, [("out", "readout_times")]),
117124
(concat_blips, topup, [("out_file", "in_file")]),
118125
(topup, pre_mask, [("out_corrected", "in_file")]),
119126
(pre_mask, rescale_corrected, [("out_file", "mask_file")]),

0 commit comments

Comments
 (0)