Projects

mtrk - Sequence Development Framework

Duration:2020 - current
Technologies:C++, IDEA, Python, JavaScript
Collaborators:Anais Artiges, Amanpreet Singh Saimbhi
Website: mtrk-dev.github.io

mtrk is a novel concept for simplifying the development, application, and distribution of MRI pulse sequences, which is currently under active development. It aims to tackle the major limitation that pulse sequences for clinical MRI systems are typically programmed as compiled binary libraries, which are then executed on the MRI scanners to generate the DSP instructions. Such libraries can only be written using vendor-provided proprietary SDKs and need to be installed locally on each scanner. The vendor SDKs, unfortunately, are very complex, barely documented, and only in part accessible to researchers and external developers because all vendors currently adhere to a proprietary closed-source development model. This makes MRI sequence development very challenging, and it significantly affects the productivity of the whole research field. On the one hand, only few researchers in the community have the required skills to successfully work with the SDKs. Especially students and researchers without extensive experience in software development often struggle with the complexity of the code base and toolchain. On the other hand, frequent invasive changes to the vendor SDKs create significant maintenance effort within research departments and limit the time that researchers can devote to new developments. Furthermore, the strict license agreements that vendors enforce make dissemination of research developments difficult and contend with the idea of reproducible research. Goal of the mtrk framework is to change the current paradigm toward a modern and flexible open-source model for MRI sequence development.

Core element of mtrk is the Sequence Description Language (SDL), which is a formalism based on the commonly used JSON syntax to describe the events that the MRI scanner must execute when running a sequence. The SDL language is by design un-opinionated, meaning that multiple ways for formulating the same sequence exist. Moreover, the SDL language makes no assumption on how the SDL description should be generated. This gives researchers the freedom of choice regarding which language or toolset they want to use for their projects. In most cases, mtrk SDL files are created using a small generator program provided by the sequence developer. Any programming language can be used for such generator programs, as all modern languages can process JSON files. Some researchers might prefer MATLAB for implementing the sequence calculation, while others might prefer Python, Julia, or C/C++. Offering this flexibility and, in particular, supporting fully open-source toolchains is a key principle of mtrk and distinguishes the project from other sequence frameworks that still depend on commercial software.

Generator programs can either be provided as command-line tool, stand-alone software, or even as web service. Because the SDL language is based on a common text-based format (JSON), the sequence calculation can be done on any operating system and on any computer, ranging from the MRI scanner’s console computer, over local research servers, to cloud instances. This ability to calculate sequences on remote computers breaks away from the traditional paradigm that all acquisition logic must be installed and managed locally on the MRI system and offers tremendous opportunities for improved fleet management, workflow optimization, and dissemination of innovations (“sequence as a service”). To deliver remotely calculated sequences with sufficient speed and reliability, a compact protocol is required that is suited for efficient transfer over TCP/IP connections. For this reason, the SDL language diverges from the format introduced by the Pulseq project, which can become very large for real-world clinical scan protocols. The SDL format instead provides flow-control elements such as loops, conditional blocks, and equations, and it also provides a concept for adapting sequences dynamically during runtime (if needed for real-time scanning applications). Moreover, the SDL format is human-readable (and even patchable by hand), which simplifies debugging of sequences.

When executing an mtrk sequence, the MRI scanner unrolls the sequence description from the SDL file into a timeline and plays out the event stream. This is done by the mtrk Driver Sequence, which uses the vendor-provided SDK to translate the events into DSP instructions. Thus, the sequence logic is entirely defined by the SDL file and independent from the specific MRI software version used during data acquisition, which eliminates the need to refactor sequences for every software update installed on the MRI scanner. It also makes it possible to reproduce scientific results at later time or at different imaging sites because the SDL file is decoupled from the vendor SDK and can be archived or openly shared (e.g., in public Git repositories) without violating license agreements.

The mtrk concept also adds transparency. Because all events and waveforms can be read from the SDL file, exact sequence simulations can be performed by running the instructions against a Bloch simulator, which enables automated testing and quality control of sequences. Furthermore, part of the sequence-development work can be shifted from sitting in front of an actual MRI scanner towards simulation-driven development. This is in stark contrast to the current situation with clinical MRI scanners, where compiled sequence binaries are basically “black boxes” that obscure the information on how sequence settings translate into DSP instructions. Therefore, it is, for example, impossible to determine if pulse shapes or timing schemes have changed after software updates, which introduces uncertainties when scanner updates are installed during ongoing clinical studies. Such issues are all avoided with the open mtrk sequence model.