Skip to main content

Monte Carlo simulation

This part of the package contains the code for the Monte Carlo simulation of individual spins. The simulation is based on the paper by Lee et al..

How it works

The MC-simulation simulates random walks of individual spins in a voxelized microgeometry. It relies on tissue segmentation which is used to assign diffusion properties to different compartments. At borders between compartments, spins have a probability to pass through or reflect (modelled as elastic collision). The random walk is implemented as a sequence of many small steps of fixed time duration. As spins diffuse through the domain, they accumulate phase according to the gradient of the simulated DWI-sequence. Spin-spin interactions are not modelled, which means spin paths can be completeley parallelized. Final phase accumulation of all spins is summed up (depending on reconstruction pipeline) to get a contrast in the image.

Implementation

The implementation is done with numba. There is a CPU and a GPU version. The GPU version is much faster. 1D, 2D and 3D simulations are supported. Multiple diffusion sequences can be simulated in parallel.