Skip to content

iosephus/two-cylinder-adc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Two cylinder ADC

Source code and scripts for computing the Diffusion MR ADC in one or two cylinders with a transverse diffusion encoding gradient.

The MR diffusion model of a cylinder with the diffusion encoding gradient oriented tranverse to the longitudinal cylinder axis is equivalent to a circle in two dimensions. Both models are symmetric under rotation around the longitudinal cylinder axis, which makes gradient orientation irrelevant (in the cylinder case as long as it is in the transverse plane).

The general scheme of the calculations consists of the simulation of the MR phase distribution first, followed by the computation the Apparent Diffusion Coefficient (ADC) and some statistical parameters of the phase distribution. ADC is computed both by fitting signal magnitudes derived from the MR phase distribution, and by the analytic definition of ADC appearing in the series expansion of the logarithm of the signal magnitude.

In order to compute the phase distribution, the time during which the diffusion encoding gradient is applied is divided into n intervals of duration T/n in which the gradient value is computed based on the gradient shape and the particle is moved a random distance in a random direction. We select the displacements in each of the coordinate directions independently using identical Gaussian probability distributions, which results in all directions being equally probable. The displacements have zero mean and standard deviation given by sqrt(2DT/n) while the particle does not reach a recipient wall. The phase changes of the particles are computed for each iteration based on the gradient value and the position, and summed up to get the net phase accumulated during the whole time T. To simulate the non trivial case of restricted diffusion, each time a new random displacement is calculated it is checked whether it would take the particle outside of the recipient; if this is the case the computed displacement is discarded and a new one is computed randomly. This procedure in general breaks the equality of probability distribution used for selecting displacements, making it dependent on position and in our case non Gaussian, with the departure from the Gaussian increasing with the proximity of the particle to a recipient wall. It also breaks the stochastic nature of successive displacements, generating correlation between them.

The part of the software for the numerical simulation of the MR phase distribution was developed using the C# programming language and is under the directory dif_circle. It uses the Mersenne Twister random number generator converting the uniformly distributed integer random numbers resulting from this algorithm into double precision floating point numbers following a Gaussian distribution using the polar form of the Box-Muller transform.

For each simulation the total diffusion encoding time was divided into a number of small intervals which are iterated moving the particle randomly and computing the gradient function in order to accumulate the resulting phase difference. At the end of the simulation the phase difference for each particle is stored in a binary file for later processing. For each structure of interest the simulation was performed for different recipient sizes changing the value of the dimensionless parameter a=r/sqrt(2DT). Each run moved 100,000 particles whose initial positions were randomly and homogeneously distributed inside the recipient and the diffusion encoding time was divided into 100,000 intervals.

The two cylinder model is created combining the phases from two one-cylinder simulations with the corresponding values of the cylinder radius. The number of phase values taken from each distribution corresponds is proportional to the are of each circle, which in turn is proportional to the partial volume. The combination of the phases from the binary files correponding to each individual simulation is done using the dd Linux command and is automated by the script create-twocyl.py in the scripts directory.

A bootstrapping method, based on resampling with replacement from the set of phase values, was used to estimate the 99% confidence intervals for the mean, skewness and kurtosis of the phase distribution, and for the magnitude and phase based ADC values. The confidence intervals for the mean and the skewness were found to cover the zero value in all simulations (the phase distribution is expected to have mean zero and be symmetric). For ADC, confidence intervals were used as a measure of the precision of the simulations and the significance of the differences between the ADC values obtained for different input parameters. The code for the computation of the ADC and ADK values from the phase distribution and the corresponding bootstrapping procedure was developed using the the Clojure programming language and the Incanter library for statistical computing. It appears under the directory bootstrap in this repository. This folder contains a Leiningen repository.

About

Source code and scripts for computing the Diffusion MR ADC in one or two cylinders with a transverse diffusion encoding gradient.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published