Python 3.6 based implementation of Pulseq in GPI Lab.
- Tested on macOS Sierra 10.12.1
- Software: PyCharm 2017.2.4, GPI 1.0.0-rc
- PyCharm 2017.2.4 SHA1:
0a119a7d305f50efedb65589d77a46a36536bf0b
- GPI 1.0.0-rc SHA1:
5fa5c62d0698d076052be59b07ec9cf4c434a50c
- TOPPEv2 SHA1:
6fe3277fe84d76f2b1816d804fb1cf39c2eb2e86
- Libraries: Numpy 1.13.3, Matplotlib 2.0.2, h5py 2.7.1
- Setting up
- Note
- Installing pulseq-gpi
- Installing GPI (optional)
- Installing pre-requisite libraries (optional)
- Getting startedP∏
- Developing for pulseq-gpi
- Node documentation
- Contributing
- The pulseq-gpi library contains code to either design pulse sequences in GPI or program pulse sequences in Python
- To program pulse sequences in Python, step 2 of this section can be skipped but step 4 is required
- To design pulse sequences in GPI, step 4 of this section can be skipped
- If not already familiar with Pulseq, it is strongly recommended to learn the design spec. The whitepaper and the official website are the best resources to get started
- Similarly, if not already familiar with GPI, it is strongly recommended to go through the official documentation
This section lists instructions to install pulseq-gpi.
-
Clone the repo by downloading the zip file and extracting it:
-
Open GPI
-
Click on Config > Generate User Library. This generates a gpi folder in the current user's home directory
-
Place the mr_gpi and mr_nodes folders from the extracted pulseq-gpi folder inside this auto-generated folder. On Mac - /Users/[user-name]/gpi/[user-name]/
-
In GPI Lab, click on Config > Scan for new nodes
That's it! Now, the pulseq-gpi Nodes should show up when you right-click anywhere on the canvas.
This section lists instructions to install the GPI software.
- Download v1 beta from - http://gpilab.com/downloads/
- Install:
To program pulse sequences in Python, pulseq-gpi requires the following libraries:
The official websites have resources on installing the respective libraries (usually, using pip). Listed below are instructions for installing the same libraries on PyCharm:
-
Open PyCharm
-
Click Project Intepreter in the left pane
-
Search for the prerequisite libraries and install
This section lists instructions to get started. There are two ways to design pulse sequences using the pulseq-gpi library. Sequences can either be programmed in Python or designed using GPI Nodes. Programming pulse sequences in Python allows for more flexibility in design, while designing sequences using Nodes in GPI trades flexibility for ease of use.
The pulseq-gpi library comes bundled with example GPI networks and Python scripts for the following pulse sequences: Gradient Recalled Echo, Spin Echo and Spin Echo-EPI.
- The GPI networks and Python scripts are runnable out-of-the-box, configured to display plots for a single TR
- The Python scripts are not executable without the prerequisite libraries installed.
To run a GPI network, simply drag and drop the network onto the GPI canvas. Then, open the ConfigSeq
Node by right-clicking and click on Compute Events. Finally, open the GenSeq
Node by right-clicking and click on Compute Events to construct the pulse sequence. The plots are viewable in the Matplotlib
Node.
While pulseq-gpi is a translation of the original Pulseq specification for Matlab, the code has been modified to suit the Pythonic style of programming. This includes slightly modifying method and variable names. The code documentation contains all the details.
- Open GPI
- Right click anywhere on the canvas > Load network > /path/to/pulseq-gpi/Networks/ > select any network
- Configure the pulse sequence values by right clicking the
ConfigSeq
andAddBlock
Nodes. EachEvent
mandatorily needs a unique name. Each Node also mandatorily needs a unique name - From left to right, click
Compute Events
in each Node - Right click the
GenSeq
Node. Here you will see a list of the Nodes you have defined in your canvas. Enter the unique Node names in the order in which you want theEvents
to be played out. Node names are separated by a comma (,) - Click on
ComputeEvents
once you are done. Make sure theGenSeq
Node's output connectors are linked to the input connectors of theMatplotlib
Node - Right click on the
Matplotlib
Node to view plots
Fork & PR if the code can be improved in any way!
Every Node has documentation text included in the code. The documentation lists the parameters handled and the values returned by the Node, along with a brief description of the functioning.
The folder structure of the project is as follows (.py files are not listed):
pulseq-gpi:
mr_gpi
: Contains code that is a direct translation of the Pulseq specification for Matlab-
pulseq2jemris
: Not included in the original Pulseq design. Contains code that lets pulseq-gpi play nicely with Jemris
-
Sequence
: Included in the original Pulseq design
mr_nodes
: Custom Nodes that leveragemr_gpi
methods a provide a graphical interface in GPI- Networks: Contains example network files for the following pulse sequences: Gradient Recalled Echo, Spin Echo and Spin Echo-EPI
- Scripts: Contains sample scripts to design: Gradient Recalled Echo, Spin Echo and Spin Echo-EPI
- LICENSE
- README: This file
If there is any Node that is missing or having incomplete documentation, raise an issue on this repo.