How do I do X in DIPY? This page contains a collection of recipes that will help you quickly resolve common basic/advanced operation. If you have a question that is not answered here, please ask on the dipy discussions or even better, answer it yourself and contribute to the documentation!

How do I convert my tractograms?

We recommend to look at the tutorials Streamline File Formats

from import load_tractogram, save_tractogram

# convert from fib to trk
my_fib_file_path = '/<my_folder>/<my_path>/my_tractogram.fib'
my_trk_file_path = '/<my_folder>/<my_path>/my_tractogram.trk'
my_trk = load_tractogram(my_fib_file_path, 'same')
save_tractogram(my_trk.streamlines, my_trk_file_path, 'same')
How do I convert my Spherical Harmonics from DIPY to MRTRIX3?

*Available only on master branch. See this thread for more information.

from dipy.reconst.shm import convert_sh
convert_sh('dti.nii.gz', 'dti.bval', 'dti.bvec', 'fsl', 'dti.nii.gz')
How do I convert my tensors from DIPY to FSL?

*Available only on master branch

from import convert_tensor
convert_tensor('dti.nii.gz', 'dti.bval', 'dti.bvec', 'fsl', 'dti.nii.gz')