Examples#
Note
The examples here are some uses of the analysis and visualization functionality of DIPY, with example data from actual neuroscience experiments, or with synthetic data, which is generated as part of the example.
All the examples presented in the documentation are generated from fully functioning python scripts, which are available as part of the source distribution in the doc/examples folder.
If you want to replicate a particular analysis or visualization, copy or download the relevant .py script, edit out the body of the text of the example and alter it to your purpose.
Contents
Quick Start#
Introduction to Basic Tracking
Preprocessing#
Betweenvolumes Motion Correction on DWI datasets
Denoise images using NonLocal Means (NLMEANS)
Brain segmentation with median_otsu
Patch2Self: SelfSupervised Denoising via Statistical Independence
Denoise images using Local PCA via empirical thresholds
Denoise images using Adaptive Soft Coefficient Matching (ASCM)
SNR estimation for DiffusionWeighted Images
Denoise images using the MarcenkoPastur PCA algorithm
Reconstruction#
Below, an overview of all reconstruction models available on DIPY.
Note
Some reconstruction models do not have a tutorial yet
Method 
Single Shell 
Multi Shell 
Cartesian 
Paper Data Descriptions 
References 

Yes 
Yes 
Yes 
Typical bvalue = 1000s/mm^2, maximum bvalue 1200s/mm^2 (some success up to 1500s/mm^2) 

Yes 
Yes 
Yes 
Typical bvalue = 1000s/mm^2, maximum bvalue 1200s/mm^2 (some success up to 1500s/mm^2) 
Yendiki2013, Chang2005, Chung2006 

No 
Yes 
No 
DTIstyle acquistion, multiple b=0, all shells should be within maximum bvalue of 1000 (or 32 directions evenly distributed 500mm/s^2 and 1500mm/s^2 per Henriques 2017) 

No 
Yes 
No 
Dual spin echo diffusionweighted 2D EPI images were acquired with b values of 0, 500, 1000, 1500, 2000, and 2500 s/mm^2 (max b value of 2000 suggested as sufficient in brain tissue); at least 15 directions 

No 
Yes 
No 
None 

No 
Yes 
No 
DKIstyle acquisition: at least two nonzero b shells (max b value 2000), minimum of 15 directions; typically bvalues in increments of 500 from 0 to 2000, 30 directions 

No 
Yes 
No 
bvalues in increments of 500 from 0 to 2000, 30 directions 

Yes 
No 
No 
HARDI data (preferably 7T) with at least 200 diffusion images at b=3000 s/mm^2, or multishell data with high angular resolution 

Westins CSA 
Yes 
No 
No 

No 
Yes 
No 
low bvalues are needed 
LeBihan 1984 

No 
Yes 
No 
Fadnavis 2019 

SDT 
Yes 
No 
No 
QBIstyle acquisition (6064 directions, bvalue 1000mm/s^2) 
Descoteaux 2009 
No 
No 
Yes 
515 diffusion encodings, bvalues from 12,000 to 18,000 s/mm^2. Acceleration in subsequent studies with ~100 diffusion encoding directions in half sphere of the qspace with bvalues = 1000, 2000, 3000s/mm2) 

No 
No 
Yes 
203 diffusion encodings (isotropic 3D grid points in the qspace contained within a sphere with radius 3.6), maximum bvalue=4000mm/s^2 

No 
Yes 
Yes 
Fits any sampling scheme with at least one nonzero bshell, benefits from more directions. Recommended 23 bshells ranging from 0 to 4000 in a 258 direction gridsampling scheme 
Yeh 2010 

Yes 
Yes 
No 
At least 40 directions, bvalue above 1000mm/s^2 

Yes 
No 
No 
At least 64 directions, maximum bvalues 30004000mm/s^2, multishell, isotropic voxel size 

No 
Yes 
No 
Multishell HARDI data (500, 1000, and 2000 s/mm^2; minimum 2 nonzero bshells) or DSI (514 images in a cube of five latticeunits, one b=0) 
Merlet 2013, Özarslan 2009, Özarslan 2008 

No 
Yes 
No 
Six unit sphere shells with b = 1000, 2000, 3000, 4000, 5000, 6000 s/mm^2 along 19, 32, 56, 87, 125, and 170 directions (see Olson 2019 for candidate subsampling schemes) 

No 
Yes 
No 
`Tom Dela Haije < https://doi.org/10.1016/j.neuroimage.2019.116405>`__ 

MAPL 
No 
Yes 
No 
Multishell similar to WUMinn HCP, with minimum of 60 samples from 2 shells bvalue 1000 and 3000s/mm^2 

Yes 
No 
No 
Minimum: 20 gradient directions and a bvalue of 1000 s/mm^2; benefits additionally from 60 direction HARDI data with bvalue = 3000s/mm^2 or multishell 
Tournier 2017, Descoteaux 2008, Tournier 2007 

No 
Yes 
No 
5 b=0, 50 directions at 3 nonzero bshells: b=1000, b=2000, b=3000 

No 
Yes 
No 
Multishell 64 direction bvalues of 1000, 2000s/mm^2 as in Alexander 2017. Original model used 1480 s/mm^2 with 92 directions and 36 b=0 
Anderson 2005, Alexander 2017 

