@@ -145,7 +145,6 @@ def init_topup_wf(
145145 (regrid , concat_blips , [("out_data" , "in_files" )]),
146146 (readout_time , topup , [("readout_time" , "readout_times" ),
147147 ("pe_dir_fsl" , "encoding_direction" )]),
148- (concat_blips , topup , [("out_file" , "in_file" )]),
149148 (regrid , fix_coeff , [("reference" , "fmap_ref" )]),
150149 (readout_time , fix_coeff , [(("pe_direction" , _front ), "pe_dir" )]),
151150 (topup , fix_coeff , [("out_fieldcoef" , "in_coeff" )]),
@@ -161,22 +160,33 @@ def init_topup_wf(
161160 if not debug :
162161 # fmt: off
163162 workflow .connect ([
163+ (concat_blips , topup , [("out_file" , "in_file" )]),
164164 (topup , merge_corrected , [("out_corrected" , "in_files" )]),
165165 (topup , outputnode , [("out_field" , "fmap" ),
166166 ("out_warps" , "out_warps" )]),
167167 ])
168168 # fmt: on
169169 return workflow
170170
171+ from nipype .interfaces .afni .preprocess import Volreg
172+ from niworkflows .interfaces .nibabel import SplitSeries
171173 from ...interfaces .bspline import ApplyCoeffsField
172174
175+ realign = pe .Node (
176+ Volreg (args = f"-base { grid_reference } " , outputtype = "NIFTI_GZ" ),
177+ name = "realign_blips" ,
178+ )
179+ split_blips = pe .Node (SplitSeries (), name = "split_blips" )
173180 unwarp = pe .Node (ApplyCoeffsField (), name = "unwarp" )
174181 unwarp .interface ._always_run = True
175182
176183 # fmt:off
177184 workflow .connect ([
185+ (concat_blips , realign , [("out_file" , "in_file" )]),
186+ (realign , topup , [("out_file" , "in_file" )]),
178187 (fix_coeff , unwarp , [("out_coeff" , "in_coeff" )]),
179- (regrid , unwarp , [("out_data" , "in_target" )]),
188+ (realign , split_blips , [("out_file" , "in_file" )]),
189+ (split_blips , unwarp , [("out_files" , "in_target" )]),
180190 (readout_time , unwarp , [("readout_time" , "ro_time" ),
181191 ("pe_direction" , "pe_dir" )]),
182192 (unwarp , outputnode , [("out_warp" , "out_warps" ),
0 commit comments