4671

mtrk – A flexible open-source framework for developing MRI pulse sequences based on common web standards
Anais Artiges1,2, Amanpreet Singh Saimbhi1,2, Roy Wiggins1,2, Riccardo Lattanzi1,2, and Kai Tobias Block1,2
1Bernard and Irene Schwartz Center for Biomedical Imaging, Department of Radiology, New York University Grossman School of Medicine, New York University, New York, NY, United States, 2Center for Advanced Imaging Innovation and Research (CAI2R), Department of Radiology, New York University Grossman School of Medicine, New York University, New York, NY, United States

Synopsis

Keywords: Software Tools, Data Acquisition, Open-source

Motivation: Pulse-sequence development has been challenging due to high software complexity and limited documentation. Moreover, proprietary licenses make sharing developments difficult.

Goal(s): To provide an open-source solution based on modern software engineering principles that simplifies the design, implementation, and dissemination of sequences.

Approach: Our vendor-agnostic “mtrk” framework is based on a compact, human-readable descriptive language (SDL) in JSON format. SDL files can be generated with any programming language and can be played on MRI scanners or tested with simulators.

Results: Python libraries for SDL generation and tools for interactive sequence design and visualization are presented. mtrk sequences were equivalent to vendor sequences in experiments.

Impact: mtrk will lower the burden for students and researchers to develop and disseminate sequences. It will aid reproducible research, as developments can be publicly shared. Moreover, it will allow exploring innovative concepts such as remote calculation and cloud-driven “sequence-as-a-service” models.

Introduction

In the present generation of MRI systems, pulse sequences are defined and executed by compiled binary libraries that can be programmed using vendor-provided software development kits (SDKs). Their high complexity and the lack of proper documentation, however, pose a significant burden for students and researchers with limited software engineering experience. Moreover, the proprietary nature of the software makes sharing developments difficult. Both aspects have led to a slow translation of research outcomes into clinical practice in recent years.

In this work, we describe a novel open-source framework called mtrk, which aims to simplify both the development and dissemination of sequences. Similar to prior initiatives such as Pulseq1, SequenceTree2, and GammaStar3, mtrk detaches the sequence implementation from the vendor SDKs to enable cross-vendor use. In particular, mtrk relies on a compact and unopinionated descriptive language based on common web standards, which distinguishes mtrk from other frameworks. In addition to offering utmost flexibility regarding how sequences can be implemented, this approach enables novel paradigms such as remote, cloud-based, or adaptive sequence calculation.

Methods

Central to mtrk is the Sequence Description Language (SDL), which allows the formulation of sequences in the universal JSON format. Because JSON is supported by all programming languages and operating systems, generators and processing pipelines can be written using any language, including Python, C++, or Matlab. The SDL defines various control elements such as loops, blocks, and inline calculations. Therefore, sequence descriptions are compact and can be efficiently sent to an MRI scanner over TCP/IP connections. Moreover, SDL files are “human-readable” and can be manually edited for debugging purposes.

In the current version, a Python SDL generator library is provided, as well as a web-based GUI for inspecting timing diagrams (Figure 3). Furthermore, a graphical drag-and-drop tool exists that allows designing sequences interactively (Figure 4). Both GUIs were developed in JavaScript using the Plotly6 library and are connected to a Flask-based7 web service that runs the SDL generation. A driver binary has been developed for Siemens scanners using the IDEA SDK, which can load an SDL file and play the instructions on the scanner.

Figure 1 illustrates the typical mtrk workflow, in which a generator module calculates the sequence and creates the associated SDL file. This file, which includes all waveforms and timing information, can be executed on an MRI scanner using a generic driver library, or simulated with a Bloch simulator like JEMRIS4 or PSudoMRI/CAMRIE5. Figure 2 shows the structure of an SDL file. The generation can either be done on the MRI scanner, on a remote computer (e.g., institutional server), or using a cloud service. Hence, mtrk can also be utilized for implementing “sequence-as-a-service” concepts. Moreover, because SDL files are self-contained, sequences can be publicly shared in repositories or archived with raw data to aid image reconstruction.

To demonstrate feasibility, an mtrk implementation of the “MiniFLASH” (2D spoiled GRE) sequence was written in Python and compared to the IDEA equivalent using a 3T MAGNETOM Prisma scanner (VE11C). Images of an ACR resolution phantom were acquired with equal parameters for both sequences. A similar approach was used to test a 2D spin-echo sequence.

Results

