Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
aghaeifar committed Dec 20, 2024
1 parent 3afa592 commit 344ee83
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,41 @@
</div>


SpinWalk is a Monte Carlo diffusion simulator. Spinwalk simulates spins (particles) random walk under a specific MR sequence within a digital phantom mimicing e.g., microvascular network, cells, axons, etc.
**SpinWalk** is a Monte Carlo diffusion simulator. It simulates the random walk of spins (particles) under a specific MR sequence within a digital phantom, which can represent structures such as microvascular networks, cells, axons, and more.

---
### Key features
- runs in GPU (massively parallel) or CPU
- off-resonance: local field inhomogeneity because of susceptibility variation is accepted
- T1 and T2 relxation times: Each substrate can have own relaxation defined
- permeability: permeability between individual substrate can be defined with a probablity value
- RF pulses: optinonal number of RF (with magnitude and phase)
- Gradients: Gradient waveform in mT/m for each axis (X, Y, Z) can be defined
- Recording trajectory of random walks in 3D
- simulating steady state condition with given phase cycling and dummy scans
- Boundry condition for crossing FoV
- predefined or random spins placement
- predefined or equlibrium for initial spins magnetization
- FoV can be internally scaled, allows simulating range of vessel size for BOLD fMRI contrast

### Key Features
- **GPU and CPU support**: Runs efficiently on both GPU (massively parallel) and CPU.
- **Off-resonance effects**: Accounts for local field inhomogeneity due to susceptibility variations.
- **T1 and T2 relaxation times**: Each substrate can have its own defined T1 and T2 relaxation times.
- **Permeability**: Defines the permeability between individual substrates using a probability value.
- **RF pulses**: Supports an optional number of RF pulses with specified magnitude and phase.
- **Gradients**: Defines gradient waveforms in mT/m for each axis (X, Y, Z).
- **Trajectory recording**: Tracks the trajectory of random walks in 3D space.
- **Steady-state simulation**: Models steady-state conditions with given phase cycling and dummy scans.
- **Boundary conditions**: Handles boundary conditions for crossing the field of view.
- **Spin placement**: Allows predefined or random placement of spins.
- **Initial magnetization**: Supports predefined or equilibrium initial spin magnetization.
- **Field of View (FoV)**: The FoV can be internally scaled, enabling the simulation of a wide range of vessel sizes for BOLD fMRI contrast.


---
### Demo

Jupyter notebooks that demonstrate the basic functionality of the SpinWalk for [BOLD fMRI contrast](./demo/spinwalk_example.ipynb) and [free diffusion](./demo/spinwalk_dwi.ipynb) simulation can be found in [demo](./demo) folder
Jupyter notebooks demonstrating the basic functionality of SpinWalk for [BOLD fMRI contrast](./demo/spinwalk_example.ipynb) and [free diffusion](./demo/spinwalk_dwi.ipynb) simulations can be found in the [demo](./demo) folder.

Here are example plots obtained from SpinWalk where show BOLD sensitivity as a function of vessel size for Gradient Echo (GRE) and Spin Echo (SE) seqeuences. Some [literature](#Literature) are provided as reference to get a better feeling of what are intended to get from this kind of simulations.
Below are example plots generated by SpinWalk, showing BOLD sensitivity as a function of vessel size for Gradient Echo (GRE) and Spin Echo (SE) sequences. Some [literature](#Literature) is provided as a reference to help understand the intended outcomes of these simulations.

![](./docs/img/gre_se.jpg)

---
### How to build
### How to Build

You can either use the supplied Dockerfile for a consistent build that includes all dependencies, or install the dependencies separately and compile using CMake.

#### Docker
We suggest utilizing the provided Dockerfile, which automates the installation of all dependencies, as well as the cloning and building of the program. Clone SpinWalk and build using the provided [Dockerfile](./containers/Dockerfile) with:
#### Docker
We recommend using the provided Dockerfile, which automates the installation of all dependencies, as well as the cloning and building of the program. To build SpinWalk with the provided [Dockerfile](./containers/Dockerfile), clone the repository and run:

```shell
git clone https://github.com/aghaeifar/SpinWalk
Expand All @@ -65,13 +68,13 @@ docker run --gpus all --rm -it --runtime=nvidia spinwalk bash

**Dependencies**

- A C++ compiler supprting C++20
- CUDA toolkit newer than v12.0 that supports C++20 ([+](https://developer.nvidia.com/blog/cuda-toolkit-12-0-released-for-general-availability/)). Nvidia driver must support your CUDA release ([+](https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html)). Check driver and cuda version with *nvidia-smi* and *nvcc --version* in terminal.
- A C++ compiler that supports C++20
- CUDA toolkit version 12.0 or later that supports C++20 ([+](https://developer.nvidia.com/blog/cuda-toolkit-12-0-released-for-general-availability/)). Your Nvidia driver must support the corresponding CUDA version ([+](https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html)). Check your driver and CUDA versions with *nvidia-smi* and *nvcc --version* in the terminal.
- Boost libraries ([+](https://www.boost.org/))
- HDF5 Library ([+](https://www.hdfgroup.org/downloads/hdf5))
- Threading Building Blocks (TBB).
If you prefer to install the program without using Docker, follow these steps (tested in Ubuntu 22.04):
- HDF5 library ([+](https://www.hdfgroup.org/downloads/hdf5))
- Threading Building Blocks (TBB)

If you prefer to install the program without using Docker, follow these steps (tested on Ubuntu 22.04):

```shell
sudo apt-get update && apt-get install -y libboost-all-dev libhdf5-dev libtbb-dev
Expand All @@ -84,7 +87,7 @@ cmake --build ./build --config Release

### How to simulate

After building the program, simply launch `spinwalk` in the terminal to view the help menu with all available options. If a GPU is avaialbe and CUDA is installed, launch `spinwalk -g` to display GPU and driver version. SpinWalk has four subcommands. Subcommand `sim` is used for random walk simulations. The settings for simulation is provided through a configuration file. An example could be as:
After building the program, simply run `spinwalk` in the terminal to view the help menu with all available options. If a GPU is available and CUDA is installed, you can run `spinwalk -g` to display the GPU and driver version. SpinWalk has four subcommands. The `sim` subcommand is used for random walk simulations. The settings for the simulation are provided through a configuration file. An example command might look like:

```shell
spinwalk sim -c my_config.ini
Expand Down

0 comments on commit 344ee83

Please sign in to comment.