Applytopup not correcting distortions in dwifslpreproc

Hi,

After running dwifslpreproc on a dataset (multishell with a paired b0), and looking at the intermediate files, I noticed that applytopup and subsequently the “eddy_mask” are not distortion-free.

Here is the command:
dwifslpreproc dwi_den_unringed.mif dwi_preproc.mif -rpe_header -align_seepi -se_epi b0_pair.mif -eddyqc_all ./eddyqc_reports -eddy_options " --slm=linear --mporder=6 --data_is_shelled --cnr_maps --repol" -force -nthreads 20 -nocleanup

Of note in the output:
dwifslpreproc: 1 spatial axis of DWIs has non-even size; this will be automatically padded for compatibility with topup, and the extra slice erased afterwards

According to the log file:

Command:  mrconvert dwi.mif dwi_first_bzero.mif -coord 3 0 -axes 0,1,2
dwifslpreproc: Balanced phase-encoding scheme detected in SE-EPI series; volume 0 will be removed and replaced with first b=0 from DWIs
Command:  mrconvert se_epi.mif - -coord 3 1 | mrcat dwi_first_bzero.mif - se_epi_firstdwibzero.mif -axis 3
Command:  mrinfo dwi.mif -export_grad_mrtrix grad.b
dwifslpreproc: 1 spatial axis of DWIs has non-even size; this will be automatically padded for compatibility with topup, and the extra slice erased afterwards
Command:  mrconvert se_epi_firstdwibzero.mif -coord 2 74 - | mrcat se_epi_firstdwibzero.mif - se_epi_firstdwibzero_pad2.mif -axis 2
Command:  mrconvert dwi.mif -coord 2 74 -clear dw_scheme - | mrcat dwi.mif - dwi_pad2.mif -axis 2
Command:  mrconvert se_epi_firstdwibzero_pad2.mif topup_in.nii -strides -1,+2,+3,+4 -export_pe_table topup_datain.txt
Command:  topup --imain=topup_in.nii --datain=topup_datain.txt --out=field --fout=field_map.nii.gz --config=/cm/shared/uniol/sw/SYSTEM/FSL/6.0.7.3-conda/etc/flirtsch/b02b0.cnf --verbose
Command:  mrinfo dwi_pad2.mif -export_pe_eddy applytopup_config.txt applytopup_indices.txt
Command:  mrconvert dwi_pad2.mif dwi_pad2_pe_0.nii -coord 3 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116 -strides -1,+2,+3,+4 -json_export dwi_pad2_pe_0.json
Command:  applytopup --imain=dwi_pad2_pe_0.nii --datain=applytopup_config.txt --inindex=1 --topup=field --out=dwi_pad2_pe_0_applytopup.nii --method=jac

the “dwi_pad2_pe_0_applytopup.nii” would be distortion-free, but it is not:

However, doing the same commands with FSL’s TOPUP without padding (utilizing --config=b02b0_1.cnf) and then applytopup results in a distortion-free image. Interestingly, adding --config=b02b0_1.cnf to -topup_options flag in dwifslpreproc results in two --config flags in the final topup, one with the default b02b0.cnf and the other with b02b0_1.cnf. I’m using MRtrix v3.0.4.

Any comments are appreciated.

Best,
Amir