3753

MRSequoia: A novel tool for MR sequence design, prototyping and validation.
Sebastian Hirsch1,2 and Stefan Hetzer1,2
1Berlin Center for Advanced Neuroimaging, Charité - Universitätsmedizin Berlin, Berlin, Germany, 2Bernstein Center for Computational Neuroscience, Berlin, Germany

Synopsis

MRSequoia is a novel open-source framework to aid MR sequence developers in the design, prototyping and validation of MR sequences. It can import the Siemens IDEA simulator output, and construct an abstract sequence timing from it, allowing for visualization of various aspects of the timing, as well as running custom or pre-defined timing checks. Furthermore, the timing can be exported to MRiLab for accurate spin-physics simulations, ensuring that identically the same timing is used in the simulation and on the scanner. MRSequoia is freely available and can easily be modified and extended thanks to its modular and object-oriented design.

Introduction

Traditionally, design and implementation of new MRI sequences has been subdivided into two parts, with the first part consisting of designing the sequence timing and possibly simulating it in a numerical spin physics simulator, such as MRiLab.1 The second part is implementation of the sequence in a vendor-specific sequence development environment and testing the validity and safety of the implementation. However, those two steps are usually performed separate from each other, and there is no strong link between them. For example, implementation for a specific scanner will depend on hardware limits and discretization, which is not necessarily accounted for in the spin simulation step. Existing projects, such as Pulseq2, have tried to solve this issue by designing a platform-independent sequence design language that can be used both for execution of the sequence on the scanner as well as for spin physics simulations. In this work, we present a different approach, which allows us to import the actual sequence timing as it would be executed in the scanner into MRiLab by means of a novel software framework, MRSequoia (https://gitlab.com/sebastiancervus/mrsequoia). MRSequoia is an open-source program written entirely in Python and based on JupyterLab, Numpy, Scipy and Matplotlib. It can import vendor-specific output of an MR sequence simulator (thus far, only Siemens IDEA is supported, but other vendors can easily be integrated) into an abstract representation of the timing, based on lists of sequence atoms (GradientAtom, TXAtom, ADCAtom, etc.). One can easily implement checks to validate the timing, such as checking that TR is consistent across all shots. Due to its use of JupyterLab, visualization of the sequence timing or waveforms underlying individual sequence atoms can be easily achieved. Furthermore, the sequence timing, including all gradient and RF pulse waveforms, can be exported into an XML-based file format that can be read by MRiLab. Therefore, the simulation that is subsequently performed in MRiLab is based on the exact timing as it would be executed on the scanner, and not an approximation of it. Further features of MRSequoia include an acoustic spectrum analyzer and an interface to assemble MR sequences from custom or pre-defined blocks with only a few lines of Python code based on a tree representation, similar to the approach used in previous projects.3,4,5

Methods

To demonstrate and evaluate the capabilities of MRSequoia, the following steps were performed:
  1. The timing of a simple segmented spin-echo sequence (2 mm isotropic resolution, acquisition matrix 128×128, TE=15 ms, TR=5000 ms) was simulated in the Siemens IDEA sequence simulator. The timing was imported into MRSequoia from the text files output by the simulator. As an example for sequence validation, a check for consistent repetition time across all shots was performed.
  2. For visual inspection, the sequence timing was plotted using MRSequoia’s visualization facility.
  3. An analysis of the acoustic spectrum of the sequence was performed; this can be helpful in avoiding mechanical resonances on the scanner.
  4. The sequence timing was converted to a format readable by MRiLab via MRSequoia’s MRiLabExporter facility, and a spin physics simulation was performed on MRiLab's standard brain phantom (spatial resolution: 2 mm).

Results

The results of steps 1-4 are shown in Figs. 1-4, along with the code required to perform these steps.

Discussion

The steps 1-4 are essential parts of designing and implementing an MR sequence. To date, most of these steps are performed in a disconnected way, requiring the developer to carry out redundant work, such as implementing the sequence timing within MRiLab for spin physics simulation and a second time in a proprietary sequence development environment for the scanner. This allows for the introduction of errors and discrepancies between the simulated and implemented sequences. MRSequoia has been conceived to unify this process, by automating the import of the exact timing of the sequence, as it would run on the scanner, and to perform validity checks, acoustic analysis and spin physics simulations (via MRiLab) on this timing. This serves both as an accelerator by reducing the amount of redundant work, as well as to reduce the chance of errors while at the same time facilitating finding potential errors, since they would occur not only on the scanner, but also in the MRiLab simulation. Custom tests or any aspect of the sequence timing can be implemented with a few lines of Python code by deriving from the CheckBase class or one of the pre-defined checks.

Conclusion

MRSequoia is an emerging versatile instrument to aid sequence developers in designing, prototyping and validating MR sequences. For ease of use, the distribution contains a Dockerfile and scripts to build and deploy a Docker container, thus obviating the need to install any additional software. Due to its open-source nature and modular object-oriented architecture it can be easily extended to support more MR vendors or implement more features.

Acknowledgements

The authors would like to thank Max Müller from UK Erlangen for valuable feedback and suggestions.

References

  1. Liu, F., Velikina, J. V., Block, W. F., Kijowski, R., & Samsonov, A. A. (2017). Fast Realistic MRI Simulations Based on Generalized Multi-Pool Exchange Tissue Model. IEEE Transactions on Medical Imaging, 36(2), 527–537.
  2. Layton, K. J., Kroboth, S., Jia, F., Littin, S., Yu, H., Leupold, J., … Zaitsev, M. (2017). Pulseq: A rapid and hardware-independent pulse sequence prototyping framework. Magnetic Resonance in Medicine, 77(4), 1544–1552.
  3. Jochimsen, T. H., & Von Mengershausen, M. (2004). ODIN - Object-oriented Development Interface for NMR. Journal of Magnetic Resonance, 170(1), 67–78.
  4. Magland, J. F., Li, C., Langham, M. C., & Wehrli, F. W. (2016). Pulse sequence programming in a dynamic visual environment: SequenceTree. Magnetic Resonance in Medicine, 75(1), 257–265.
  5. Stöcker, T., Vahedipour, K., Pflugfelder, D., & Shah, N. J. (2010). High-performance computing MRI simulations. Magnetic Resonance in Medicine, 64(1), 186–193.

Figures

Code to import the sequence timing from the Siemens IDEA simulator output and to perform a check that TR is consistent across all shots. The selector extracts all RF pulses (represented by class TXAtom) with a flip angle of 90°. The check then consists in verifying that the temporal spacing between subsequent pulses is constant. The output of the tests indicates that 129 such TX pulses were found (one dummy + 128 phase-encode shots), and that all of them are spaced 5 seconds apart, thus indicating success of the test.

Visualization of one shot of the spin-echo sequence using MRSequoia’s built-in visualizer. Zooming and panning can be achieved with the two sliders or the buttons adjacent to it. In the table underneath, information about the sequence atoms at the position of the vertical blue line at the center of the plot is displayed.

The acoustic spectra of the imaging gradients on all three axis, in time-frequency representation (left) and in the frequency domain. Due to the long repetition time, most of the energy is contained in the range below 200 Hz. The code to generate these plots from a sequence timing object, st, is shown on top.

Result of the simulation performed using MRiLab after converting the sequence timing in MRSequoia.

Proc. Intl. Soc. Mag. Reson. Med. 29 (2021)
3753