SpinDoctor: A MATLAB toolbox for diffusion MRI simulation
Introduction
Diffusion magnetic resonance imaging is an imaging modality that can be used to probe the tissue micro-structure by encoding the incohorent motion of water molecules with magnetic field gradient pulses. This motion during the diffusion-encoding time causes a signal attenuation from which the apparent diffusion coefficient, (and possibly higher order diffusion terms, can be calculated (Hahn, 1950, Stejskal and Tanner, 1965, Bihan et al., 1986).
For unrestricted diffusion, the root of the mean squared displacement of molecules is given by , where is the spatial dimension, is the intrinsic diffusion coefficient, and t is the diffusion time. In biological tissue, the diffusion is usually hindered or restricted (for example, by cell membranes) and the mean square displacement is smaller than in the case of unrestricted diffusion. This deviation from unrestricted diffusion can be used to infer information about the tissue micro-structure. The experimental parameters that can be varied include.
- 1.
The diffusion time (one can choose the parameters of the diffusion-encoding sequence, such as Pulsed Gradient Spin Echo (Stejskal and Tanner, 1965) and Oscillating Gradient (Does et al., 2003)).
- 2.
The magnitude of the diffusion-encoding gradient (when the magnetic resonance imaging signal is acquired at low gradient magnitudes, the signal contains only information about the apparent diffusion coefficient, at higher values, Kurtosis imaging (Jensen et al., 2005) becomes possible);
- 3.
The direction of the diffusion-encoding gradient (many directions may be probed, as in HARDIhigh angular resolution diffusion imaging (Tuch et al., 2002)).
Using diffusion magnetic resonance imaging to get tissue structural information in the mamalian brain has been the focus of much experimental and modeling work in recent years (Assaf et al., 2008, Alexander et al., 2010, Zhang et al., 2011, Zhang et al., 2012, Burcaw et al., 2015, Palombo et al., 2016, Palombo et al., 2017, Ning et al., 2017). The predominant approach up to now has been adding the diffusion magnetic resonance imaging signal from simple geometrical components and extracting model parameters of interest. Numerous biophysical models subdivide the tissue into compartments described by spheres, ellipsoids, cylinders, and the extra-cellular space (Assaf et al., 2008, Alexander et al., 2010, Zhang et al., 2011, Burcaw et al., 2015, Palombo et al., 2017, McHugh et al., 2015, Reynaud, 2017, Fieremans et al., 2011, Panagiotaki et al., 2012, Jespersen et al., 2007). Some model parameters of interest include axon diameter and orientation, neurite density, dendrite structure, the volume fraction and size distribution of cylinder and sphere components and the effective diffusion coefficient or tensor of the extra-cellular space.
Numerical simulations can help deepen the understanding of the relationship between the cellular structure and the diffusion magnetic resonance imaging signal and lead to the formulation of appropriate models. They can be also used to investigate the effect of different pulse sequences and tissue features on the measured signal which can be used for the development, testing, and optimization of novel diffusion magnetic resonance imaging pulse sequences (Ianuş et al., 2016, Drobnjak et al., 2011a, Mercredi and Martin, 2018, Rensonnet et al., 2018).
Two main groups of approaches to the numerical simulation of diffusion magnetic resonance imaging are 1) using random walkers to mimic the diffusion process in a geometrical configuration; 2) solving the Bloch-Torrey PDE, which describes the evolution of the complex transverse water proton magnetization under the influence of diffusion-encoding magnetic field gradients pulses.
The first group is referred to as Monte-Carlo simulations in the literature and previous works include (Palombo et al., 2016, Hughes, 1995, Yeh et al., 2013, Hall and Alexander, 2009, Balls and Frank, 2009). A GPU-based acceleration of Monte-Carlo simulation was proposed in (Nguyen et al., 1016a, Waudby and Christodoulou, 2011). Some software packages using this approach include.
- 1.
Camino Diffusion MRI Toolkit developed at UCL (http://cmic.cs.ucl.ac.uk/camino/);
- 2.
DIFSIM developed at UC San Diego (http://csci.ucsd.edu/projects/simulation.html);
- 3.
Diffusion Microscopist Simulator (Yeh et al., 2013) developed at Neurospin, CEA.
The second group relies on solving the Bloch-Torrey PDE in a geometrical configuration. In (Hagslatt et al., 2003, Loren et al., 2005, Moroney et al., 2013) a simplifying assumption called the narrow pulse approximation was used, where the pulse duration was assumed to be much smaller than the delay between pulses. This assumption allows the solution of the diffusion equation instead of the more complicated Bloch-Torrey PDE. More generally, numerical methods to solve the Bloch-Torrey PDE. with arbitrary temporal profiles have been proposed in (Xu et al., 1737, Li et al., 2014, Nguyen et al., 2014a, Beltrachini et al., 2015). The computational domain is discretized either by a Cartesian grid (Xu et al., 1737, Li et al., 2014, Russell et al., 2012) or finite elements (Hagslatt et al., 2003, Loren et al., 2005, Moroney et al., 2013, Nguyen et al., 2014a, Beltrachini et al., 2015). The unstructured mesh of a finite element discretization appeared to be better than a Cartesian grid in both geometry description and signal approximation (Nguyen et al., 2014a). For time discretization, both explicit and implicit methods have been used. In (Moroney et al., 2013) a second order implicit time-stepping method called the generalized method was used to allow for high frequency energy dissipation. An adaptive explicit Runge-Kutta Chebyshev method of second order was used in (Li et al., 2014, Nguyen et al., 2014a). It has been theoretically proven that the RKCRunge-Kutta Chebyshev method allows for a much larger time-step compared to the standard explicit Euler method (Verwer et al., 1990). There is an example showing that the RKCRunge-Kutta Chebyshev method is faster than the implicit Euler method in (Nguyen et al., 2014a). The Crank-Nicolson method was used in (Beltrachini et al., 2015) to also allow for second order convergence in time. The efficiency of diffusion magnetic resonance imaging simulations is also improved by either a high-performance FEM computing framework (Nguyen, 2016, Nguyen et al., 1016b) for large-scale simulations on supercomputers or a discretization on manifolds for thin-layer and thin-tube media (Nguyen et al., 2019).
In this paper, we present a MATLAB Toolbox called SpinDoctor that is a simulation pipeline going from the definition of a geometrical configuration through the numerical solution of the Bloch-Torrey PDE to the fitting of the apparent diffusion coefficient from the simulated signal. It also includes two other modules for calculating the apparent diffusion coefficient. The first module is a homogenized apparent diffusion coefficient mathematical model, which was obtained recently using homogenization techniques on the Bloch-Torrey PDE. In the homogenized model, the apparent diffusion coefficient of a geometrical configuration can be computed after solving a diffusion equation subject to a time-dependent Neumann boundary condition, under the assumption of negligible water exchange between compartments. The second module computes the short time approximation formula for the apparent diffusion coefficient. The short time approximation implemented in SpinDoctor includes a recent generalization of this formula to account for finite pulse duration in the pulsed gradient spin echo. Both of these two apparent diffusion coefficient calculations are sensitive to the diffusion-encoding gradient direction, unlike many previous works where the anisotropy of the is neglected in analytical model development.
In summary, SpinDoctor.
- 1.
Solves the Bloch-Torrey PDE in three dimensions to obtain the diffusion magnetic resonance imaging signal;
- 2.
Robustly fits the diffusion magnetic resonance imaging signal to obtain the apparent diffusion coefficient;
- 3.
Solves the homogenized apparent diffusion coefficient model in three dimensions to obtain the apparent diffusion coefficient;
- 4.
Computes the short-time approximation of the apparent diffusion coefficient;
- 5.
Computes useful geometrical quantities such as the compartment volumes and surface areas;
- 6.
Allows permeable membranes for the Bloch-Torrey PDE (the homogenized apparent diffusion coefficient assumes negligible permeabilty).
- 7.
Displays the gradient-direction dependent apparent diffusion coefficient; in three dimensions using spherical harmonics interpolation;
SpinDoctor provides the following built-in functionalities:
- 1.
Placement of non-overlapping spherical cells (with an optional nucleus) of different radii close to each other;
- 2.
Placement of non-overlapping cylindrical cells (with an optional myelin layer) of different radii close to each other in a canonical configuration where they are parallel to the z-axis;
- 3.
Inclusion of an extra-cellular space that is enclosed either
- (a)
in a tight wrapping around the cells; or
- (b)
in a rectangular box;
- (a)
- 4.
Deformation of the canonical configuration by bending and twisting; Built-in diffusion-encoding pulse sequences include
- 1.
The Pulsed Gradient Spin Echo;
- 2.
The Oscillating Gradient Spin Echo (cos- and sin-type gradients).
SpinDoctor uses the following methods:
- 1.
It generates a good quality surface triangulation of the user specified geometrical configuration by calling built-in MATLAB computational geometry functions;
- 2.
It creates a good quality tetrehedra finite elements mesh from the above surface triangulation by calling Tetgen (Si, 2015), an external package (executable files are included in the Toolbox package);
- 3.
It constructs finite element matrices for linear finite elements on tetrahedra (P1) using routines from (Rahman and Valdman, 2013);
- 4.
It adds additional degrees of freedom on the compartment interfaces to allow permeability conditions for the Bloch-Torrey PDE using the formalism in (Nguyen et al., 2014b);
- 5.
It solves the semi-discretized FEM equations by calling built-in MATLAB routines for solving ordinary differential equations.
The SpinDoctor toolbox has been developed in the MATLAB R2017b and requires no additional MATLAB toolboxes. The toolbox is publicly available at: https://github.com/jingrebeccali/SpinDoctor.
Section snippets
Theory
Suppose the user would like to simulate a geometrical configuration of cells with an optional myelin layer or a nucleus. If spins will be leaving the cells or if the user wants to simulate the extra-cellular space (ECS), then the ECS will enclose the geometrical shapes. Let be the ECS, the nucleus (or the axon) and the cytoplasm (or the myelin layer) of the ith cell. We denote the interface between and by and the interface between and by , finally the
Method
Below is a chart describing the work flow of SpinDoctor.
The physical units of the quantities in the input files for SpinDoctor are shown in Table 1, in particular, the length is in and the time is in .
Below we discuss the various components of SpinDoctor in more detail.
Numerical validation of SpinDoctor
In this section, we validate SpinDoctor by comparing SpinDoctor with the Matrix Formalism method (Callaghan, 1997, Barzykin, 1999) in a simple geometry. The Matrix Formalism method is a closed form representation of the dMRI signal based on the eigenfunctions of the Laplace operator subject to homogeneous Neumann boundary conditions. These eigenfunctions are available in explicit form for elementary geometries such as the line segment, the disk, and the sphere (Grebenkov, 2007, Grebenkov, 2010,
Computational time and comparison with Monte-Carlo simulation
In this section, we compare SpinDoctor with Monte-Carlo simulation using the publicly available software package Camino Diffusion MRI Toolkit (Hall and Alexander, 2009), downloaded from http://cmic.cs.ucl.ac.uk/camino. All the simulations were performed on a server computer with 12 processors (Intel (R) Xeon (R) E5-2667 @2.90 GHz), 192 GB of RAM, running CentOS 7. SpinDoctor was run using MATLAB R2019a on the same computer.
We give SpinDoctor computational times for three relatively complicated
SpinDoctor permeability and Monte-Carlo transmission probability
Here we illustrate the link between the membrane permeability of Spindoctor and the transmission probability of crossing a membrane in the Camino simulation. The geometry is the following:
- •
Permeable Sphere involves uniformly placed initial spins inside a sphere of radius , subject to permeable interface condition on the surface of the sphere, with permeability coefficient κ. No spins are initially placed outside of this sphere. In the SpinDoctor simulation, this sphere is enclosed inside a
Extensions of SpinDoctor
Here we mention two extensions in the functionalities of SpinDoctor that are planned for a future release.
Discussion
Built upon MATLAB, SpinDoctor is a software package that seeks to reduce the work required to perform numerical simulations for dMRI for prototyping purposes. There have been software packages for dMRI simulation that implements the random walkers approach. A detailed comparison of the Monte-Carlo/random walkers approach with the FEM approach is beyond the scope of this paper. SpinDoctor offers an alternative, solving the same physics problem using PDEs.
After surveying other works on dMRI
Conclusion
This paper describes a publicly available MATLAB toolbox called SpinDoctor that can be used to solve the BTPDE to obtain the dMRI signal and to solve the diffusion equation of the HADC model to obtain the ADC. SpinDoctor is a software package that seeks to reduce the work required to perform numerical simulations for dMRI for prototyping purposes.
SpinDoctor provides built-in options of including spherical cells with a nucleus, cylindrical cells with a myelin layer, an extra-cellular space
Acknowledgment
The authors gratefully acknowledge the French-Vietnam Master in Applied Mathematics program whose students (co-authors on this paper, Van-Dang Nguyen, Try Nguyen Tran, Bang Cong Trang, Khieu Van Nguyen, Vu Duc Thach Son, Hoang An Tran, Hoang Trong An Tran, Thi Minh Phuong Nguyen) have contributed to the SpinDoctor project during their internships in France in the past several years, as well as the Vice-Presidency for Marketing and International Relations at Ecole Polytechnique for financially
References (67)
- et al.
Orientationally invariant indices of axon diameter and density from diffusion MRI
Neuroimage
(2010) Theory of spin echo in restricted geometries under a step-wise gradient pulse sequence
J. Magn. Reson.
(1999)- et al.
A parametric finite element solution of the generalised Bloch–Torrey equation for arbitrary domains
J. Magn. Reson.
(2015) - et al.
Mesoscopic structure of neuronal tracts from time-dependent diffusion
Neuroimage
(2015) A simple matrix formalism for spin echo analysis of restricted diffusion under generalized gradient waveforms
J. Magn. Reson.
(1997)- et al.
Frequency-domain analysis of spin motion using modulated-gradient NMR
J. Magn. Reson., Ser. A
(1995) - et al.
Intra-axonal diffusivity in brain white matter
Neuroimage
(2019) - et al.
The matrix formalism for generalised gradients with time-varying orientation in diffusion NMR
J. Magn. Reson.
(2011) - et al.
The matrix formalism for generalised gradients with time-varying orientation in diffusion NMR
J. Magn. Reson.
(2011) - et al.
Physical and numerical phantoms for the validation of brain microstructural MRI: a cookbook, NeuroImage 182
Microstruct. Imaging
(2018)
White matter characterization with diffusional kurtosis imaging
Neuroimage
MEDUSA: a gpu-based tool to create realistic phantoms of the brain microstructure using tiny spheres
Neuroimage
Pulsed-gradient spin-echo monitoring of restricted diffusion in multilayered structures
J. Magn. Reson.
Predictions of pulsed field gradient NMR echo-decays for molecules diffusing in various restrictive geometries. simulations of diffusion propagators based on a finite element method
J. Magn. Reson.
Modeling dendrite density from magnetic resonance diffusion measurements
Neuroimage
Numerical simulation of diffusion MRI signals using an adaptive time-stepping method
Phys. Med. Biol.
Numerical analysis of NMR diffusion measurements in the short gradient pulse limit
J. Magn. Reson.
A finite elements method to solve the Bloch-Torrey equation applied to diffusion magnetic resonance imaging
J. Comput. Phys.
A finite elements method to solve the Bloch–Torrey equation applied to diffusion magnetic resonance imaging
J. Comput. Phys.
Diffusion MRI simulation in thin-layer and thin-tube media using a discretization on manifolds
J. Magn. Reson.
Precise inference and characterization of structural organization (picaso) of tissue from molecular diffusion
Neuroimage
A generative model of realistic brain cells with application to numerical simulation of the diffusion-weighted MR signal
Neuroimage
Compartment models of the diffusion MR signal in brain white matter: a taxonomy and comparison
Neuroimage
Fast MATLAB assembly of FEM matrices in 2D and 3D: nodal elements
Appl. Math. Comput.
Towards microstructure fingerprinting: estimation of tissue properties from a dictionary of Monte Carlo diffusion MRI simulations
Neuroimage
Multidimensional diffusion MRI
J. Magn. Reson.
GPU accelerated Monte Carlo simulation of pulsed-field gradient NMR experiments
J. Magn. Reson.
Axon diameter mapping in the presence of orientation dispersion with diffusion MRI
Neuroimage
NODDI: practical in vivo neurite orientation dispersion and density imaging of the human brain
Neuroimage
Neuromorpho.org: a central resource for neuronal morphologies
J. Neurosci.
Axcaliber: a method for measuring axon diameter distribution from diffusion MRI
Magn. Reson. Med.
A simulation environment for diffusion weighted MR experiments in complex media
Magn. Reson. Med.
MR imaging of intravoxel incoherent motions: application to diffusion and perfusion in neurologic disorders
Radiology
Cited by (19)
A simulation-driven supervised learning framework to estimate brain microstructure using diffusion MRI
2023, Medical Image AnalysisDiffusion MRI simulation of realistic neurons with SpinDoctor and the Neuron Module
2020, NeuroImageCitation Excerpt :A more systematic study is needed to get plausible biomarkers for the soma size but this is out of the range of this paper. In a previous publication (Li et al., 2019), SpinDoctor, a MATLAB-based diffusion MRI simulation toolbox, was presented. SpinDoctor allows the easy construction of multiple compartment models of the brain white matter, with the possibility of coupling water diffusion between the geometrical compartments by permeable membranes.
ConFiG: Contextual Fibre Growth to generate realistic axonal packing for diffusion MRI simulation
2020, NeuroImageCitation Excerpt :In particular, numerical phantoms are often used when developing diffusion MRI (dMRI) microstructure imaging techniques where simulations of the dMRI signal in phantoms with known microstructural properties are used in lieu of an in vivo ground truth measure of microstructure (Alexander et al., 2017). While recently numerical phantoms have proven useful for validating microstructure imaging of grey matter (Palombo et al., 2020), they have more commonly been used for validating white matter (WM) microstructure, with many studies comparing parameter estimates from fitting their models to the known ground truth from the phantoms e.g. (Daducci et al., 2015; Jelescu and Budde, 2017; Li et al., 2019; Nilsson et al., 2017, 2010; Scherrer et al., 2016; Tariq et al., 2016; Xu et al., 2014; Zhang et al., 2012). Some recent works directly estimate microstructural features using fingerprinting techniques and machine learning to match simulated signals and the corresponding ground truth microstructure of the numerical phantom to the measured signal (Hill et al., 2019; Nedjati-Gilani et al., 2017; Palombo et al., 2018a; Rensonnet et al., 2018).
Challenges for biophysical modeling of microstructure
2020, Journal of Neuroscience MethodsPortable simulation framework for diffusion MRI
2019, Journal of Magnetic ResonanceCitation Excerpt :This simulation framework can be seamlessly integrated with cloud computing resources such as Google Colaboratory notebooks (working on a web browser) or with Google Cloud Platform with MPI parallelization. One of the advantages of the simulation framework we propose here over the Matlab-based SpinDoctor [18] is that the Python code is free, whereas SpinDoctor requires the purchase of the software Matlab. Many researchers are now adopting Python since it is a free, cross-platform, general-purpose and high-level programming language.