Skip to content

Commit 9865245

Browse files
committed
RF: Group workflow connections
1 parent 8d797ad commit 9865245

File tree

1 file changed

+36
-46
lines changed
  • nibabies/workflows/anatomical

1 file changed

+36
-46
lines changed

nibabies/workflows/anatomical/base.py

Lines changed: 36 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ def init_infant_anat_wf(
267267
# fmt:off
268268
wf.connect([
269269
(inputnode, t1w_template_wf, [("t1w", "inputnode.in_files")]),
270+
(inputnode, t2w_template_wf, [("t2w", "inputnode.in_files")]),
270271
(t1w_template_wf, outputnode, [
271272
("outputnode.realign_xfms", "anat_ref_xfms"),
272273
]),
@@ -298,49 +299,6 @@ def init_infant_anat_wf(
298299
("outputnode.t1w_mask", "inputnode.t1w_mask"),
299300
("outputnode.t1w_preproc", "inputnode.t1w_preproc"),
300301
]),
301-
(coregistration_wf, anat_derivatives_wf, [
302-
("outputnode.t2w_preproc", "inputnode.t2w_preproc")
303-
]),
304-
(t1w_preproc_wf, outputnode, [
305-
("outputnode.t1w_preproc", "anat_preproc"),
306-
("outputnode.t1w_brain", "anat_brain"),
307-
("outputnode.t1w_mask", "anat_mask"),
308-
]),
309-
])
310-
311-
if not precomp_aseg:
312-
wf.connect([
313-
(t1w_preproc_wf, anat_seg_wf, [("outputnode.t1w_brain", "inputnode.anat_brain")]),
314-
])
315-
wf.connect([
316-
(inputnode, t2w_template_wf, [("t2w", "inputnode.in_files")]),
317-
])
318-
if precomp_mask:
319-
wf.connect([
320-
(t1w_template_wf, precomp_mask_wf, [
321-
("outputnode.out_file", "inputnode.t1w"),
322-
]),
323-
(t2w_template_wf, sdc_brain_extraction_wf, [
324-
("outputnode.out_file", "inputnode.in_file"),
325-
]),
326-
(sdc_brain_extraction_wf, coregistration_wf, [
327-
("outputnode.out_file", "inputnode.in_t2w_preproc"),
328-
("outputnode.out_mask", "inputnode.in_mask"),
329-
("outputnode.out_probseg", "inputnode.in_probmap"),
330-
]),
331-
])
332-
else:
333-
wf.connect([
334-
(t2w_template_wf, brain_extraction_wf, [
335-
("outputnode.out_file", "inputnode.in_t2w"),
336-
]),
337-
(brain_extraction_wf, coregistration_wf, [
338-
("outputnode.t2w_preproc", "inputnode.in_t2w_preproc"),
339-
("outputnode.out_mask", "inputnode.in_mask"),
340-
("outputnode.out_probmap", "inputnode.in_probmap"),
341-
]),
342-
])
343-
wf.connect([
344302
(t1w_template_wf, coregistration_wf, [
345303
("outputnode.out_file", "inputnode.in_t1w"),
346304
]),
@@ -355,9 +313,14 @@ def init_infant_anat_wf(
355313
(coregistration_wf, coreg_report_wf, [
356314
("outputnode.t2w_preproc", "inputnode.t2w_preproc")
357315
]),
358-
])
359-
360-
wf.connect([
316+
(coregistration_wf, anat_derivatives_wf, [
317+
("outputnode.t2w_preproc", "inputnode.t2w_preproc")
318+
]),
319+
(t1w_preproc_wf, outputnode, [
320+
("outputnode.t1w_preproc", "anat_preproc"),
321+
("outputnode.t1w_brain", "anat_brain"),
322+
("outputnode.t1w_mask", "anat_mask"),
323+
]),
361324
# reports
362325
(inputnode, anat_reports_wf, [
363326
("t1w", "inputnode.source_file"),
@@ -396,6 +359,33 @@ def init_infant_anat_wf(
396359
("outputnode.anat_tpms", "inputnode.t1w_tpms"),
397360
]),
398361
])
362+
363+
if precomp_mask:
364+
wf.connect([
365+
(t1w_template_wf, precomp_mask_wf, [
366+
("outputnode.out_file", "inputnode.t1w"),
367+
]),
368+
(t2w_template_wf, sdc_brain_extraction_wf, [
369+
("outputnode.out_file", "inputnode.in_file"),
370+
]),
371+
(sdc_brain_extraction_wf, coregistration_wf, [
372+
("outputnode.out_file", "inputnode.in_t2w_preproc"),
373+
("outputnode.out_mask", "inputnode.in_mask"),
374+
("outputnode.out_probseg", "inputnode.in_probmap"),
375+
]),
376+
])
377+
else:
378+
wf.connect([
379+
(t2w_template_wf, brain_extraction_wf, [
380+
("outputnode.out_file", "inputnode.in_t2w"),
381+
]),
382+
(brain_extraction_wf, coregistration_wf, [
383+
("outputnode.t2w_preproc", "inputnode.in_t2w_preproc"),
384+
("outputnode.out_mask", "inputnode.in_mask"),
385+
("outputnode.out_probmap", "inputnode.in_probmap"),
386+
]),
387+
(t1w_preproc_wf, anat_seg_wf, [("outputnode.t1w_brain", "inputnode.anat_brain")]),
388+
])
399389
# fmt:on
400390

401391
if not freesurfer:

0 commit comments

Comments
 (0)