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]
Metadata
Release files for mrtwin 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mrtwin-0.1.3.tar.gz | 60.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mrtwin-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 110.6 kB
Release files / mrtwin-0.1.3.tar.gz
| Download URL | mrtwin-0.1.3.tar.gz |
|---|---|
| Size | 60.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1ced4c16589dd350cc959ef619ddb3ffba1b28ad56f743cdf4be1b998bcfaae
|
|
BLAKE2b-256 checksum How to use checksums |
90da6708a1c3aa2a8d72e37c88de33a6583f74333b1ad585945d3aa046e2b2bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / mrtwin-0.1.3-py3-none-any.whl
| Download URL | mrtwin-0.1.3-py3-none-any.whl |
|---|---|
| Size | 49.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
55a0e786621562e54826de76e40c1d12f9926a0f82a0f0af28092b5db72ff120
|
|
BLAKE2b-256 checksum How to use checksums |
922503e0328c5190c60decf19a0818afcf8bee1be49c67c4b0c6867e1137861c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|