MRI simulation toolkit
Project description
Sycomore — an MRI simulation toolkit
Sycomore is an MRI simulation toolkit providing Bloch simulation, Extended Phase Graphs (EPG) (both regular and discrete, including 3D), and Configuration Models. Sycomore is a Python packge in which all computationnaly-intensive operations are run by a C++ backend, providing a very fast runtime and further acceleration through OpenMP.
Sycomore is free software, released under the MIT license, and its source code is available on GitHub.
A sample web application, using Sycomore paired with Bokeh is available on Heroku (note that this is using the free Heroku hosting, and start-up times might be rather long; this does not impact the performance when the application is running): it presents classical MRI experiments (RARE, RF-spoiling, slice profile with a selective sinc pulse), using the different simulation models of Sycomore.
Installation
Packaged versions of Sycomore are available on pypi and Anaconda for Linux, macOS and Windows. The following table summarizes the availability of packages according to the version of the Python interpreter.
Operating system | conda-forge | PyPI |
---|---|---|
Linux | 3.6, 3.7, 3.8 | 3.5, 3.6, 3.7, 3.8 |
macOS (≥ 9) | 3.6, 3.7, 3.8 | 3.6, 3.7, 3.8 |
Windows | 3.6, 3.7, 3.8 | 3.5, 3.6, 3.7 |
To install from Anaconda, type conda install -c conda-forge sycomore
. To install from pypi, type pip3 install sycomore
(or pip install sycomore
). If you are installing from pypi and no pre-compiled version is available for your platform, pip will try to install from the source archive.
If you need to install Sycomore from source, you will need a C++11 compiler, CMake and pybind11 to successfully build Sycomore. If you want to validate your build of Sycomore, you should run the unit tests, which require Boost.Test.
Additional details are provided in the documentation.
Usage
The following code simulates a single repetition of a simple RARE sequence using regular EPG and plots the transverse magnetization of each echo.
import matplotlib.pyplot
import numpy
import sycomore
from sycomore.units import *
species = sycomore.Species(1000*ms, 100*ms, 1*um**2/ms)
TE = 4*ms
train_length = 40
model = sycomore.epg.Regular(species)
data = numpy.zeros(train_length, dtype=[("time", sycomore.Quantity), ("signal", complex)])
model.apply_pulse(90*deg)
for echo in range(train_length):
model.apply_time_interval(TE/2)
model.apply_pulse(180*deg)
model.apply_time_interval(TE/2)
data[echo] = (((1+echo)*TE), model.echo)
times = [x.convert_to(ms) for x in data["time"]]
magnitude = numpy.abs(data["signal"])
matplotlib.pyplot.plot(times, magnitude, ".", label="Simulated")
matplotlib.pyplot.plot(
times, [numpy.exp(-(x*species.R2).magnitude) for x in data["time"]],
label="$T_2$ decay")
matplotlib.pyplot.ylim(0,1)
matplotlib.pyplot.xlabel("Time (ms)")
matplotlib.pyplot.ylabel("Magnitude")
matplotlib.pyplot.legend()
matplotlib.pyplot.show()
The features and data structures are described in the documentation:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for sycomore-1.2.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7962a7963d926c0817d57ed226afb735d1fb5507cc1ca6397f2295246752e5f2 |
|
MD5 | 735d6a21b1f2b97c68cfa4e6896d7c75 |
|
BLAKE2b-256 | 09f70c05ab401334dd0823f165db66716bff9fc4c95a91fc5328b707537ef308 |
Hashes for sycomore-1.2.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8968b41a715a513a01f3537f301b8cb1db76b62b87b3a73ebb2a555beb232850 |
|
MD5 | ddb5c2e56e8bde4498a877c0e34c8ba7 |
|
BLAKE2b-256 | c8a417e7039cfb005d8065691c2de65b5f8730a137032008c4900da165c5a8ba |
Hashes for sycomore-1.2.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d083b726e5e20a0f5c244a534e371f06f7a2cc7c60c26b04bee67d2ac88be7c4 |
|
MD5 | 75cdd3b8760685b8449e331dbd2e570e |
|
BLAKE2b-256 | 78449d06ab5f861851f71c46d4aee72ea034a5964780119a02b7b2a622b0d872 |
Hashes for sycomore-1.2.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75b1eb6cc47924f647327d200f08fdcc21bad847b4e1d56879f5adab0cadf5d0 |
|
MD5 | 49627be304068b9a22c643c70df409a3 |
|
BLAKE2b-256 | bcc3c9d672e4c44374e3ddfe06e4e03cfc4e508f912ebe7af017d20e58a04cb1 |
Hashes for sycomore-1.2.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ab0201e2b222bf9ade38e135beb66fa03136185434d9e2435e97c09feff418e |
|
MD5 | d84e7a14d5c366d9e2f140fe35c443a6 |
|
BLAKE2b-256 | 4953a4279ed4c1e87000757c84f56f7681b592b33368687f900a41f554fc88d2 |
Hashes for sycomore-1.2.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6372b12adee444be471ffb8e7f46e06d4e2a9ee90557348f321797e283b004e |
|
MD5 | d35ed79421bccb1e94c85313d7634c0d |
|
BLAKE2b-256 | d0501cc47bcf9ffcf56fffcc0396cf64deadf43a9893e529dc562cf6e9b79265 |
Hashes for sycomore-1.2.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a81831634b5e9defd56309a79831b541ce87c7b8800d10a6dad9b4d2b12fb70 |
|
MD5 | dde85ffe975b73e107c0908008191149 |
|
BLAKE2b-256 | b1541c77435482ed3a2849ca99a5086b9452b99e312bcc288f1845538d893919 |
Hashes for sycomore-1.2.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d19643a2726fedfcda0defd33dd06695e66948b2d685cb62b2f2212ec05b135 |
|
MD5 | 122bde032d30e53f5c19f873cc1de117 |
|
BLAKE2b-256 | 128c6e742afed2346b854ccdfa29f796dc8ebe62078cf00143730f070faa0440 |
Hashes for sycomore-1.2.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16950fc94242fee8f929639bd4672e9d9d85c141084e782aa65497cc524df610 |
|
MD5 | f2f8b8f38ff390da9862470f4392daff |
|
BLAKE2b-256 | f60f503b7c66a70e60254bc66f4c9795e8a77fe31d8e9ed7f1c92bded644ffb8 |
Hashes for sycomore-1.2.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42fa8bc67276d90ce5fa304a9cfa59fca9bde6e3f5584befa2357f3c3d2969b4 |
|
MD5 | 4a9c5201828e0af485a98a3b8f3bbb72 |
|
BLAKE2b-256 | cdc1571d1b4eafc01ed5d6fc4561a66319d49117f5b32f0dadfe3dc6c09f1cf1 |
Hashes for sycomore-1.2.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3df7ee4d9b9dd9993440ea7790045723ab36461b671776e4e51661735209c8e7 |
|
MD5 | d7522b8f83e06997a1b3208d1a055128 |
|
BLAKE2b-256 | f421da2086e9b1949d5f6d5714482c7c67788fa5c8c33f972a2f69dea3df4db6 |