Skip to main content

License: GPL v3

SpinSight MRI simulator

SpinSight is an MRI simulator written in Python and created for educational purposes. It jointly visualizes the imaging parameters, the MRI pulse sequence, the k-space data matrix, and the MR image. These are updated in near real-time when the user changes parameters. The simulator is run as a web browser dashboard. The data is simulated from computational 2D phantoms in vector graphics format (SVG).

Starting the Simulator

Install using pip:

pip install spinsight

Then run as a command line tool

spinsight

This serves SpinSight on the local host, and opens a web browser at localhost (browser popup can be suppressed using the -b flag). Be aware that several minutes may be required upon loading a phantom for the first time.

Other command line flags include -l to get continuous updates when dragging input parameter sliders, and -t to get text input boxes next to sliders for increased control. There are also flags to deploy the simulator on a local network, or on a web server. Run spinsight -h to display all command line options.

Usage

The simulated MR image is updated instantly as input parameter are changed. This is also true for the k-space plot and pulse sequence diagram (they are hidden by default, but can be shown using the buttons to the top left). This enables easy exploration of how different imaging parameters affect the pulse sequence, the k-space data, and the MR image. The plots can be navigated through scrolling (zooming) and dragging (panning).

A sidebar menu can be exposed by clicking the ☰ icon left of the title. Here, you can load preset parameters and change the computational phantom, the field strength, and the input parameter style (reflecting different MRI vendors). You can also enable "help mode" by clicking the (?)-icon, which displays a help icon next to each parameter. Hover the help icons to read explanations of each parameter.

A more comprehensive list of features is provided in the paper (see How to cite).

Phantom construction

To create a new phantom, add a directory with the phantom name under spinsight/phantoms. This directory shall contain files with the same name as the directory. Two formats are supported:

A single .toml file

The file shall consist of a list of shapes (see Shepp-Logan_shapes.toml for reference). Each shape is assigned a tissue type which must be defined in the TISSUES dict in constants.py.

A pair of .toml and .svg files

The .toml file specifies a mapping from hexcolors to tissues (see brain.toml for reference). The tissues must be defined in the TISSUES dict in constants.py.

The specified .svg file must meet the following specifications:

  • All paths must be closed
  • All paths must have a fill color matching a hexcolor defined in the .toml file (this defines the tissue).
  • Only polygons are supported (not Bézier curves etc.)

Dependencies

See pyproject.toml, dependencies under heading [project].

How to cite

If you use this software in your research, please cite:

Berglund J. "SpinSight – an Educational Open-Source MRI Simulator". Magnetic Resonance in Medicine, 2026. [DOI: 10.1002/mrm.70694]

License

SpinSight is distributed under the terms of the GNU General Public License. See LICENSE.md.

Contact Information

Johan Berglund, Ph.D.
Uppsala University Hospital,
Uppsala, Sweden.
johan.berglund@akademiska.se


Copyright © 2021–2026 Johan Berglund.

Metadata

Release files for spinsight 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spinsight 1.4.0
File Size Uploaded Provenance Actions
spinsight-1.4.0.tar.gz 1.2 MB Without provenance Details for spinsight-1.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spinsight 1.4.0
File Interpreter ABI Platform Actions
spinsight-1.4.0-py3-none-any.whl Python 3 none any Details for spinsight-1.4.0-py3-none-any.whl

Total release size: 1.3 MB

Release files / spinsight-1.4.0.tar.gz

Download URL spinsight-1.4.0.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
5a6e30e05f6e77aef3ef3a985ba5c4d8dbcfd6090f40e97104e545e7adbfbc3f
BLAKE2b-256 checksum
How to use checksums
71a0e5455dfaa822de34c20394e3def0800990886b97c7352cc9cb22639a5595
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / spinsight-1.4.0-py3-none-any.whl

Download URL spinsight-1.4.0-py3-none-any.whl
Size 132.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3825653cd9741be7dd874ed4f99880747ec5cfe05c5fb73e0a0cfb7da40a7b4e
BLAKE2b-256 checksum
How to use checksums
3b87b309b95e00079d7aa538ccdbedadc9acf78a21538f0160a790bd0812d4ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for spinsight 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.4.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page