@@ -77,6 +77,9 @@ def init_infant_anat_wf(
77
77
"""
78
78
from nipype .interfaces .ants .base import Info as ANTsInfo
79
79
from niworkflows .engine .workflows import LiterateWorkflow as Workflow
80
+ from sdcflows .workflows .ancillary import (
81
+ init_brainextraction_wf as init_sdc_brain_extraction_wf ,
82
+ )
80
83
81
84
from ...utils .misc import fix_multi_source_name
82
85
from .brain_extraction import (
@@ -214,25 +217,26 @@ def init_infant_anat_wf(
214
217
if precomp_mask :
215
218
precomp_mask_wf = init_precomputed_mask_wf (omp_nthreads = omp_nthreads )
216
219
precomp_mask_wf .inputs .inputnode .t1w_mask = precomp_mask
217
-
218
- else :
219
- brain_extraction_wf = init_infant_brain_extraction_wf (
220
- age_months = age_months ,
221
- ants_affine_init = ants_affine_init ,
222
- skull_strip_template = skull_strip_template .space ,
223
- template_specs = skull_strip_template .spec ,
224
- omp_nthreads = omp_nthreads ,
225
- sloppy = sloppy ,
226
- debug = "registration" in config .execution .debug ,
227
- )
228
- coregistration_wf = init_coregistration_wf (
229
- omp_nthreads = omp_nthreads ,
230
- sloppy = sloppy ,
231
- debug = "registration" in config .execution .debug ,
232
- )
233
- coreg_report_wf = init_coreg_report_wf (
234
- output_dir = output_dir ,
220
+ sdc_brain_extraction_wf = init_sdc_brain_extraction_wf (
221
+ name = "sdc_brain_extraction_wf" ,
235
222
)
223
+ brain_extraction_wf = init_infant_brain_extraction_wf (
224
+ age_months = age_months ,
225
+ ants_affine_init = ants_affine_init ,
226
+ skull_strip_template = skull_strip_template .space ,
227
+ template_specs = skull_strip_template .spec ,
228
+ omp_nthreads = omp_nthreads ,
229
+ sloppy = sloppy ,
230
+ debug = "registration" in config .execution .debug ,
231
+ )
232
+ coregistration_wf = init_coregistration_wf (
233
+ omp_nthreads = omp_nthreads ,
234
+ sloppy = sloppy ,
235
+ debug = "registration" in config .execution .debug ,
236
+ )
237
+ coreg_report_wf = init_coreg_report_wf (
238
+ output_dir = output_dir ,
239
+ )
236
240
t1w_preproc_wf = precomp_mask_wf if precomp_mask else coregistration_wf
237
241
238
242
# Segmentation - initial implementation should be simple: JLF
@@ -285,6 +289,9 @@ def init_infant_anat_wf(
285
289
("outputnode.t1w_mask" , "inputnode.t1w_mask" ),
286
290
("outputnode.t1w_preproc" , "inputnode.t1w_preproc" ),
287
291
]),
292
+ (coregistration_wf , anat_derivatives_wf , [
293
+ ("outputnode.t2w_preproc" , "inputnode.t2w_preproc" )
294
+ ]),
288
295
(t1w_preproc_wf , outputnode , [
289
296
("outputnode.t1w_preproc" , "anat_preproc" ),
290
297
("outputnode.t1w_brain" , "anat_brain" ),
@@ -296,36 +303,50 @@ def init_infant_anat_wf(
296
303
wf .connect ([
297
304
(t1w_preproc_wf , anat_seg_wf , [("outputnode.t1w_brain" , "inputnode.anat_brain" )]),
298
305
])
299
-
306
+ wf .connect ([
307
+ (inputnode , t2w_template_wf , [("t2w" , "inputnode.in_files" )]),
308
+ ])
300
309
if precomp_mask :
301
310
wf .connect ([
302
311
(t1w_template_wf , precomp_mask_wf , [
303
312
("outputnode.out_file" , "inputnode.t1w" ),
304
313
]),
314
+ (t2w_template_wf , sdc_brain_extraction_wf , [
315
+ ("outputnode.out_file" , "inputnode.in_file" ),
316
+ ]),
317
+ (sdc_brain_extraction_wf , coregistration_wf , [
318
+ ("outputnode.out_file" , "inputnode.in_t2w_preproc" ),
319
+ ("outputnode.out_mask" , "inputnode.in_mask" ),
320
+ ("outputnode.out_probseg" , "inputnode.in_probmap" ),
321
+ ]),
305
322
])
306
323
else :
307
324
wf .connect ([
308
- (inputnode , t2w_template_wf , [("t2w" , "inputnode.in_files" )]),
309
325
(t2w_template_wf , brain_extraction_wf , [
310
326
("outputnode.out_file" , "inputnode.in_t2w" ),
311
327
]),
312
- (t1w_template_wf , coregistration_wf , [
313
- ("outputnode.out_file" , "inputnode.in_t1w" ),
314
- ]),
315
328
(brain_extraction_wf , coregistration_wf , [
316
329
("outputnode.t2w_preproc" , "inputnode.in_t2w_preproc" ),
317
330
("outputnode.out_mask" , "inputnode.in_mask" ),
318
331
("outputnode.out_probmap" , "inputnode.in_probmap" ),
319
332
]),
320
- (inputnode , coreg_report_wf , [
321
- ("t1w" , "inputnode.source_file" ),
322
- ]),
323
- (t1w_preproc_wf , coreg_report_wf , [
324
- ("outputnode.t1w_preproc" , "inputnode.t1w_preproc" ),
325
- ("outputnode.t2w_preproc" , "inputnode.t2w_preproc" ),
326
- ("outputnode.t1w_mask" , "inputnode.in_mask" ),
327
- ]),
328
333
])
334
+ wf .connect ([
335
+ (t1w_template_wf , coregistration_wf , [
336
+ ("outputnode.out_file" , "inputnode.in_t1w" ),
337
+ ]),
338
+
339
+ (inputnode , coreg_report_wf , [
340
+ ("t1w" , "inputnode.source_file" ),
341
+ ]),
342
+ (t1w_preproc_wf , coreg_report_wf , [
343
+ ("outputnode.t1w_preproc" , "inputnode.t1w_preproc" ),
344
+ ("outputnode.t1w_mask" , "inputnode.in_mask" ),
345
+ ]),
346
+ (coregistration_wf , coreg_report_wf , [
347
+ ("outputnode.t2w_preproc" , "inputnode.t2w_preproc" )
348
+ ]),
349
+ ])
329
350
330
351
wf .connect ([
331
352
# reports
@@ -350,6 +371,9 @@ def init_infant_anat_wf(
350
371
("outputnode.valid_list" , "inputnode.source_files" ),
351
372
("outputnode.realign_xfms" , "inputnode.t1w_ref_xfms" ),
352
373
]),
374
+ (t2w_template_wf , anat_derivatives_wf , [
375
+ ("outputnode.valid_list" , "inputnode.t2w_source_files" ),
376
+ ]),
353
377
(anat_norm_wf , anat_derivatives_wf , [
354
378
("outputnode.template" , "inputnode.template" ),
355
379
("outputnode.anat2std_xfm" , "inputnode.anat2std_xfm" ),
0 commit comments