Yes 
Yes 
Yes 
HARDI data with 64 directions at b = 2500s/mm^2, 3 b=0 images (full original acquisition: 256 directions on a sphere at b = 2500s/mm^2, 36 b=0 volumes) 

No 
Yes 
No 
Evenly distributed geometric sampling scheme of 216 measurements, 5 bvalues (50, 250, 50, 1000, 200mm/s^2), measurement tensors of four shapes: stick, prolate, sphere, and plane 

No 
Yes 
No 
At least one b=0, minimum of 39 acquisitions with spherical and linear encoding; optimal 120 (see Morez 2023), ideal 217 see Herberthson 2021 Table 1 

Ball & Stick 
Yes 
Yes 
No 
Three b=0, 60 evenly distributed directions per Jones 1999 at bvalue 1000mm/s^2 

No 
Yes 
No 
Minimum 200 volumes of multispherical dMRI (multishell, multidiffusion time; varying gradient directions, gradient strengths, and diffusion times) 
Fick 2017 

Power Map 
Yes 
Yes 
No 
HARDI data with 60 directions at bvalue = 3000 s/mm^2, 7 b=0 (Minimum: HARDI data with at least 30 directions) 

No 
Yes 
No 
72 directions at each of 5 evenly spaced bvalues from 0.5 to 2.5 ms/μm2, 5 bvalues from 3 to 5 ms/μm2, 5 bvalues from 5.5 to 7.5 ms/μm2, and 3 bvalues from 8 to 9 ms/μm2 / b=0 ms/μm^2, and along 33 directions at bvalues from 0.2–3 ms/μm^2 in steps of 0.2 ms/μm^−2 (24 point spherical design and 9 directions identified for rapid kurtosis estimation) 

No 
Yes 
No 
Applying positivity constraints to Qspace Trajectory Imaging (QTI+)
Reconstruct with Diffusion Spectrum Imaging
Reconstruction of the diffusion signal with the correlation tensor model
Continuous and analytical diffusion signal modelling with 3DSHORE
Reconstruct with Generalized QSampling Imaging
Reconstruct with Constant Solid Angle (QBall)
Reconstruction with the Sparse Fascicle Model
Calculate DSIbased scalar maps
Reconstruction of the diffusion signal with the kurtosis tensor model
Reconstruct with Qspace Trajectory Imaging (QTI)
Kfold crossvalidation for model comparison
Reconstruction of the diffusion signal with the Tensor model
Crossing invariant fiber response function with FORECAST model
Local reconstruction using the Histological ResDNN
Reconstruction of the diffusion signal with the WMTI model
Using the RESTORE algorithm for robust tensor fitting
Signal Reconstruction Using Spherical Harmonics
Using the free water elimination model to remove DTI free water contamination
Reconstruction with Constrained Spherical Deconvolution
Reconstruction with MultiShell MultiTissue CSD
Continuous and analytical diffusion signal modelling with MAPMRI
Mean signal diffusion kurtosis imaging (MSDKI)
Reconstruction with Robust and Unbiased ModelBAsed Spherical Deconvolution
Estimating diffusion time dependent qspace indices using qtdMRI
Contextual Enhancement#
Fiber to bundle coherence measures
Crossingpreserving contextual enhancement
Fiber Tracking#
Surface seeding for tractography
An introduction to the Deterministic Maximum Direction Getter
Parallel Transport Tractography
Tracking with Robust Unbiased ModelBAsed Spherical Deconvolution (RUMBASD)
Bootstrap and Closest Peak Direction Getters Example
Tracking with the Sparse Fascicle Model
Introduction to Basic Tracking
An introduction to the Probabilistic Direction Getter
Particle Filtering Tractography
Linear fascicle evaluation (LiFE)
Using Various Stopping Criterion for Tractography
Streamlines Analysis and Connectivity#
BUAN Bundle Shape Similarity Score
BUAN Bundle Assignment Maps Creation
Extracting AFQ tract profiles from segmented bundles
Streamline length and size reduction
Calculation of Outliers with Cluster Confidence Index
Connectivity Matrices, ROI Intersections and Density Maps
Registration#
Symmetric Diffeomorphic Registration in 3D
Symmetric Diffeomorphic Registration in 2D
Diffeomorphic Registration with binary and fuzzy images
Nonrigid Bundle Registration with BundleWarp
Applying imagebased deformations to streamlines
Affine Registration with Masks
Segmentation#
Brain segmentation with median_otsu
Tractography Clustering with QuickBundles
Tissue Classification of a T1weighted Structural Image
Tractography Clustering  Available Metrics
Enhancing QuickBundles with different metrics and features
Tractography Clustering  Available Features
Automatic Fiber Bundle Extraction with RecoBundles
Simulation#
Multiprocessing#
Parallel reconstruction using QBall
Parallel reconstruction using CSD
File Formats#
Visualization#
Visualization of ROI Surface Rendered with Streamlines
Visualize bundles and metrics on bundles
Advanced interactive visualization
Workflows#
Creating a new combined workflow