@@ -580,7 +580,6 @@ def init_infant_anat_fit_wf(
580580 'A pre-computed T1w brain mask was provided as input and used throughout the '
581581 'workflow.'
582582 )
583- apply_t1w_mask .inputs .in_mask = t1w_mask
584583 workflow .connect (apply_t1w_mask , 'out_file' , t1w_buffer , 't1w_brain' )
585584
586585 if not t1w_preproc :
@@ -594,6 +593,7 @@ def init_infant_anat_fit_wf(
594593 workflow .connect ([
595594 (t1w_validate , conform_t1w_mask_wf , [('out_file' , 'inputnode.ref_file' )]),
596595 (conform_t1w_mask_wf , t1w_buffer , [('outputnode.out_file' , 't1w_mask' )]),
596+ (conform_t1w_mask_wf , apply_t1w_mask , [('outputnode.out_file' , 'in_mask' )]),
597597 (t1w_validate , t1w_n4_wf , [('out_file' , 'inputnode.in_anat' )]),
598598 (t1w_n4_wf , t1w_buffer , [('outputnode.anat_preproc' , 't1w_preproc' )]),
599599 (t1w_n4_wf , apply_t1w_mask , [('outputnode.anat_preproc' , 'in_file' )]),
@@ -602,6 +602,7 @@ def init_infant_anat_fit_wf(
602602 LOGGER .info ('ANAT Skipping T1w masking' )
603603 workflow .connect (t1w_validate , 'out_file' , apply_t1w_mask , 'in_file' )
604604 t1w_buffer .inputs .t1w_mask = t1w_mask
605+ apply_t1w_mask .inputs .in_mask = t1w_mask
605606
606607 # T2w masking logic:
607608 #
@@ -713,7 +714,6 @@ def init_infant_anat_fit_wf(
713714 'A pre-computed T2w brain mask was provided as input and used throughout the '
714715 'workflow.'
715716 )
716- apply_t2w_mask .inputs .in_mask = t2w_mask
717717 workflow .connect (apply_t2w_mask , 'out_file' , t2w_buffer , 't2w_brain' )
718718
719719 if not t2w_preproc :
@@ -728,6 +728,7 @@ def init_infant_anat_fit_wf(
728728 workflow .connect ([
729729 (t2w_validate , conform_t2w_mask_wf , [('out_file' , 'inputnode.ref_file' )]),
730730 (conform_t2w_mask_wf , t2w_buffer , [('outputnode.out_file' , 't2w_mask' )]),
731+ (conform_t2w_mask_wf , apply_t2w_mask , [('outputnode.out_file' , 'in_mask' )]),
731732 (t2w_validate , t2w_n4_wf , [('out_file' , 'inputnode.in_anat' )]),
732733 (t2w_n4_wf , t2w_buffer , [('outputnode.anat_preproc' , 't2w_preproc' )]),
733734 (t2w_n4_wf , apply_t2w_mask , [('outputnode.anat_preproc' , 'in_file' )]),
@@ -736,6 +737,7 @@ def init_infant_anat_fit_wf(
736737 LOGGER .info ('ANAT Skipping T2w masking' )
737738 workflow .connect (t2w_validate , 'out_file' , apply_t2w_mask , 'in_file' )
738739 t2w_buffer .inputs .t2w_mask = t2w_mask
740+ apply_t2w_mask .inputs .in_mask = t2w_mask
739741
740742 # Stage 3: Coregistration
741743 t1w2t2w_xfm = precomputed .get ('t1w2t2w_xfm' )
@@ -1746,7 +1748,6 @@ def init_infant_single_anat_fit_wf(
17461748 else :
17471749 LOGGER .info (f'ANAT Found { reference_anat } brain mask' )
17481750 desc += 'A pre-computed brain mask was provided as input and used throughout the workflow.'
1749- apply_mask .inputs .in_mask = anat_mask
17501751 workflow .connect (apply_mask , 'out_file' , anat_buffer , 'anat_brain' )
17511752
17521753 if not anat_preproc :
@@ -1760,6 +1761,7 @@ def init_infant_single_anat_fit_wf(
17601761 workflow .connect ([
17611762 (anat_validate , conform_anat_mask_wf , [('out_file' , 'inputnode.ref_file' )]),
17621763 (conform_anat_mask_wf , anat_buffer , [('outputnode.out_file' , 'anat_mask' )]),
1764+ (conform_anat_mask_wf , apply_mask , [('outputnode.out_file' , 'in_mask' )]),
17631765 (anat_validate , anat_n4_wf , [('out_file' , 'inputnode.in_anat' )]),
17641766 (anat_n4_wf , anat_buffer , [('outputnode.anat_preproc' , 'anat_preproc' )]),
17651767 (anat_n4_wf , apply_mask , [('outputnode.anat_preproc' , 'in_file' )]),
@@ -1768,6 +1770,7 @@ def init_infant_single_anat_fit_wf(
17681770 LOGGER .info (f'ANAT Skipping { reference_anat } masking' )
17691771 workflow .connect (anat_validate , 'out_file' , apply_mask , 'in_file' )
17701772 anat_buffer .inputs .anat_mask = anat_mask
1773+ apply_mask .inputs .in_mask = anat_mask
17711774
17721775 # Stage 3: Segmentation
17731776 seg_method = 'jlf' if config .execution .segmentation_atlases_dir else 'fast'
0 commit comments