Skip to content

Commit 01f6474

Browse files
committed
enh: do not use inline connections when feeding outputnodes
1 parent a2d838d commit 01f6474

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

niworkflows/func/util.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from ..interfaces.masks import SimpleShowMaskRPT
2222
from ..interfaces.registration import EstimateReferenceImage
2323
from ..interfaces.utils import CopyXForm
24-
from ..utils.misc import select_first, pass_dummy_scans as _pass_dummy_scans
24+
from ..utils.misc import pass_dummy_scans as _pass_dummy_scans
2525

2626

2727
DEFAULT_MEMORY_MIN_GB = 0.01
@@ -173,9 +173,15 @@ def init_bold_reference_wf(
173173
run_without_submitting=True,
174174
mem_gb=DEFAULT_MEMORY_MIN_GB,
175175
)
176+
sel_1st = pe.Node(niu.Select(index=[0]),
177+
name="sel_1st", run_without_submitting=True)
176178

177179
# fmt: off
178180
workflow.connect([
181+
(inputnode, validate, [
182+
(("bold_file", ensure_list) if multiecho else "bold_file",
183+
"in_file"),
184+
]),
179185
(inputnode, enhance_and_skullstrip_bold_wf, [
180186
("bold_mask", "inputnode.pre_mask"),
181187
]),
@@ -185,10 +191,7 @@ def init_bold_reference_wf(
185191
(gen_ref, enhance_and_skullstrip_bold_wf, [
186192
("ref_image", "inputnode.in_file"),
187193
]),
188-
(validate, outputnode, [
189-
(("out_file", select_first), "bold_file"),
190-
("out_report", "validation_report"),
191-
]),
194+
(validate, sel_1st, [(("out_file", ensure_list), "inlist")]),
192195
(gen_ref, calc_dummy_scans, [("n_volumes_to_discard", "algo_dummy_scans")]),
193196
(calc_dummy_scans, outputnode, [("skip_vols_num", "skip_vols")]),
194197
(gen_ref, outputnode, [
@@ -200,16 +203,9 @@ def init_bold_reference_wf(
200203
("outputnode.mask_file", "bold_mask"),
201204
("outputnode.skull_stripped_file", "ref_image_brain"),
202205
]),
206+
(validate, outputnode, [("out_report", "validation_report")]),
207+
(sel_1st, outputnode, [("out", "bold_file")]),
203208
])
204-
205-
if multiecho:
206-
workflow.connect([
207-
(inputnode, validate, [(("bold_file", ensure_list), "in_file")]),
208-
])
209-
else:
210-
workflow.connect([
211-
(inputnode, validate, [("bold_file", "in_file")]),
212-
])
213209
# fmt: on
214210

215211
if gen_report:

0 commit comments

Comments
 (0)