@@ -217,8 +217,6 @@ def init_infant_anat_wf(
217
217
longitudinal = longitudinal ,
218
218
omp_nthreads = omp_nthreads ,
219
219
sloppy = sloppy ,
220
- precomputed_mask = bool (precomp_mask ),
221
- precomputed_aseg = bool (precomp_aseg ),
222
220
name = "t1w_template_wf" ,
223
221
)
224
222
@@ -233,7 +231,11 @@ def init_infant_anat_wf(
233
231
234
232
# Clean up each anatomical template
235
233
# Denoise, INU, + Clipping
236
- t1w_preproc_wf = init_anat_preproc_wf (name = "t1w_preproc_wf" )
234
+ t1w_preproc_wf = init_anat_preproc_wf (
235
+ precomputed_mask = bool (precomp_mask ),
236
+ precomputed_aseg = bool (precomp_aseg ),
237
+ name = "t1w_preproc_wf" ,
238
+ )
237
239
t2w_preproc_wf = init_anat_preproc_wf (name = "t2w_preproc_wf" )
238
240
239
241
if skull_strip_mode != "force" :
@@ -343,10 +345,10 @@ def init_infant_anat_wf(
343
345
344
346
if precomp_mask :
345
347
# Ensure the mask is conformed along with the T1w
346
- t1w_template_wf .inputs .inputnode .anat_mask = precomp_mask
348
+ t1w_preproc_wf .inputs .inputnode .in_mask = precomp_mask
347
349
# fmt:off
348
350
wf .connect ([
349
- (t1w_template_wf , coregistration_wf , [("outputnode.anat_mask" , "inputnode.in_mask" )]),
351
+ (t1w_preproc_wf , coregistration_wf , [("outputnode.anat_mask" , "inputnode.in_mask" )]),
350
352
(t2w_preproc_wf , coregistration_wf , [("outputnode.anat_preproc" , "inputnode.in_t2w" )])
351
353
])
352
354
# fmt:on
@@ -376,8 +378,8 @@ def init_infant_anat_wf(
376
378
377
379
if precomp_aseg :
378
380
# Ensure the segmentation is conformed along with the T1w
379
- t1w_template_wf .inputs .inputnode .anat_aseg = precomp_aseg
380
- wf .connect (t1w_template_wf , "outputnode.anat_aseg" , anat_seg_wf , "inputnode.anat_aseg" )
381
+ t1w_preproc_wf .inputs .inputnode .in_aseg = precomp_aseg
382
+ wf .connect (t1w_preproc_wf , "outputnode.anat_aseg" , anat_seg_wf , "inputnode.anat_aseg" )
381
383
382
384
if not freesurfer :
383
385
return wf
@@ -395,14 +397,46 @@ def init_infant_anat_wf(
395
397
age_months = age_months ,
396
398
use_aseg = use_aseg ,
397
399
)
400
+
398
401
elif config .workflow .surface_recon_method == 'mcribs' :
402
+ from nipype .interfaces .ants import DenoiseImage
403
+
399
404
from .surfaces import init_mcribs_surface_recon_wf
400
405
406
+ # Denoise raw T2w, since using the template / preproc resulted in intersection errors
407
+ denoise_raw_t2w = pe .Node (
408
+ DenoiseImage (dimension = 3 , noise_model = "Rician" ), name = 'denoise_raw_t2w'
409
+ )
410
+
401
411
surface_recon_wf = init_mcribs_surface_recon_wf (
412
+ omp_nthreads = omp_nthreads ,
402
413
use_aseg = bool (precomp_aseg ),
414
+ use_mask = bool (precomp_mask ),
403
415
mcribs_dir = str (config .execution .mcribs_dir ), # Needed to preserve runs
404
416
)
405
417
418
+ # Transformed gives
419
+ if precomp_aseg :
420
+ surface_recon_wf .inputs .inputnode .ants_segs = precomp_aseg
421
+ if precomp_mask :
422
+ surface_recon_wf .inputs .inputnode .anat_mask = precomp_mask
423
+ # fmt:off
424
+ wf .connect ([
425
+ (inputnode , denoise_raw_t2w , [('t2w' , 'input_image' )]),
426
+ (denoise_raw_t2w , surface_recon_wf , [('output_image' , 'inputnode.t2w' )])
427
+ ])
428
+ # fmt:on
429
+
430
+ if config .workflow .surface_recon_method in ('freesurfer' , 'infantfs' ):
431
+ # fmt:off
432
+ wf .connect ([
433
+ (t2w_preproc_wf , surface_recon_wf , [
434
+ ("outputnode.anat_preproc" , "inputnode.t2w" )]),
435
+ (anat_seg_wf , surface_recon_wf , [
436
+ ("outputnode.anat_aseg" , "inputnode.ants_segs" )]),
437
+ ])
438
+ # fmt:on
439
+
406
440
# Anatomical ribbon file using HCP signed-distance volume method
407
441
anat_ribbon_wf = init_anat_ribbon_wf ()
408
442
@@ -411,11 +445,6 @@ def init_infant_anat_wf(
411
445
(inputnode , surface_recon_wf , [
412
446
("subject_id" , "inputnode.subject_id" ),
413
447
("subjects_dir" , "inputnode.subjects_dir" )]),
414
- (t2w_preproc_wf , surface_recon_wf , [
415
- ("outputnode.anat_preproc" , "inputnode.t2w" )]),
416
- (anat_seg_wf , surface_recon_wf , [
417
- ("outputnode.anat_aseg" , "inputnode.ants_segs" ),
418
- ]),
419
448
(t1w_template_wf , surface_recon_wf , [
420
449
("outputnode.anat_ref" , "inputnode.t1w" ),
421
450
]),
0 commit comments