Diffusion Imaging In Python

Dipy is a free and open source software project for computational neuroanatomy, focusing mainly on diffusion magnetic resonance imaging (dMRI) analysis. It implements a broad range of algorithms for denoising, registration, reconstruction, tracking, clustering, visualization, and statistical analysis of MRI data.

Getting Started

Here is a simple example showing how to calculate color FA. We use a single Tensor model to reconstruct the datasets which are saved in a Nifti file along with the b-values and b-vectors which are saved as text files. In this example we use only a few voxels with 101 gradient directions:

from dipy.data import get_data
fimg, fbval, fbvec = get_data('small_101D')

import nibabel as nib
img = nib.load(fimg)
data = img.get_data()

from dipy.io import read_bvals_bvecs
bvals, bvecs = read_bvals_bvecs(fbval, fbvec)

from dipy.core.gradients import gradient_table
gtab = gradient_table(bvals, bvecs)

from dipy.reconst.dti import TensorModel
ten = TensorModel(gtab)
tenfit = ten.fit(data)

from dipy.reconst.dti import fractional_anisotropy
fa = fractional_anisotropy(tenfit.evals)

from dipy.reconst.dti import color_fa
cfa = color_fa(fa, tenfit.evecs)

Alt text


June 1, 2016, 1:20 p.m.

DIPY will be an official exhibitor for this years OHBM in Geneva. OHBM website here

Feb. 10, 2016, 10 a.m.

Dipy 0.11 released February 21, 2016



Thu Apr 19

RT @garyfallidis: During Brainhack https://t.co/oc7EP3Vavq at Indiana University I will run a super new workshop on automatic bundle recog…

Sat Apr 14

New tractography algorithm in DIPY: Particle Filtering Tracking (https://t.co/vrfsWWNatt) Thanks to Gab for this co… https://t.co/OrJgHTlT0C

Mon Apr 09

DIPY Workshop / Tutorial during #brainhackglobal – Join us at @IndianaUniv @IUBloomington (May 2-4) More info her… https://t.co/B6y9YOrOqe

Thu Mar 22

RT @garyfallidis: Great fun during @ohbm #OpenScience demo call speaking about @dipymri https://t.co/R2XQpUg5AP Thanks @kirstie_j and all f…

Wed Mar 21

RT @kirstie_j: IT’S @OHBM #OPENSCIENCE DEMO CALL TIME AGAIN!! Whooooo hooooo! This month we’ll have @msandstr of @INCForg on their @gsoc ho…

Highlighted Publications

Dipy, a library for the analysis of diffusion MRI data

Garyfallidis, Eleftherios and Brett, Matthew and Amirbekian, Bagrat and Rokem, Ariel and Van Der Walt, Stefan and Descoteaux, Maxime and Nimmo-Smith, Ian


@ARTICLE{10.3389/fninf.2014.00008, AUTHOR={Garyfallidis, Eleftherios and Brett, Matthew and Amirbekian, Bagrat and Rokem, Ariel and Van Der Walt, Stefan and Descoteaux, Maxime and Nimmo-Smith, Ian}, TITLE={Dipy, a library for the analysis of diffusion MRI data}, JOURNAL={Frontiers in Neuroinformatics}, VOLUME={8}, YEAR={2014}, NUMBER={8}, URL={http://www.frontiersin.org/neuroinformatics/10.3389/fninf.2014.00008/abstract}, DOI={10.3389/fninf.2014.00008}, ISSN={1662-5196} , ABSTRACT={Diffusion Imaging in Python (Dipy) is a free and open source software projectfor the analysis of data from diffusion magnetic resonance imaging (dMRI)experiments. dMRI is an application of MRI that can be used to measurestructural features of brain white matter. Many methods have been developed touse dMRI data to model the local configuration of white matter nerve fiberbundles and infer the trajectory of bundles connecting different parts of thebrain.Dipy gathers implementations of many different methods in dMRI, including:diffusion signal pre-processing; reconstruction of diffusion distributions inindividual voxels; fiber tractography and fiber track post-processing, analysisand visualization. Dipy aims to provide transparent implementations forall the different steps of dMRI analysis with a uniform programming interface.We have implemented classical signal reconstruction techniques, such as thediffusion tensor model and deterministic fiber tractography. In addition,cutting edge novel reconstruction techniques are implemented, such asconstrained spherical deconvolution and diffusion spectrum imaging withdeconvolution, as well as methods for probabilistic tracking and originalmethods for tractography clustering. Many additional utility functions areprovided to calculate various statistics, informative visualizations, as wellas file-handling routines to assist in the development and use of noveltechniques.In contrast to many other scientific software projects, Dipy is not beingdeveloped by a single research group. Rather, it is an open project thatencourages contributions from any scientist/developer through GitHub and opendiscussions on the project mailing list. Consequently, Dipy today has aninternational team of contributors, spanning seven different academic institutionsin five countries and three continents, which is still growing.}}