First-order Spatial Encoding Simulations for Improved Accuracy in the Presence of Strong $\mathrm{B}_0$ and Gradient Field Variations
This repository contains code to perform 1st-order spatial encoding MRI simulations, developed especially for highly variable and inhomogeneous main magnetic (B0) and gradient fields (BGxyz). This simulation code is a starting point for exploring how to capture the encoding effects of strong field variations accurately and efficiently to enable the assessment of distortions, signal dropout, and foldover artifacts.
The following figure determines an example scenario in which these simulations can be used for improved accuracy:
For more details, please refer to the paper.
The code requires julia >= v"1.9.0"
Install 1ST ORDER MRI SIMS: clone the repository locally and install with
git clone https://github.com/radhikatibrewala/1stOrderMRISims.git
The repository is centered around the MainSlurm.jl
file. The following breaks down the basic structure:
Project.toml
: Contains the packages needed for the project. Each entry specifies the package name and its version requirementInitialize.jl
: ContainsPkg.instantiate()
which reads theProject.toml
file and automatically creates a project environment with the specified dependencies and versions.Pkg.instantiate()
will trigger package installation when run for the first timeMainSlurm.jl
: Main file to run the simulationsrc
: Contains the source code for the project, including all relevant functions that are called upon inMainSlurm.jl
examples
: Contains the example quadratic field configuation, example input image and a bash filegen_kspace.sh
that calls uponMainSlurm.jl
RunTests.jl
: Compiles the code and runs tests on a gradient echo and spin echo sequence using files fromtests
tests
: Contains test scripts called upon inRunTests.jl
FinalImageSim
: Final file to be run onceMainSlurm.jl
has finished running, to create the image from the simulated k-space
This is a very computationally heavy code and has been tested on High Performance Computing Systems. Julia uses threads
to speed up the calculation by splitting it on multiple cores. To run the example gen_kspace.sh file, you will need:
- A computer with at least 256GB of RAM
- A multi-core CPU
1ST ORDER MRI SIMS is MIT licensed, as found in LICENSE file
If you use the 1ST ORDER MRI SIMS code in your research, please use the following BibTeX entry.