Preprocess diffusion data

If diffusion data was acquired on the subject we want to (a) correct for EPI distortions in the data using FSL's topup tool; (b) correct for subject motion and eddy currents; (c) fit a tensor model and create a dt6.mat file; (d) fit the CSD model with mrtrix; (e) run AFQ to segment the fibers into all the major fiber groups. Jason Yeatman has written a helpful utility to run FSL's topup and eddy functions:

fsl_preprocess(dwi_files, bvecs_file, bvals_file, pe_dir, outdir)

This function is also wrapped within another utility to run this whole pipeline (steps a-e) on a subject

bde_preprocessdiffusion