Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 11, No. 3, 2025 35 Multi‐channel Data Display Software based on fNIRS Guangmao Zhang, Jiabei Chen, Jing Yuan, Yunfei Ma * North China University of Science and Technology, Tangshan Hebei, 063210, China * Corresponding author: Yunfei Ma Abstract: This article is to introduce a based on functional near infrared spectroscopy (functionalNear - InfraredSpectroscopy, fNIRS) multichannel data show that the software design and development. According to QtDesigner and VisualStudioCode development, it can quickly calculate and analyze the digital signal sent by Teensy board, and carry out data conversion, real- time display waveform. According to the characteristics of near-infrared spectrum divergence in tissues, the light intensity change signal is converted into the change signal of oxygenated hemoglobin and oxygenated hemoglobin concentration according to the modified Lamberbier law, so as to realize the calculation of hemoglobin concentration, and on this basis, the extraction of low- frequency oscillation signal in blood oxygen concentration is completed. Provides a simple and stable software for changes in hemoglobin oxygenation ([HbO]) and reduction ([Hb]) signals and specific low frequency oscillation (sLFOs) data. Keywords: Functional Near Infrared Spectroscopy; Multi-channel; Data Display. 1. Introduction 1.1. Purpose of Writing Functional near infrared spectroscopy [1] (functionalnear - infraredspectroscopy fNIRS) by using the main components of the blood in 600-900 - nm near-infrared scattering, sleek and good for the brain activity oxyhemoglobin and DNA changes of the hemoglobin [2]. The technology has the advantages of non-invasive, portable and real-time monitoring, and has been widely used in brain function research, muscle fatigue detection and other fields. In recent years, with the continuous development of NIRS technology, its application in the detection of blood circulation abnormalities has gradually attracted attention. Therefore, it is of great significance to develop a software which is simple to operate and can visually see the real-time display of blood oxygen data waveform for promoting the improvement of medical equipment and the in-depth study and wide application of fNIRS technology. 1.2. Theoretical Implications (1) The fNIRS technique works by emitting two or more different wavelengths of near-infrared light into the interior of a tissue and measuring the intensity at which this light is received after passing through the tissue. Based on the Beer- LambertLaw, which states that the absorbance of a substance is proportional to the product of the substance's concentration and its optical path length, the concentration of oxygenated and deoxygenated hemoglobin in the tissue can be calculated [3]. Further, oxygen saturation can be calculated by the ratio of the concentration of oxygenated hemoglobin to the concentration of total hemoglobin (oxygenated hemoglobin + deoxygenated hemoglobin). (2) This software is developed according to QtDesigner and VisualStudioCode, which can quickly calculate and analyze the digital signal sent by Teensy board, perform data conversion, and display the waveform in real time. 1.3. Software Operating Environment (1) Hardware requirements Processor frequency: 2GHZ and above; Memory: 2G and above; (2) Software requirements System: windows10 64-bit system; Running environment: Anaconda3 2024.02-1(Python 3.11.7 64-bit) or later, Visual Studio Code 1.95.0 or later. 2. Overall Software Design 2.1. Software Technical Features This software is developed based on PyQt5, and uses QtDesigner in it to design UI interface, generate original uart_ui.ui file, and then import uart_ui.ui file into VisualStudioCode and convert it into uart_ui.py file. And the software functions are written in VisualStudioCode. The main_two.py file is the main interface thread, and the serial_thread.py file is the serial port thread, connecting the lower computer and the main interface thread. Finally, it is compiled by PyQt5's own compiler, and compiled into main_two.exe file that can be independently executed from PyQt5 environment, which can be used as long as it is installed in the computer, successfully reducing the operating environment requirements of this software and improving portability. The software has the characteristics of man- machine interaction, easy operation and stable operation on the user interface. After the software is opened, the user only needs to select the serial port to transmit data, click to open the serial port, display the waveform, and then click the adjustment button according to the displayed waveform as required, and the waveform change of blood oxygen concentration can be observed in real time. The software also has the function of clearing waveform and data saving, which runs stably and occupies little memory. The software is designed based on object-oriented programming method, which has strong portability and can realize function expansion. 2.2. Main Functions of the Software (1) Read and update the available serial port in real time, transmit parameters to the down-computer, and open the serial port. 36 Figure 1. Opening the serial port logic (2) to send data to the hardware device. Figure 2. Adjust the light intensity logic Figure 3. Open the anti-aliasing filter logic (3) to display the waveform in real time. Figure 4. shows the waveform logic (4) can save the data transmitted by the serial port to achieve data acquisition. Figure 5. Save data logic (5) The waveform can be cleared with one click to facilitate the collection of multi-person data. 2.3. Software Development Flow Chart Figure 6. Software flow chart 3. Software Function Description 3.1. Read User Input Parameter Function After opening the software, the user selects the serial port to transmit data, sets the required baud rate, clicks the "data collection" button, the main interface thread sends a signal to the serial port thread, and the serial port thread sends a message to the down-computer after receiving it, and opens the serial port. The signal content is the serial port number, baud rate and default data bit, stop bit and check bit selected by the user, each parameter corresponds to the function in the thread file, and the response speed is fast. The default data bit of the software is 8, the stop bit is 1, and the check bit is none. 3.2. Receive and Parse the Data After the serial port is opened and the response data is sent to the hardware, the hardware device will send data to the serial port. After receiving the data sent by the hardware, the serial port thread will analyze the data, and only save the last four data after the frame header "8af1" or "8af3" when the frame header is identified, the other data is discarded, and the four data left behind are one group, the first two are one group, the last two are one group. Divided into two sets of signals. After the parsing is completed in the serial port thread function file, the signal is sent to different functions in the main interface thread file and saved to different cache areas. 3.3. Real-time Display Waveform Among the seven channels, each channel data is divided into two groups, and two functions are set to display waveforms, and each function corresponds to a waveform. The display waveform function converts hexadecimal data to decimal by reading the data in the buffer, and the displayed waveform is updated every 50 milliseconds. When the waveform displays more than 200 data, only the recently updated 200 data is displayed. 37 3.4. Update the Light Intensity and Add Anti- Aliasing Filter When the data transmitted from the hardware is not processed, the waveform displayed will not be ideal, which is the need to send the corresponding data to the hardware to make the waveform display more accurate. Press the "Update Light intensity" button, the serial port thread will send byte type "9001" to the lower computer, so that the lower computer to adjust the light intensity; By pressing the "Anti-aliasing Filter" button, the serial thread sends a byte type "A001" to the lower machine to turn on the anti-aliasing filter of the lower machine. 3.5. Save Data If you need to collect the specific data of blood oxygen intensity, you can click the "Save Data" button to save the 14 groups of decimal data of seven channels respectively in the same directory of the software. 3.6. Clear Waveform If the user needs to collect multiple groups of data, then just click the "Clear waveform" button in the current interface, all the data waveforms of the previous group will be cleared, and the next group of data can be collected. 4. Software Instructions (1) Open the main_two.exe software, and the user environment will be initialized and configured. After the user environment is successfully initialized and configured, the software interface is displayed. As shown in Figure 7. Figure 7. Software interface (2) Click the port number drop-down box to select the serial port number to be connected, click the baud rate drop-down box to select the required baud rate. HEX mode is selected by default after the software is opened. Figure 8. Parameter Settings 38 (3) After setting the port parameters, click the "Data collection" button to open the serial port, and then click the "Show waveform" button to display the waveform. Since this software is set for the teensy board, after opening the serial port, it is necessary to click the "Display waveform" button to send data to the hardware device and make it start to transmit data before the waveform will be displayed. When more than 200 data are received in each group, the waveform is displayed as the last 200 data received, and the waveform is updated every 50 milliseconds. Figure 9. Waveform display (4) Double click "Update light intensity" button to adjust the light intensity of the teensy board to make the data more accurate; Double-click the "Anti-aliasing Filter" button to turn on the anti-aliasing filter of the teensy board, making the waveform smoother. Figure 6 shows the waveform of data change after double-clicking "Update light intensity", and Figure 7 shows the waveform display after double-clicking the "anti-aliasing filter" button. Figure 10. Update light intensity Figure 11. Turn on the anti-aliasing filter 39 (5) Click the "Save data" button to save the actual display value to the text document. The directory is the same as the path where the software is stored. Figure 12. Save data (6) Click the "Clear waveform" button, all the waveforms of the seven channels will be cleared, and all the data in the cache will be cleared, so save the data before clearing the data. Figure 13. all the waveforms of the seven channels will be cleared, and all the data in the cache will be cleared (7) Click the X button on the upper right of the software to exit the software. Figure 14. Exit the software 40 5. Summary In order to visualize the real-time display of blood oxygen data waveform, a multi-channel data display software based on functional near-infrared spectroscopy is designed. The core values of the research are: At the software level, QtDesigner and VisualStudioCode are used to develop, which can quickly calculate and analyze the digital signal sent by Teensy board, perform data conversion, and display the waveform in real time. Using an anti-aliasing filter, on the premise that the sampling frequency SF is fixed, filter out the frequency components higher than SF/2 through a low-pass filter with a high steepness to prevent the occurrence of aliasing phenomenon. To prevent the occurrence of aliasing phenomenon. In terms of signal processing, the physiological signals of blood perfusion and oxygenation can be effectively extracted based on Beer-Lambert law and bandpass filtering technology. Through the actual case test, the research scheme has the characteristics of low cost and high performance, which provides a new technical means for clinical research. In addition, the software has shown significant advantages in improving the efficiency of fNIRS data processing, promoting scientific research cooperation and result exchange, and provides strong support for the further promotion and application of fNIRS technology. Acknowledgments This research was supported by the 2024 National College Student Innovation and Entrepreneurship Training Program. The support of this project has enabled us to translate innovative ideas into practical projects and ensured the smooth development and advancement of our research. We would like to express our sincere gratitude for this support! (Project Name: NIRS-based peripheral arterial sclerosis blood circulation abnormality detection system; Project Number: 202410081027). References [1] Izzetoglu M, Bunce S C, Izzetoglu K, et al. Functional brain imaging using near-infrare technology[J]. IEEE Engineering in Medicine and Biology Magazine, 2007, 26(4): 38. [2] Liu Bao-gen, ZHOU Jing, LI Feifei. Functional Near infrared Spectroscopy (fNIRS), a new method for brain functional imaging [J]. Psychological Science,2011,34(04):943-949. [3] Chief editor Lu Yuguang. Instrumental analysis. China Medical Science and Technology Press, 2016. [4] Ying Huaiqiao, LIU Jinming, Shen Song, et al. Oversampling /BDFWPS "Anti-miscible" filter research and anti-miscible filter principle [C]// China High-tech Industrialization Research Association Signal Processing Industrialization Branch (Chip). Special issue of the first National Signal Processing Academic Conference and the Third Working Conference of the Preparatory Work Committee of the Signal Processing Branch of the China High-tech Industrialization Research Association. Beijing Dongfang Vibration and Noise Technology Research Institute, 2007:5.