Figure 5a compares images from both MiniFLASH implementations for an FOV of 2.3x2.3x5mm, an echo time of 10ms, and a repetition time of 20ms. Images of similar quality were obtained with both sequences. Figure 5b shows images acquired with both 2D spin-echo sequences (TE=70ms, TR=2s), which are comparable, although the Python version is still affected by minor artifacts (likely due to missing compensation of third-arm artifacts).

Discussion and conclusion

This work demonstrates a novel concept for simplifying sequence development and moving it toward modern software engineering principles. Instead of using compiled binary libraries, which are difficult to write and maintain, mtrk uses a human-readable descriptive language with a widely compatible, standardized format. This allows dividing the toolchain into small interoperable units that are easier to manage and makes sequence development agnostic to the programming language, operating system, and runtime environment. Due to the compact sequence representation, calculations can be distributed to centralized servers or cloud services, following the paradigm of decoupling acquisition design and scanner hardware8. Most importantly, major advantages exist for education and reproducible research, as sequences can be designed using graphical tools without required programming skills, tested through Bloch simulation without scanner access, and shared openly without vendor restrictions.

The functionalities described here represent a first prototype. Planned work includes the development of a comprehensive Python-based support library for sequence construction, an automated SDL testing suite, interfaces to common Bloch simulators, and scanner support for additional vendors.

Acknowledgements

This work was supported in part by the NIH R01 EB024536, and was performed under the rubric of the Center for Advanced Imaging Innovation and Research (CAI2R, www.cai2r.net), an NIBIB National Center for Biomedical Imaging and Bioengineering (NIH P41 EB017183).

References

1. Layton KJ, et al. Pulseq: a rapid and hardware‐independent pulse sequence prototyping framework. Magnetic Resonance in Medicine 2017;77(4):1544-1552.

2. Magland JF, Li C, Langham MC and Wehrli FW. Pulse sequence programming in a dynamic visual environment: SequenceTree. Magnetic Resonance in Medicine 2016;75:257-265.

3. Cordes C, Konstandin S, Porter D, Günther M. Portable and platform‐independent MR pulse sequence programs. Magnetic resonance in medicine 2020;83(4):1277-90.

4. Stöcker T, Vahedipour K, Pflugfelder D, Shah NJ. High‐performance computing MRI simulations. Magnetic resonance in medicine 2010;64(1):186-93.

5. Montin E, Carluccio G, Collins C, Lattanzi R. CAMRIE – Cloud-Accessible MRI Emulator. Proc. Intl. Soc. Mag. Reson. Med. 28 2020:1037.

6. https://plotly.com/

7. https://flask.palletsprojects.com/en/3.0.x/

8. Block KT. Data Platforms & Architecture. Proc. Intl. Soc. Mag. Reson. Med. 26 2018: Plenary Session “Challenging the Assumptions of MRI”.

Figures

The mtrk workflow, highlighting the flexibility in generating and interpreting an SDL file. (a) The concept of mtrk: generator modules are used to build pulse sequences using SDL files that can be read by emulators and actual scanners. (b) The current implementation of mtrk, including a Python tool and a Graphical User Interface (GUI) to generate SDL files, as well as a GUI to visualize the sequences and a driver sequence for Siemens scanners (IDEA VE11).

Structure of a sequence in the Sequence Description Language (SDL): different sections provide information about the SDL file (“file”), the sequence (“settings”), and the reconstruction (“info”), before defining the real-time events with their loop structure (“instruction”), and providing the supporting objects to be executed (“objects”) along with corresponding waveforms (“arrays”, “equations”).

Web-based user interface for visualizing sequence diagrams rendered from an SDL file. The GUI provides detailed information about each event and supports zooming, scrolling, and panning along the time axis. It has been implemented in JavaScript using the Plotly.js library.

Web-based user interface for interactive design of pulse sequences. Through an intuitive drag-and-drop feature, real-time events can be added to the sequence kernel and configured. Detailed parameters are provided for each event. Once the design is complete, the sequence is exported as an SDL file that can be plotted with the GUI shown in Figure 3 and executed on the scanner using the mtrk driver sequence.

Images of an ACR resolution phantom acquired on a Siemens Prisma 3T scanner using the mtrk driver sequence with two SDL files of two standard sequences and the comparable IDEA sequences. (a) Siemens “MiniFlash” test sequence (right) and its mtrk equivalent (left). The images are similar, with the same contrast and shape. (b) Siemens’ “se” (right) and mtrk spin-echo (left) sequences. The images show similarity, though minor artifacts can be observed in the mtrk implementation.

Proc. Intl. Soc. Mag. Reson. Med. 32 (2024)
4671
DOI: https://doi.org/10.58530/2024/4671