@@ -484,10 +484,13 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
484484    # Gradient unwarping 
485485    if  config .workflow .gradunwarp_file :
486486        gradunwarp_wf  =  init_gradunwarp_wf ()
487-         gradunwarp_wf .inputs .inputnode .grad_file  =  gradunwarp_file 
488-         workflow .connect (
489-             [(initial_boldref_wf , gradunwarp_wf , [('raw_ref_image' , 'in_file' )])]
490-         )
487+         gradunwarp_wf .inputs .inputnode .grad_file  =  config .workflow .gradunwarp_file 
488+         # input corrected file, raw not necessary, only uses acquisition matrix size 
489+         # unless mask/ref are used for sdcflows 
490+         workflow .connect ([
491+             (initial_boldref_wf , gradunwarp_wf , [
492+                 ('outputnode.raw_ref_image' , 'inputnode.input_file' )]),
493+         ])
491494
492495    # HMC on the BOLD 
493496    bold_hmc_wf  =  init_bold_hmc_wf (
@@ -649,6 +652,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
649652            ("mask" , "inputnode.ref_bold_mask" ),
650653            ("boldref" , "inputnode.ref_bold_brain" ),
651654        ]),
655+         (gradunwarp_wf , bold_t1_trans_wf , [('outputnode.warp_file' , 'inputnode.gradient_warp' )]),
652656        (bold_t1_trans_wf , outputnode , [
653657            ("outputnode.bold_t1" , "bold_t1" ),
654658            ("outputnode.bold_t1_ref" , "bold_t1_ref" ),
@@ -814,6 +818,9 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
814818                ("outputnode.bold_std_ref" , "bold_std_ref" ),
815819                ("outputnode.bold_mask_std" , "bold_mask_std" ),
816820            ]),
821+             (gradunwarp_wf , bold_std_trans_wf , [
822+                 ('outputnode.warp_file' , 'inputnode.gradient_warp' )
823+             ]),
817824        ])
818825        # fmt:on 
819826
@@ -1033,6 +1040,7 @@ def _last(inlist):
10331040            (bold_hmc_wf , bold_bold_trans_wf , [
10341041                ("outputnode.xforms" , "inputnode.hmc_xforms" ),
10351042            ]),
1043+             (gradunwarp_wf , bold_bold_trans_wf , [('outputnode.warp_file' , 'inputnode.gradient_warp' )]),
10361044        ])
10371045
10381046        workflow .connect ([
0 commit comments