@@ -1480,7 +1480,22 @@ def init_anat_template_wf(
14801480 )
14811481 anat_conform = pe .MapNode (Conform (), iterfield = 'in_file' , name = 'anat_conform' )
14821482
1483- # -1 Gradient unwarping (optional)
1483+ # fmt:off
1484+ workflow .connect ([
1485+ (inputnode , anat_ref_dimensions , [('anat_files' , 't1w_list' )]),
1486+ (anat_ref_dimensions , denoise , [('t1w_valid_list' , 'input_image' )]),
1487+ (anat_ref_dimensions , anat_conform , [
1488+ ('target_zooms' , 'target_zooms' ),
1489+ ('target_shape' , 'target_shape' ),
1490+ ]),
1491+ (anat_ref_dimensions , outputnode , [
1492+ ('out_report' , 'out_report' ),
1493+ ('t1w_valid_list' , 'anat_valid_list' ),
1494+ ]),
1495+ ])
1496+ # fmt:on
1497+
1498+ # 0.5 Gradient unwarping (optional)
14841499 if gradunwarp_file :
14851500 nds = [
14861501 (
@@ -1495,7 +1510,9 @@ def init_anat_template_wf(
14951510 f'Inconsistent distortion correction metadata across { contrast } images.'
14961511 )
14971512 if not any (nds ):
1513+ # gradient unwarping not needed for that contrast
14981514 gradunwarp_file = None
1515+
14991516 if gradunwarp_file :
15001517 gradunwarp_ver = GradUnwarp .version ()
15011518 workflow .__desc__ = (
@@ -1508,32 +1525,13 @@ def init_anat_template_wf(
15081525 gradunwarp_wf .inputs .inputnode .grad_file = gradunwarp_file
15091526 # fmt:off
15101527 workflow .connect ([
1511- (inputnode , gradunwarp_wf , [('anat_files ' , 'inputnode.input_file' )]),
1512- (gradunwarp_wf , anat_ref_dimensions , [('outputnode.corrected_file' , 't1w_list ' )]),
1528+ (denoise , gradunwarp_wf , [('output_image ' , 'inputnode.input_file' )]),
1529+ (gradunwarp_wf , anat_conform , [('outputnode.corrected_file' , 'in_file ' )]),
15131530 ])
15141531 else :
1515- workflow .connect (
1516- [
1517- (inputnode , anat_ref_dimensions , [('anat_files' , 't1w_list' )]),
1518- ]
1519- )
1532+ workflow .connect ([(denoise , anat_conform , [('output_image' , 'in_file' )])])
15201533 # fmt:on
15211534
1522- # fmt:off
1523- workflow .connect ([
1524- (anat_ref_dimensions , denoise , [('t1w_valid_list' , 'input_image' )]),
1525- (anat_ref_dimensions , anat_conform , [
1526- ('target_zooms' , 'target_zooms' ),
1527- ('target_shape' , 'target_shape' ),
1528- ]),
1529- (denoise , anat_conform , [('output_image' , 'in_file' )]),
1530- (anat_ref_dimensions , outputnode , [
1531- ('out_report' , 'out_report' ),
1532- ('t1w_valid_list' , 'anat_valid_list' ),
1533- ]),
1534- ])
1535- # fmt:on
1536-
15371535 if num_files == 1 :
15381536 get1st = pe .Node (niu .Select (index = [0 ]), name = 'get1st' )
15391537 outputnode .inputs .anat_realign_xfm = [str (load_resource ('itkIdentityTransform.txt' ))]
0 commit comments