A Library for fMRI Real-Time Processing Systems in Python (RTPSpy) With Comprehensive Online Noise Reduction, Fast and Accurate Anatomical Image Processing, and Online Processing Simulation - Misaki, Masaya; Bodurka, Jerzy; Paulus, Martin P. (Frontiers in Neuroscience, 2022)
Real-time fMRI (rtfMRI)has enormous potential for both mechanistic brain imaging studies or treatment-oriented neuromodulation. However, the adaption of rtfMRI has been limited due to technical difficulties implement an efficient computational framework. Here, we introduce a python library for real-time fMRI (rtfMRI) data processing systems, Real-Time Processing System in python (RTPSpy), to provide building blocks for a custom rtfMRI application with extensive and advanced functionalities. RTPSpy is a library package including 1) a fast, comprehensive, and flexible online fMRI image processing modules comparable to offline denoising, 2) utilities for fast and accurate anatomical image processing to define an anatomical target region, 3) a simulation system of online fMRI processing to optimize a pipeline and target signal calculation, 4) simple interface to an external application for feedback presentation, and 5) a boilerplate graphical user interface (GUI) integrating operations with RTPSpy library. The fast and accurate anatomical image processing utility wraps external tools, including FastSurfer, ANTs, and AFNI, to make tissue segmentation and region of interest masks. We confirmed that the quality of the output masks was comparable with FreeSurfer, and the anatomical image processing could complete in a few minutes. The modular nature of RTPSpy provides the ability to use it for a simulation analysis to optimize a processing pipeline and target signal calculation. We present a sample script for building a real-time processing pipeline and running a simulation using RTPSpy. The library also offers a simple signal exchange mechanism with an external application using a TCP/IP socket. While the main components of the RTPSpy are the library modules, we also provide a GUI class for easy access to the RTPSpy functions. The boilerplate GUI application provided with the package allows users to develop a customized rtfMRI application with minimum scripting labor. The limitations of the package as it relates to environment-specific implementations are discussed. These library components can be customized and can be used in part. Taken together, RTPSpy is an efficient and adaptable option for developing rtfMRI applications. The package is available from GitHub (https://github.com/mamisaki/RTPSpy) with GPL3 license.