<p align="center">

</p>
# PyPulseq: A Python Package for MRI Pulse Sequence Design
## PyPulseq (v1.4.2) is compatible with all Pulseq interpreter sequences with version >= 1.4.0
## Table of contents π§Ύ
1. [π General Information][section-general-info]
2. [π¨ Installation][section-installation]
3. [β‘ Lightning-start - PyPulseq in your browser!][section-lightning-start]
4. [πββ Quickstart - example scripts][section-quickstart-examples]
5. [π€Ώ Deep dive - custom pulse sequences][section-deep-dive]
6. [π₯ Contributing and Community guidelines][section-contributing]
7. [π References][section-references]
---
## 1. General Information
Pulse sequence design is a significant component of MRI research. However, multi-vendor studies require researchers to
be acquainted with each hardware platform's programming environment.
PyPulseq enables vendor-neutral pulse sequence design in Python [[1,2]][section-references]. The pulse sequences can be
exported as a `.seq` file to be run on Siemens, [GE], [Bruker] and now also Philips hardware by leveraging their respective Pulseq interpreters. This tool is targeted at MRI pulse sequence designers, researchers, students and other interested
users. It is a translation of the Pulseq framework originally written in Matlab [[3]][section-references].
π Currently, PyPulseq is compatible with Pulseq >= 1.4.0. π
It is strongly recommended to first read the [Pulseq specification] before proceeding. The specification
document defines the concepts required for pulse sequence design using PyPulseq.
If you use PyPulseq in your work, please cite the publications listed under [References][section-references].
---
## 2. π¨ Installation
PyPulseq is available on the python Package Index [PyPi](https://pypi.org/project/pypulseq/) and can be installed using the command
`pip install pypulseq`
The latest features and minor bug fixes might not be included in the latest release version. If you want to use the bleeding edge version of PyPulseq, you can install it directly from the development branch of this repository using the command
`pip install git+https://github.com/imr-framework/pypulseq@dev`
π PyPulseq is **not yet available on conda**, but this is planned for the future π
---
## 3. β‘ Lightning-start - PyPulseq in your browser
1. Create a new notebook on [Google Colab][google-colab]
2. Install PyPulseq using `pip install pypulseq`
3. Get going!
---
## 4. πββ Example scripts
The PyPulseq repository contains several example sequences in the [seq_examples](/pypulseq/seq_examples/) folder. Every example script or example notebook creates a pulse sequence, plots the pulse timing diagram and finally saves the sequence as a `.seq` file to disk.
---
## 5. π€Ώ Deep dive - custom pulse sequences
Getting started with pulse sequence design using `PyPulseq` is simple:
1. First, define system limits in `Opts` and then create a `Sequence` object with it:
```python
import pypulseq as pp
system = pp.Opts(max_grad=32, grad_unit='mT/m', max_slew=130, slew_unit='mT/m/ms')
seq = pp.Sequence(system=system)
```
2. Then, design gradient, RF or ADC pulse sequence events:
```python
Nx, Ny = 256, 256 # matrix size
fov = 220e-3 # field of view
delta_k = fov / Nx
# RF sinc pulse with a 90 degree flip angle
rf90 = pp.make_sinc_pulse(flip_angle=90, duration=2e-3, system=system, slice_thickness=5e-3, apodization=0.5,
time_bw_product=4)
# Frequency encode, trapezoidal event
gx = pp.make_trapezoid(channel='x', flat_area=Nx * delta_k, flat_time=6.4e-3, system=system)
# ADC readout
adc = pp.make_adc(num_samples=Nx, duration=gx.flat_time, delay=gx.rise_time, system=system)
```
3. Add these pulse sequence events to the `Sequence` object. One or more events can be executed simultaneously, simply pass them all to the `add_block()` method. For example, the `gx` and `adc` pulse sequence events need to be executed simultaneously:
```python
seq.add_block(rf90)
seq.add_block(gx, adc)
```
4. Visualize plots:
```python
seq.plot()
```
5. Generate a `.seq` file to be executed on a real MR scanner:
```python
seq.write('demo.seq')
```
---
## 6. π₯ Contributing and Community guidelines
`PyPulseq` adheres to a code of conduct adapted from the [Contributor Covenant] code of conduct.
Contributing guidelines can be found [here][contrib-guidelines].
---
## 7. π References
1. Ravi, Keerthi, Sairam Geethanath, and John Vaughan. "PyPulseq: A Python Package for MRI Pulse Sequence Design."
Journal of Open Source Software 4.42 (2019): 1725.
2. Ravi, Keerthi Sravan, et al. "Pulseq-Graphical Programming Interface: Open source visual environment for prototyping
pulse sequences and integrated magnetic resonance imaging algorithm development." Magnetic resonance imaging 52 (2018):
9-15.
3. Layton, Kelvin J., et al. "Pulseq: a rapid and hardwareβindependent pulse sequence prototyping framework." Magnetic
resonance in medicine 77.4 (2017): 1544-1552.
[Bruker]: https://github.com/pulseq/bruker_interpreter
[Contributor Covenant]: http://contributor-covenant.org
[GE]: https://toppemri.github.io
[Pulseq specification]: https://pulseq.github.io/specification.pdf
[contrib-guidelines]: https://github.com/imr-framework/pypulseq/blob/master/CONTRIBUTING.md
[google-colab]: https://colab.research.google.com/
[section-general-info]: #1-general-information
[section-contributing]: #7--contributing-and-community-guidelines
[section-deep-dive]: #6--deep-dive---custom-pulse-sequences
[section-installation]: #3--installation
[section-lightning-start]: #4--lightning-start---pypulseq-in-your-browser
[section-quickstart-examples]: #5--quickstart---example-scripts
[section-references]: #8--references
Raw data
{
"_id": null,
"home_page": "https://github.com/imr-framework/pypulseq",
"name": "pypulseq",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6.3",
"maintainer_email": null,
"keywords": null,
"author": "Keerthi Sravan Ravi",
"author_email": "ks3621@columbia.edu",
"download_url": "https://files.pythonhosted.org/packages/a3/38/fa8c82aee6cc4520d0d6ebe759b9c04488be79207b8811342c23d0d631e8/pypulseq-1.4.2.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n\n\n\n</p>\n\n# PyPulseq: A Python Package for MRI Pulse Sequence Design\n\n## PyPulseq (v1.4.2) is compatible with all Pulseq interpreter sequences with version >= 1.4.0\n\n## Table of contents \ud83e\uddfe\n\n1. [\ud83d\udcc3 General Information][section-general-info]\n2. [\ud83d\udd28 Installation][section-installation]\n3. [\u26a1 Lightning-start - PyPulseq in your browser!][section-lightning-start]\n4. [\ud83c\udfc3\u200d\u2642 Quickstart - example scripts][section-quickstart-examples]\n5. [\ud83e\udd3f Deep dive - custom pulse sequences][section-deep-dive]\n6. [\ud83d\udc65 Contributing and Community guidelines][section-contributing]\n7. [\ud83d\udcd6 References][section-references]\n\n---\n\n## 1. General Information\n\nPulse sequence design is a significant component of MRI research. However, multi-vendor studies require researchers to\nbe acquainted with each hardware platform's programming environment.\n\nPyPulseq enables vendor-neutral pulse sequence design in Python [[1,2]][section-references]. The pulse sequences can be\nexported as a `.seq` file to be run on Siemens, [GE], [Bruker] and now also Philips hardware by leveraging their respective Pulseq interpreters. This tool is targeted at MRI pulse sequence designers, researchers, students and other interested\nusers. It is a translation of the Pulseq framework originally written in Matlab [[3]][section-references].\n\n\ud83d\udc49 Currently, PyPulseq is compatible with Pulseq >= 1.4.0. \ud83d\udc48\n\nIt is strongly recommended to first read the [Pulseq specification] before proceeding. The specification\ndocument defines the concepts required for pulse sequence design using PyPulseq.\n\nIf you use PyPulseq in your work, please cite the publications listed under [References][section-references].\n\n---\n\n## 2. \ud83d\udd28 Installation\n\nPyPulseq is available on the python Package Index [PyPi](https://pypi.org/project/pypulseq/) and can be installed using the command\n\n`pip install pypulseq`\n\nThe latest features and minor bug fixes might not be included in the latest release version. If you want to use the bleeding edge version of PyPulseq, you can install it directly from the development branch of this repository using the command\n\n`pip install git+https://github.com/imr-framework/pypulseq@dev`\n\n\ud83d\udc49 PyPulseq is **not yet available on conda**, but this is planned for the future \ud83d\udc48\n\n---\n\n## 3. \u26a1 Lightning-start - PyPulseq in your browser\n\n1. Create a new notebook on [Google Colab][google-colab]\n2. Install PyPulseq using `pip install pypulseq`\n3. Get going!\n\n---\n\n## 4. \ud83c\udfc3\u200d\u2642 Example scripts\n\nThe PyPulseq repository contains several example sequences in the [seq_examples](/pypulseq/seq_examples/) folder. Every example script or example notebook creates a pulse sequence, plots the pulse timing diagram and finally saves the sequence as a `.seq` file to disk.\n\n---\n\n## 5. \ud83e\udd3f Deep dive - custom pulse sequences\n\nGetting started with pulse sequence design using `PyPulseq` is simple:\n\n1. First, define system limits in `Opts` and then create a `Sequence` object with it:\n\n ```python\n import pypulseq as pp\n\n system = pp.Opts(max_grad=32, grad_unit='mT/m', max_slew=130, slew_unit='mT/m/ms')\n seq = pp.Sequence(system=system)\n ```\n\n2. Then, design gradient, RF or ADC pulse sequence events:\n\n ```python\n Nx, Ny = 256, 256 # matrix size\n fov = 220e-3 # field of view\n delta_k = fov / Nx\n\n # RF sinc pulse with a 90 degree flip angle\n rf90 = pp.make_sinc_pulse(flip_angle=90, duration=2e-3, system=system, slice_thickness=5e-3, apodization=0.5,\n time_bw_product=4)\n\n # Frequency encode, trapezoidal event\n gx = pp.make_trapezoid(channel='x', flat_area=Nx * delta_k, flat_time=6.4e-3, system=system)\n\n # ADC readout\n adc = pp.make_adc(num_samples=Nx, duration=gx.flat_time, delay=gx.rise_time, system=system)\n ```\n\n3. Add these pulse sequence events to the `Sequence` object. One or more events can be executed simultaneously, simply pass them all to the `add_block()` method. For example, the `gx` and `adc` pulse sequence events need to be executed simultaneously:\n\n ```python\n seq.add_block(rf90)\n seq.add_block(gx, adc)\n ```\n\n4. Visualize plots:\n\n ```python\n seq.plot()\n ```\n\n5. Generate a `.seq` file to be executed on a real MR scanner:\n\n ```python\n seq.write('demo.seq')\n ```\n\n---\n\n## 6. \ud83d\udc65 Contributing and Community guidelines\n\n`PyPulseq` adheres to a code of conduct adapted from the [Contributor Covenant] code of conduct.\nContributing guidelines can be found [here][contrib-guidelines].\n\n---\n\n## 7. \ud83d\udcd6 References\n\n1. Ravi, Keerthi, Sairam Geethanath, and John Vaughan. \"PyPulseq: A Python Package for MRI Pulse Sequence Design.\"\nJournal of Open Source Software 4.42 (2019): 1725.\n2. Ravi, Keerthi Sravan, et al. \"Pulseq-Graphical Programming Interface: Open source visual environment for prototyping\npulse sequences and integrated magnetic resonance imaging algorithm development.\" Magnetic resonance imaging 52 (2018):\n9-15.\n3. Layton, Kelvin J., et al. \"Pulseq: a rapid and hardware\u2010independent pulse sequence prototyping framework.\" Magnetic\nresonance in medicine 77.4 (2017): 1544-1552.\n\n[Bruker]: https://github.com/pulseq/bruker_interpreter\n[Contributor Covenant]: http://contributor-covenant.org\n[GE]: https://toppemri.github.io\n[Pulseq specification]: https://pulseq.github.io/specification.pdf\n[contrib-guidelines]: https://github.com/imr-framework/pypulseq/blob/master/CONTRIBUTING.md\n[google-colab]: https://colab.research.google.com/\n[section-general-info]: #1-general-information\n[section-contributing]: #7--contributing-and-community-guidelines\n[section-deep-dive]: #6--deep-dive---custom-pulse-sequences\n[section-installation]: #3--installation\n[section-lightning-start]: #4--lightning-start---pypulseq-in-your-browser\n[section-quickstart-examples]: #5--quickstart---example-scripts\n[section-references]: #8--references\n",
"bugtrack_url": null,
"license": "License :: OSI Approved :: GNU Affero General Public License v3",
"summary": "Pulseq in Python",
"version": "1.4.2",
"project_urls": {
"Documentation": "https://pypulseq.readthedocs.io/en/latest/",
"Homepage": "https://github.com/imr-framework/pypulseq"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "adde545495e1f977883cc456dadcbdba6195baf0924217b01c823a1c00a3c723",
"md5": "173c5bc4428ab50afc4170f4edee2b18",
"sha256": "bcb190d5356ca5c01c187adf3ef5d2d559928cfd7ea400f00c89e6ed9a322c02"
},
"downloads": -1,
"filename": "pypulseq-1.4.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "173c5bc4428ab50afc4170f4edee2b18",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6.3",
"size": 278015,
"upload_time": "2024-06-21T08:25:17",
"upload_time_iso_8601": "2024-06-21T08:25:17.567596Z",
"url": "https://files.pythonhosted.org/packages/ad/de/545495e1f977883cc456dadcbdba6195baf0924217b01c823a1c00a3c723/pypulseq-1.4.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a338fa8c82aee6cc4520d0d6ebe759b9c04488be79207b8811342c23d0d631e8",
"md5": "310cf73e5b60c76ba745790d8c92b93e",
"sha256": "9d7fdf9969af751376cd16f07084e3080942ff1b2d47d4c846c972e1413913c2"
},
"downloads": -1,
"filename": "pypulseq-1.4.2.tar.gz",
"has_sig": false,
"md5_digest": "310cf73e5b60c76ba745790d8c92b93e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.3",
"size": 238563,
"upload_time": "2024-06-21T08:25:18",
"upload_time_iso_8601": "2024-06-21T08:25:18.902857Z",
"url": "https://files.pythonhosted.org/packages/a3/38/fa8c82aee6cc4520d0d6ebe759b9c04488be79207b8811342c23d0d631e8/pypulseq-1.4.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-21 08:25:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "imr-framework",
"github_project": "pypulseq",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pypulseq"
}