@@ -1480,7 +1480,22 @@ def init_anat_template_wf(
1480
1480
)
1481
1481
anat_conform = pe .MapNode (Conform (), iterfield = 'in_file' , name = 'anat_conform' )
1482
1482
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)
1484
1499
if gradunwarp_file :
1485
1500
nds = [
1486
1501
(
@@ -1495,7 +1510,9 @@ def init_anat_template_wf(
1495
1510
f'Inconsistent distortion correction metadata across { contrast } images.'
1496
1511
)
1497
1512
if not any (nds ):
1513
+ # gradient unwarping not needed for that contrast
1498
1514
gradunwarp_file = None
1515
+
1499
1516
if gradunwarp_file :
1500
1517
gradunwarp_ver = GradUnwarp .version ()
1501
1518
workflow .__desc__ = (
@@ -1508,32 +1525,13 @@ def init_anat_template_wf(
1508
1525
gradunwarp_wf .inputs .inputnode .grad_file = gradunwarp_file
1509
1526
# fmt:off
1510
1527
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 ' )]),
1513
1530
])
1514
1531
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' )])])
1520
1533
# fmt:on
1521
1534
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
-
1537
1535
if num_files == 1 :
1538
1536
get1st = pe .Node (niu .Select (index = [0 ]), name = 'get1st' )
1539
1537
outputnode .inputs .anat_realign_xfm = [str (load_resource ('itkIdentityTransform.txt' ))]
0 commit comments