DIPY logo

Open Source diffusion MRI in Python

Ariel Rokem, University of Washington eScience Institute

Follow along at: http://arokem.github.io/2017-ohbm-dipy-slides

Normal behavior is supported by brain connectivity

Image from Catani and ffytche (2015)

Not just passive cables

Brain connections change with development

Individual differences account for differences in behaviour

Adapt with learning

This has clinical significance

Magnetic Resonance Imaging (MRI)

Neural activity: functional MRI

Anatomy: structural MRI

...

Brain connectivity: diffusion MRI

Diffusion MRI

Isotropic diffusion

Diffusion MRI

Anisotropic diffusion

Diffusion MRI

Modeling diffusion

Basser, Mattielo and Le Bihan (1994)

Diffusion statistics

Mean diffusivity
Fractional anisotropy
Principal diffusion direction

From diffusion to tracks

From diffusion to tracks

From diffusion to tracks

DIPY: Diffusion MRI in Python

Part of the NIPY community

Started in 2009 by Eleftherios Garyfallidis

Contributors from at least six different countries and many different labs

Garyfallidis et al.(2014)

Diffusion MRI: the challenge of validation

Algorithm 1
Algorithm 2

A statistical learning approach

In-vivo validation
Measurement #1
Measurement #2
Test-retest reliability
Model
Cross-validation
Rokem et al. (2015)

Dipy cross-validation API

gtab = gradient_table(...)

model = ReconstModel(gtab, ...)

fit = model.fit(data, ...) # => ReconstFit

prediction = fit.predict(gtab, ...)

For example

model = dti.TensorModel(gtab)

fit = model.fit(data1)

prediction = fit.predict(gtab)

RMSE = np.sqrt(\
np.mean((prediction - data2) ** 2), -1))

rRMSE = RMSE / np.sqrt(\
np.mean((data1 - data2) ** 2), -1))

Rokem et al. (2015)
Corpus callosum
Corticospinal tract
Superior
longitudinal fasciculus
DTI
Crossing fiber model
Rokem et al. (2015)

When you've only measured once

k-fold cross-validation

# Use a k of 2

dti_pred = kfold_xval(dti_model, data, 2)

csd_pred = kfold_xval(csd_model, data, 2)

Algorithm 1
Algorithm 2

LiFE: Linear Fascicle Evaluation

Forward model from the tracks to the measured signal

Pestilli et al. (2014)

From diffusion to tracks

From tracks to diffusion

...
=
Pestilli et al. (2014)
Solve for
>>> X.shape
(10e8, 10e6)
Pestilli et al. (2014)

fiber_model = life.FiberModel(gtab)

fit = fiber_model.fit(data, tracks)

prediction = fit.predict(gtab)

optimized_tracks = tracks[fit.beta>0]

Easy sharing of data and analysis

(with Jason Yeatman, UW ILABS)

AFQ: Automated Fiber Quantification

AFQ in Python (based on Dipy)

AFQ-browser (with Adam Richie-Halford, Josh Smith)

Demo

Let's dive in!

http://tinyurl.com/ohbm2017-dipy
http://arokem.org
arokem@gmail.com
@arokem
github.com/arokem