Federico Turco1 and Johannes Slotboom1
1Institute for Diagnostic and Interventional Neuroradiology, Support Center for Advanced Neuroimaging (SCAN), University of Bern, Bern, Switzerland
Synopsis
Keywords: Data Processing, Data Processing, Optimization, Torch, Auto-differentiation.
Motivation: Addressing the time constraints in Magnetic Resonance Spectroscopy (MRS) metabolite quantification, TensorFit aims to overcome processing delays hindering clinical use.
Goal(s): TensorFit seeks to accelerate MRS analysis with a strong focus in time efficiency, using GPU acceleration, and modeling capabilities within the Torch framework.
Approach: Implemented in Python, employs Torch for efficient forward- and back-propagation, allowing rapid quantification of large datasets. It supports GPU usage, and integration with SpectrIm-QMRS for clinical practices.
Results: TensorFit achieves speed-ups surpassing existing methods by up to 200x on GPU and 17x on CPU, making it a powerful tool for metabolite quantification in EPSI data.
Impact: TensorFit speed-up MRS metabolite quantification in clinical practices, enabling ultra-fast analysis. This tool could lead to enhance the use of high-resolution MRS adquisition for both research and clinical practices.
Introduction
Metabolic analysis with Magnetic Resonance Spectroscopy (MRS) holds immense clinical potential, yet challenges like prolonged processing times hinder its adoption. Many software solutions exist for metabole quantification1,2,3, with differences in the fitting model, minimization algorithm, and fitting domain. Nevertheless, none is focused on time efficiency nor keeping up with the necessity of speed for new high-resolution MRSI acquisitions4.5. Most implementations are single-threaded or, in the best cases, parallelized on the CPU. We present an open-source metabolite quantification tool (TensorFit) with a strong focus on time efficiency, using GPU capabilities to accelerate the quantification of large datasets.Methods
TensorFit is implemented using the Torch (version>=v1.13) framework in Python (version>v3.10). The fitting was implemented as a Torch computational graph, allowing high freedom in the spectral modeling. This design permits efficient forward- and back-propagation within the computational graph for error minimization. The choice of Torch was driven by its capacity to handle complex formulas (and complex values), incorporate automatic differentiation, support diverse minimization algorithms, and allow dynamic modification of the computational graph during quantification. TensorFit can be used stand-alone with a command line for research purposes or as part of SpectrIm-QMRS
6 when working in clinical settings.The stand-alone version uses the fsl-mrs
7 library to manage the basis sets and the data load. This implies the capability of reading NIfTI-MRS, RAW files from LCModel
1, and .txt files from JMRUI
8. It also supports reading fsl-mrs, jmrui, and LCModel basis format.When working with SpectrIm, this last takes the load of managing the DICOM files and communicates through a localhost port with TensorFit when the quantification is needed. The quantification results are returned in the same way for the visualization and further analysis in the SpectrIm environment. The supported model and basis are defined within SpectrIm. Future releases will aim to support the same range of data input and basis as the stand-alone version.
Features:
- The quantification supports fitting Lorentzian, Gaussian, and Voight lineshapes, allowing definitions of groups and prior-knowledge.
- It supports the use of any (NVIDIA) GPU compatible with CUDA 11.6 or bigger and is compatible across majors operative systems.
- Allows selection of regions of interest for fitting.
- Supports defining boundaries for the free parameters (Does not support other types of constraints)
- It fits baselines using p-splines based on ABFit9.
The source code for this implementation will be available at https://github.com/TuchoTurco/TensorFit.
Results
The current implementation of TensorFit obtained speed-up above 200x with respect to TDFDFit10 and 140x faster than QUEST3 when performing the minimization on the GPU (values obtained on a Nvidia GTX 1060 8GB, CUDA 11.7). When running on a CPU (AMD Ryzen 7 2700X), we obtained a speed-up factor of 17x and 11x. This speed-up corresponds to a total time under 30 seconds to quantify a full MRSI dataset containing 7098 spectra, fitting 15 metabolites, with a baseline consisting of 57 splines. On the named GPU, the implementation could fit up to 47000 spectra simultaneously before running out of memory. More voxels can be fitted in two batches.Discussion
TensorFit presents a notable advancement in processing speed by using the Torch framework to quantify multiple spectra simultaneously. Its implementation as a Torch computational graph enables dynamic modeling and efficient error minimization. The software can be used in command-line or integrated with SpectrIm-QMRS for properly managing clinical data. Offering support for various lineshapes, prior-knowledge, and GPU acceleration. TensorFit obtains a strong speed, surpassing existing methods by significant margins.Conclusions
We implemented an ultra-fast tool for metabolite quantification that takes advantage of Torch auto-differentiation and its GPU capabilities. We obtain a strong acceleration above 150 times faster than other standard algorithms on a low-end GPU. We believe this tool will enhance the use of EPSI sequences by enabling almost immediate metabolite quantification.Acknowledgements
The project leading to this application has received funding from the European Union’s Horizon 2020 research and innovation programme under the MarieSklodowska-Curie grant agreement No 813120References
1) Provencher Stephen W. Estimation of metabolite concentrations from localized in vivo proton NMR spectra. Magneticresonance in medicine. 1993;30(6):672–679.
2) Wilson Martin, Reynolds Greg, Kauppinen Risto A, Arvanitis Theodoros N, Peet Andrew C. A constrained least-squaresapproach to the automated quantitation of in vivo 1H magnetic resonance spectroscopy data. Magnetic resonance inmedicine. 2011;65(1):1–12.
3) Ratiney H, Sdika Micha ̈el, Coenradie Y, Cavassila S, Ormondt D van, Graveron-Demilly D. Time-domain semi-parametricestimation based on a metabolite basis set. NMR in Biomedicine: An International Journal Devoted to the Developmentand Application of Magnetic Resonance In vivo. 2005;18(1):1–13.
4) Weng Guodong, Radojewski Piotr, Sheriff Sulaiman, et al. SLOW: A novel spectral editing method for whole-brain MRSIat ultra high magnetic field. Magnetic resonance in medicine. 2022;88(1):53–70.13.
5) Klauser Antoine, Strasser Bernhard, Bogner Wolfgang, et al. ECCENTRIC: a fast and unrestrained approach for high-resolution in vivo metabolic imaging at ultra-high field MR. arXiv preprint arXiv:2305.13822. 2023;.
6) Barros Nuno, McKinley Richard, Knecht Urspeter, Wiest Roland, Slotboom Johannes. Automatic quality control in clinical1H MRSI of brain cancer. NMR in Biomedicine. 2016;29(5):563–575.
7) Clarke WT, Stagg CJ, Jbabdi S. FSL-MRS: An end-to-end spectroscopy analysis package. Magn Reson Med. 2021;85(6):2950-2964. doi:10.1002/mrm.28630
8) Naressi A, Couturier Chantal, Castang I, De Beer R, Graveron-Demilly Danielle. Java-based graphical user interface forMRUI, a software package for quantitation of in vivo/medical magnetic resonance spectroscopy signals. Computers inbiology and medicine. 2001;31(4):269–286.
9) Wilson, Martin. "Adaptive baseline fitting for MR spectroscopy analysis." Magnetic Resonance in Medicine 85.1 (2021): 13-29.
10) Wilson, Martin. "Adaptive baseline fitting for MR spectroscopy analysis." Magnetic Resonance in Medicine 85.1 (2021): 13-29.