MRTwin#
MRTwin is a collection of virtual objects for numerical MR experiments.
Features#
Virtual Phantoms: A collection of sparse (fuzzy and crisp) and dense phantoms for quantitative MRI based on different anatomical models (Shepp-Logan, Brainweb database, Open Science CBS Neuroimaging Repository database) and different tissue representations (single pool, two- and three-pools).
Field Maps: Routines for generation of realistic field maps, including B0 (based on input phantom susceptibility), B1 (including multiple RF modes) and coil sensitivities.
Motion patterns: Markov chain generated rigid motion patterns (both for 2D and 3D imaging) to simulate the effect of motion on MR image quality.
Gradient System Response: Generate Gaussian-shaped gradient response function with linear phase components to simulate k-space trajectory shift and deformation due to non-ideal gradient systems.
Installation#
MRTwin can be installed via pip as:
pip install mrtwin
Basic Usage#
Using MRTwin, we can quickly create a Shepp-Logan phantom, the corresponding static field inhomogeneity map and a set of coil sensitivity maps as follows
import mrtwin
# 2D Shepp-Logan phantom
phantom = mrtwin.shepplogan_phantom(ndim=2, shape=256).as_numeric()
# B0 map
b0_map = mrtwin.b0field(phantom.Chi)
# Coil sensitivity maps
smaps = mrtwin.sensmap(shape=(8, 256, 256))
This allow us to quickly simulate, e.g., a fully-sampled multi-coil Cartesian GRE experiment as:
import numpy as np
TE = 10.0 # ms
rate_map = 1e3 / phantom.T2s + 1j * 2 * np.pi * b0_map
gre = smaps * phantom.M0 * np.exp(-rate_map * TE * 1e-3)
This can be coupled with other libraries (e.g., MRI-NUFFT) to simulate more complex MR sequences (e.g., Non-Cartesian and sub-Nyquist imaging).
Development#
If you are interested in improving this project, install MRTwin in editable mode:
git clone git@github.com:INFN-MRI/mrtwin
cd mrtwin
pip install -e .[dev,test,doc]