Skip to main content

MRTwin is a collection of virtual objects for numerical MR experiments.

Coverage CI CD License Codefactor Sphinx PyPi Black PythonVersion

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]

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mrtwin-0.1.3.tar.gz (60.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mrtwin-0.1.3-py3-none-any.whl (49.8 kB view details)

Uploaded Python 3

File details

Details for the file mrtwin-0.1.3.tar.gz.

File metadata

  • Download URL: mrtwin-0.1.3.tar.gz
  • Upload date:
  • Size: 60.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for mrtwin-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b1ced4c16589dd350cc959ef619ddb3ffba1b28ad56f743cdf4be1b998bcfaae
MD5 6bd898405ab499b5715014666d1db715
BLAKE2b-256 90da6708a1c3aa2a8d72e37c88de33a6583f74333b1ad585945d3aa046e2b2bd

See more details on using hashes here.

File details

Details for the file mrtwin-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: mrtwin-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 49.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for mrtwin-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 55a0e786621562e54826de76e40c1d12f9926a0f82a0f0af28092b5db72ff120
MD5 5a2436e10ec4a27abb2a8d887f1e441b
BLAKE2b-256 922503e0328c5190c60decf19a0818afcf8bee1be49c67c4b0c6867e1137861c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page