Electrocardiosignal interactive processing system based on multi-scale analysis and parameter regulation and control
The interactive ECG signal processing system, which utilizes multi-scale analysis and parameter control, solves the problems of decreased signal-to-noise ratio and blurred pathological waveforms in ECG signal preprocessing. It achieves high-quality signal input, improves the detection accuracy and reliability of deep learning models, and adapts to the needs of multiple scenarios in clinical practice and scientific research.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHENGZHOU UNIVERSITY OF AERONAUTICS
- Filing Date
- 2026-02-02
- Publication Date
- 2026-05-12
AI Technical Summary
Existing ECG signal preprocessing techniques are ill-suited to the differences in signal characteristics across different leads and individuals, leading to a decrease in signal-to-noise ratio, blurring of key pathological waveforms, and inaccurate feature extraction by deep learning models, thus affecting the reliability of intelligent diagnosis.
An interactive ECG signal processing system employing multi-scale analysis and parameter control includes a visualization information display module, a lead trimming and adjustment module, a differential preprocessing module, and a file management module. It achieves dynamic adaptive ordinate adjustment, differential filtering, and secure and efficient file management, supports single-lead/multi-lead/all-lead differential filtering, dynamically generated noise reduction filters, and dual-window cascaded correction of baseline drift layers.
It improves the signal-to-noise ratio of the signal, ensures the complete presentation of key pathological waveforms, enhances the detection accuracy and generalization ability of deep learning models, reduces operational complexity, ensures data security and traceability, and adapts to the needs of multiple scenarios.
Smart Images

Figure CN122019978A_ABST
Abstract
Description
Technical Field
[0002] This invention belongs to the field of biological signal processing and medical signal analysis technology, and relates to an interactive electrocardiogram signal processing system based on multi-scale analysis and parameter regulation. Background Technology
[0004] Cardiovascular disease, as the leading cause of death and disability worldwide, has become a major public health problem seriously threatening human health. With the accelerating aging of the population and changes in lifestyle, the incidence and mortality rates of cardiovascular diseases such as hypertension, coronary heart disease, and arrhythmia continue to rise. According to data from the *China Health Statistics Yearbook 2023*, in 2021, cardiovascular disease mortality ranked first among urban and rural residents in some regions of my country. Therefore, early and timely intervention and precise treatment of these diseases are crucial. Electrocardiography (ECG), with its advantages of being real-time, non-invasive, and low-cost, has become a core routine method for arrhythmia detection. By recording the bioelectrical changes generated by the successive excitation of the pacemaker, atria, and ventricles in each cardiac cycle, it can directly reflect various pathophysiological states of the heart, such as rhythm, conduction, myocardial ischemia, and myocardial hypertrophy. It is one of the most basic and widely used examination methods in clinical cardiovascular disease diagnosis.
[0005] In recent years, deep learning technology has demonstrated tremendous potential in the field of intelligent arrhythmia detection due to its powerful automatic feature extraction and pattern recognition capabilities, providing a new approach to address the pain points of low efficiency, high subjectivity, and high rates of missed and misdiagnosed diagnoses associated with manual ECG analysis in clinical settings. Deep learning-based arrhythmia detection models can be trained on large amounts of labeled ECG data to achieve rapid identification and classification of abnormal rhythms such as atrial fibrillation, premature ventricular contractions, and myocardial infarction, and are expected to become an important auxiliary tool for primary healthcare institutions and large-scale population screening. However, the detection accuracy and generalization ability of deep learning models are highly dependent on the quality of the input ECG signal. In current clinical practice, ECG signals are easily affected by noise such as electromyography interference, power frequency interference, and baseline drift. Moreover, there are significant differences in signal characteristics between different leads and individuals, leading to a decrease in the signal-to-noise ratio of the original signal and blurring of key pathological waveforms. Furthermore, the limitations of existing preprocessing techniques further restrict model performance. The visualization process uses a static scale, which is prone to waveform compression or truncation due to changes in signal amplitude, making it impossible to fully preserve details. Preprocessing often uses a "uniform" fixed filtering mode, which is difficult to adapt to the differentiated characteristics of signals. Parameter adjustment and data security are difficult to balance, and there is a lack of real-time preview and processing comparison functions. These problems all lead to inaccurate feature extraction and insufficient abnormality detection rate of deep learning models, seriously affecting the reliability of intelligent diagnosis and its clinical translation effect.
[0006] Therefore, this system provides a comprehensive solution integrating dynamic adaptive visualization, differentiated filtering, and secure and efficient file management. It achieves deep integration of signal preprocessing and interactive design, and uses a multi-segment extreme value fusion algorithm to achieve adaptive adjustment of the vertical coordinate, ensuring complete presentation of signal details. Simultaneously, the multi-scale analysis system constructs an independent lead parameter storage space, supports single-lead / multi-lead / all-lead differentiated filtering, adopts a hierarchical processing architecture, dynamically generates filters through noise reduction windows, and performs dual-window cascade correction of baseline drift, achieving fine-grained control of "one lead, one parameter." This provides high-quality, high-reliability signal input for deep learning models, thereby improving the accuracy and generalization ability of intelligent arrhythmia detection, providing strong support for the precise diagnosis and research of cardiovascular diseases, and possessing significant clinical and research application value. Summary of the Invention
[0008] To address the aforementioned problems, this invention proposes an interactive electrocardiogram signal processing system based on multi-scale analysis and parameter control, which effectively solves the problems in the prior art.
[0009] To achieve the above objectives, the technical solution adopted by the present invention is as follows: an interactive ECG signal processing system based on multi-scale analysis and parameter control, comprising a visualization information display module, a lead trimming and adjustment module, a differential preprocessing module, and a file management module. The visualization information display module is used to intuitively display ECG signals through leads. The lead trimming and adjustment module is used to trim and adjust the ECG signals in the visualization information display module. The differential preprocessing module is used to perform differential processing and noise reduction on the ECG signals trimmed and adjusted by the lead trimming and adjustment module for different leads. The file management module is used to switch, store, and reset ECG signal files in the recording system and to use logs to record the process of processing ECG signal files.
[0010] Furthermore, the visualization information display module includes a 12-lead independent plotting system built on Matplotlib and an information display module;
[0011] The 12-lead independent plotting system uses a 12-row, 1-column subplot layout to correspond to leads I, II, III, aVR, aVL, aVF, and V1-V6 respectively. Each lead is assigned an independent plotting area and configured with a dedicated X / Y axis coordinate system.
[0012] The information display module includes a layered parsing and rendering module that integrates three core types of information: file name, patient diagnosis information, and electrocardiogram signal, and implements event-driven dynamic updates. It parses and displays the current file name, processing progress, and patient clinical information in real time. It accurately extracts patient information from the HEA annotation file and completes the Chinese-English mapping conversion of the diagnosis name and the signal technical parameter dimension. It automatically calculates and displays the total signal duration based on the number of sampling points and the sampling rate.
[0013] Furthermore, in the X / Y axis coordinate system, the X-axis is uniformly defined as the time axis, and the Y-axis represents the signal amplitude.
[0014] Furthermore, the lead clipping and adjustment module includes a lead clipping module and a ordinate adjustment module;
[0015] The lead clipping module accurately marks the clipping time period using a red and blue dual-color semi-transparent mask;
[0016] The ordinate adjustment module adopts a real-time adaptive mechanism, relying on a multi-segment signal extreme value fusion algorithm to calculate the maximum and minimum values of the signal in the clipping area of each lead in real time, automatically add 10% edge white space, and immediately refresh the ordinate range of the corresponding lead when the clipping time and filtering parameters are adjusted.
[0017] Furthermore, the differential preprocessing module employs a dual median filter layered application, including a denoising layer and a baseline drift removal layer;
[0018] The denoising layer generates an odd-kernel-size filter based on a specified window of 0 to 0.1 seconds;
[0019] The baseline drift removal layer is achieved through a dual-window cascaded median filter.
[0020] Furthermore, the differentiated preprocessing module supports two modes: "all leads" and "single lead" with parameters that do not interfere with each other. The "all leads" mode adjusts all leads uniformly, while the "single lead" mode adjusts only the selected lead. When switching leads, the current lead parameter configuration is automatically saved, and when switching back, historical parameters are loaded.
[0021] Furthermore, in the baseline drift removal layer, window 1 is a coarse baseline estimation of 0.1 to 0.5 s, and window 2 is a fine correction of 0.3 to 1.0 s, which can be adjusted for different lead drift characteristics.
[0022] Furthermore, the denoising function and baseline drift removal function in the lead trimming and adjustment module are equipped with independent checkboxes, which can be turned on and off individually to meet the three processing modes of "denoising only", "baseline removal only" and "both on", and the filter switch status can be configured independently for any single lead or all leads in the 12 leads.
[0023] Furthermore, the file management module includes a reset saving module for saving reset ECG signal files, a file navigation module for file navigation operations, and a log recording module for establishing a full-process operation log recording system.
[0024] Furthermore, the reset and save module has a multi-format synchronous processing function.
[0025] Compared with the prior art, the present invention has the following beneficial effects:
[0026] (1) This invention breaks through the limitations of traditional unified filtering and innovatively adopts a single-lead / multi-lead / full-lead differentiated preprocessing mechanism and a dual median filtering layered denoising technology. Combined with the refined control mode of "one lead, one parameter", it can specifically adapt to the noise distribution and baseline drift characteristics of different leads, achieve precise suppression of high-frequency noise such as electromyography and power frequency, and stable correction of baseline drift, so as to improve the signal-to-noise ratio of each lead. Through the 12-lead independent visualization system and dynamic adaptive vertical coordinate adjustment mechanism, coupled with the 10% edge blanking algorithm, the signal compression and truncation problems caused by static scale are completely avoided, ensuring that the key pathological waveform details such as QRS complex, P wave, T wave and ST segment deviation are fully presented, providing high-quality true signal input for clinical diagnosis and feature extraction of deep learning models.
[0027] (2) The operation process of this invention is efficient and convenient, reducing the threshold for clinical and scientific research use. At the visualization level, it constructs a 12-lead independent drawing and hierarchical information display system, and simultaneously presents signal waveforms, patient clinical data (age, gender, diagnosis results) and technical parameters (total duration, sampling rate). The cropping function accurately marks the range through a two-color semi-transparent mask, which is intuitive and does not obscure details, and the operation is intuitive and easy to understand. In terms of parameter control, it supports independent start and stop of the filtering function, flexible adjustment of window parameters, and automatic saving of historical parameters when switching leads to avoid repeated settings. The file jump function supports quick switching and accurate matching and positioning. The one-click reset function can quickly restore the initial state of the system, reduce the cost of operation errors, and adapt to clinical rapid screening and scientific research batch data processing scenarios.
[0028] (3) The data security of this invention is controllable and the processing process is traceable. By establishing a read-only protection mechanism for the original signal, all filtering and trimming operations are performed based on the signal copy, thus avoiding data pollution from the source. The full-process operation log system records the timestamp, operation type, object and result in detail, and supports the retention and automatic scrolling of the most recent 50 logs. With the real-time prompts in the bottom status bar, the operation is traceable and the problem can be located, which meets the requirements of clinical data management standards. The save function supports the synchronous output of MAT / HEA files and automatically updates the data information after trimming to ensure file consistency. The three-level processing strategy of "replace / save as / cancel" for full conflict detection before saving can effectively eliminate the risk of data overwriting and ensure the integrity of scientific research data and the security of clinical data.
[0029] (4) The system of this invention is built on the Python language ecosystem, is compatible with mainstream ECG data formats, and can seamlessly connect with the output of clinical ECG equipment and the scientific research data analysis process, adapting to the needs of multiple scenarios such as data preprocessing in hospitals and research institutions. It provides high-quality, standardized datasets for deep learning model training, promotes the research and development and clinical translation of intelligent ECG diagnostic technology, and has significant practical value and promotion prospects. Attached Figure Description
[0031] Figure 1 This is a flowchart of the procedure for this invention;
[0032] Figure 2 This is a functional interface diagram of the present invention. Detailed Implementation
[0034] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0035] Example 1
[0036] An interactive ECG signal processing system based on multi-scale analysis and parameter control includes a visualization information display module, a lead trimming and adjustment module, a differential preprocessing module, and a file management module. The visualization information display module is used to intuitively display ECG signals through leads. The lead trimming and adjustment module is used to trim and adjust the ECG signals in the visualization information display module. The differential preprocessing module is used to perform differential processing and noise reduction on the ECG signals trimmed and adjusted by the lead trimming and adjustment module for different leads. The file management module is used to switch, store, and reset ECG signal files in the recording system and to use logs to record the process of processing ECG signal files.
[0037] In this embodiment, the visualization information display module includes a 12-lead independent plotting system built on Matplotlib and an information display module;
[0038] The 12-lead independent plotting system uses a 12-row, 1-column subplot layout to correspond to leads I, II, III, aVR, aVL, aVF, and V1-V6 respectively. Each lead is assigned an independent plotting area and configured with a dedicated X / Y axis coordinate system.
[0039] The information display module includes a layered parsing and rendering module that integrates three core types of information: file name, patient diagnosis information, and electrocardiogram signal, and implements event-driven dynamic updates. It parses and displays the current file name, processing progress, and patient clinical information in real time. It accurately extracts patient information from the HEA annotation file and completes the Chinese-English mapping conversion of the diagnosis name and the signal technical parameter dimension. It automatically calculates and displays the total signal duration based on the number of sampling points and the sampling rate.
[0040] In this embodiment, the X-axis in the X / Y axis coordinate system is uniformly the time axis, and the Y-axis is the signal amplitude.
[0041] In this embodiment, the lead clipping and adjustment module includes a lead clipping module and a ordinate adjustment module;
[0042] The lead clipping module uses a red and blue dual-color semi-transparent mask to accurately mark the clipping period, which clearly identifies the clipping range without obscuring the core details of the signal;
[0043] The ordinate adjustment module employs a real-time adaptive mechanism, relying on a multi-segment signal extreme value fusion algorithm to calculate the maximum and minimum values of the signal within the clipping region of each lead in real time, automatically adding 10% margin. First, it filters invalid values (Nan) from the selected target ECG signal segment (initialized to full duration by default). If all signals in the lead are Nan, it outputs the default ordinate range to obtain the set of valid values. ,like Then calculate the global extrema of the ECG signal; then calculate the amplitude range of the ECG signal. Then, calculate the visual white space value based on the amplitude span. The final output is the vertical axis range of the visualized electrocardiogram signal. ;
[0044] The calculation method is shown in the following formula:
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052] in, For the selected target ECG signal segment
[0053] When the clipping time and filtering parameters are adjusted, the vertical coordinate range of the corresponding lead is immediately refreshed. This addresses the pain points of large differences in signal amplitude between different leads and the easy obscuring of local details. It enables dynamic adjustment of the vertical coordinate at the lead level, ensuring that the signal shape after clipping is intuitively visible and the details are clearly presented. This allows the visualization effect to adapt synchronously with the parameter adjustment.
[0054] In this embodiment, the differential preprocessing module employs a dual median filter layered application, including a denoising layer and a baseline drift removal layer;
[0055] The denoising layer generates an odd-sized filter based on a specified window of 0 to 0.1 seconds (the smaller the window, the more details are preserved, such as 0.01 seconds to preserve high-frequency features and 0.05 seconds to enhance denoising).
[0056] The baseline drift removal layer employs a dual-window cascaded median filter, allowing for window adjustment based on different lead drift characteristics. All filtering operations are performed on a signal copy, with the original signal remaining read-only throughout to prevent data contamination. After parameter adjustment / lead switching, the corresponding lead-processed signal is immediately re-rendered, achieving latency-free preview.
[0057] The differentiated preprocessing module establishes independent parameter storage spaces for each lead of I-V6 and the "all-lead" mode. Each lead stores core parameters such as denoising enable, baseline drift removal enable, denoising window, baseline window 1, and baseline window 2.
[0058] Upon system startup, default parameters are loaded for all leads (denoising window 0.02s, baseline window 1 0.2s, baseline window 2 0.6s, all disabled by default). It supports two modes: "All Leads" (uniformly adjusting all leads) and "Single Lead" (adjusting only the selected lead), with parameters remaining independent. The current lead parameter configuration is automatically saved when switching leads, and historical parameters are loaded when switching back. A lead selection-driven filtering execution engine implements differentiated preprocessing, performing filtering only on the selected lead (or all leads), while unselected leads retain their original signals, avoiding overprocessing.
[0059] In this embodiment, the differentiated preprocessing module supports two modes: "all leads" and "single lead" with parameters that do not interfere with each other. The "all leads" mode adjusts all leads uniformly, while the "single lead" mode adjusts only the selected lead. When switching leads, the current lead parameter configuration is automatically saved, and when switching back, historical parameters are loaded.
[0060] In this embodiment, window 1 in the baseline drift removal layer is for coarse baseline estimation of 0.1 to 0.5 s, and window 2 is for fine correction of 0.3 to 1.0 s. The windows can be adjusted for different lead drift characteristics.
[0061] In this embodiment, the denoising function and baseline drift removal function in the lead trimming and adjustment module are equipped with independent checkboxes, which can be turned on and off individually to meet the three processing modes of "denoising only", "baseline removal only" and "both on", and can independently configure the filter switch state for any single lead or all leads in the 12 leads.
[0062] When the checkbox is closed, the corresponding parameter input box is disabled (grayed out); when it is open, it is automatically activated and the default / historical parameters for that lead are loaded. Parameter range is strictly validated: the noise reduction window is limited to 0 < < 0.1s ( (For filter window size), baseline window 1 limit 0.1 < < 0.5s, baseline window 2 limit 0.3 < If the time exceeds 1.0s, a pop-up window will appear indicating that the value has been exceeded and the original value will be restored to avoid excessive noise reduction that could result in loss of QRS wave details or failure of baseline correction.
[0063] All parameters support independent adjustment for each lead, adapting to the noise distribution and baseline drift characteristics of different leads;
[0064] On the time scale, the filter window parameters are input in "seconds", automatically converted to the number of sampling points (500Hz sampling rate) and forced to be odd (to meet the requirements of the median filter kernel); on the amplitude scale, the filtered signal automatically participates in the adaptive calculation of the vertical axis amplitude to ensure that the visualization effect is consistent with the original signal.
[0065] If denoising is enabled, the set denoising window duration is converted into the number of sampling points and corrected to an odd number. This kernel size is then used to perform median filtering on the copied signal to achieve denoising. The calculation method is shown in the following formula:
[0066]
[0067]
[0068] in, This is the original ECG signal sequence; Duration of the noise reduction window (input by the user, in seconds); Sampling rate (500 Hz); This is the size of the median filter kernel for denoising (add 1 if it is an even number); To round down, boundary points are processed using edge extension.
[0069] If baseline drift removal is enabled, first convert the duration of the first baseline window to the number of sampling points and correct it to an odd number. Perform median filtering on the currently processed signal to obtain a coarse baseline estimate. Then, convert the duration of the second baseline window to the number of sampling points and correct it to an odd number. Perform median filtering again on the coarse baseline estimate to obtain a precise baseline drift curve. Finally, subtract this baseline curve from the currently processed signal to complete baseline correction. The calculation method is shown in the following formula:
[0070]
[0071]
[0072]
[0073]
[0074] in, The original ECG signal sequence (if noise reduction is enabled). for ); The duration of the two windows for baseline estimation (input by user, in seconds); This is the size of the median filter kernel for denoising (add 1 if it is an even number); This is a median operation, which takes the median of the input sequence. This is the final preprocessed ECG signal sequence.
[0075] Once the parameters are confirmed, filtering is immediately applied to the selected single or all leads, updating only the waveform of the corresponding lead. This allows for a direct comparison of the changes before and after filtering, enabling precise control of "one parameter per lead" and accurate optimization of the processing effect.
[0076] In this embodiment, the file management module includes a reset saving module for saving reset ECG signal files, a file navigation module for file navigation operations, and a log recording module for establishing a full-process operation log recording system.
[0077] In this embodiment, the reset and save module has a multi-format synchronous processing function.
[0078] The reset and save function supports one-click reset across all dimensions. It can restore the clipping time (start / end time of Part1 / Part2) to the default value (0 to total signal duration for Part1, 0 to 0 for Part2), restore the filtering parameters (noise reduction window, baseline window 1 / 2) to the initial system value, and clear the cache of all lead-specific filtering parameters. At the same time, it automatically restores the lead selection drop-down box to "All", clears the file jump input box, and restores the plotting area to the original signal display.
[0079] File saving supports multi-format synchronous processing: MAT files store the cropped signal data by lead, compatible with mainstream ECG analysis software; it automatically parses the original HEA file information, updates the total duration, number of data points, and number of leads after cropping, ensuring consistency between HEA and MAT file information; during two-segment cropping, it automatically adds the _part1 / _part2 suffix to the file to avoid naming conflicts. Before saving, a full conflict check is performed, identifying files with the same name in the target directory (including single-segment / multi-segment files) and listing conflicting names, providing three processing strategies: "Replace," "Save As New File," and "Cancel." In "Save As" mode, it automatically generates a _partx suffix based on the largest sequence number of existing files, eliminating the risk of data overwriting.
[0080] The file navigation module supports convenient file navigation, allowing users to switch files using the "Previous / Next" buttons. After switching, a full-dimensional parameter reset is automatically triggered: the clipping time and filtering parameters are restored to their default values, the lead selection dropdown is switched back to "All," the file navigation input box is cleared, and the plotting area is restored to its original signal display, ensuring that new files load in their initial state. A boundary protection mechanism is also implemented; when the beginning or end of the file list is reached, a pop-up window prompts and prohibits switching outside the specified boundaries to prevent operational errors. Furthermore, a quick jump function is provided: it supports matching filenames, automatically searching the file list and locating the target file; when partial characters are entered, a candidate file list is displayed to improve jump efficiency; after jumping, the input box is automatically cleared to prevent residual content from interfering with subsequent operations.
[0081] The log creation module establishes a comprehensive operation log recording system, covering core dimensions such as operation timestamp (accurate to the second), operation type (file loading / parameter adjustment / saving / jumping, etc.), operation object (filename / lead / parameter value), and operation result (success / failure). To avoid interface lag due to excessive logs, only the most recent 50 logs are retained, and historical records are automatically cleaned up. New logs automatically scroll to the last line after being added, ensuring the latest operation record is clearly visible. It also features a multi-dimensional status prompt mechanism: the bottom status bar displays operation results in real time (e.g., "File loaded successfully," "Parameter update completed"); critical operations trigger alerts, displaying specific error reasons for easy troubleshooting; after a reset operation is executed, the log synchronously records the reset action and result, and the status bar immediately reflects the reset completion status, ensuring operation traceability and problem localization.
[0082] like Figure 1 as well as Figure 2 As shown, this invention is built on the Python language ecosystem, with core dependencies on libraries such as PyQt5, NumPy, SciPy, Matplotlib, and scipy.io, forming a complete technical chain of "interface interaction → data processing → result output".
[0083] First, the system development environment was configured. Python version 3.8.20 was selected, which is compatible with mainstream operating systems such as Windows 10 / 11. PyQt5 5.15.2 was installed for building the graphical interface, NumPy 1.22.3 and SciPy 1.10.1 were installed for numerical computation and signal processing, Matplotlib 3.7.1 was installed for data visualization, and scipy.io 1.10.1 was installed for MAT / HEA file reading and writing. tqdm 4.66.5 was used to visualize the file processing progress, ensuring stable cross-platform operation of the system.
[0084] When using the above embodiments, after the system starts up, the interface is built and the parameters are initialized first. The main window is built using QMainWindow based on PyQt5, employing a combination of QHBoxLayout and QVBoxLayout layouts. It is divided into a central visualization area, an upper right information bar, and a right-side operation area. The upper right information bar dynamically displays information such as the current filename, patient age, gender, diagnosis result, total signal duration, and sampling rate using QLabel controls. The central visualization area utilizes Matplotlib's subplot function to build a 12-row, 1-column independent plotting system, corresponding to leads I, II, III, aVR, aVL, aVF, and V1-V6. Each lead has an independent X / Y axis (X-axis is the time axis, in seconds; Y-axis is the signal amplitude, in µV), with the initial ordinate range set to [-1.0, 1.0]. The right-side operation area integrates a clipping time input box, a lead selection dropdown, filter parameter adjustment controls, function buttons, and a log display box. File navigation fuzzy matching is implemented using QCompleter, and the signal and slot mechanism of PyQt5 enables interface interaction and backend logic linkage.
[0085] During the parameter initialization phase, independent parameter storage spaces are established for the 12-lead and "all-lead" modes, storing core parameters such as denoising enable, baseline drift removal enable, denoising window, baseline window 1, and baseline window 2. The system defaults to loading the denoising window at 0.02s, baseline window 1 at 0.2s, and baseline window 2 at 0.6s, and all filtering functions are turned off by default.
[0086] When a file is loaded, the system first automatically filters files that match the set diagnostic records. Then, the user selects the MAT / HEA format ECG file to be processed through the interface. The system uses the scipy.io library to parse the file, extracting 12-lead signal data, patient clinical information, and sampling data. The processing progress is displayed through the tqdm library. After the information parsing is completed, the top information bar updates the file name, patient age, gender (completing the mapping conversion between Chinese and English diagnostic names), and the total signal duration calculated based on the number of sampling points and sampling rate in real time. The middle visualization area automatically renders the original 12-lead signal and triggers adaptive adjustment of the vertical axis. Following the multi-segment extreme value fusion algorithm, invalid values (Nan) in the target signal segment are first filtered out. If all lead signals are Nan, the default vertical axis range [-1.0, 1.0] is maintained; otherwise, the global extreme value of the signal is calculated. , and amplitude span ,according to =0.1 ( =0) or Calculate the white space value and finally determine it. This ensures that the signal is uncompressed and uninterrupted.
[0087] Signal cropping is performed by inputting the cropping time range in the bottom operation area. The system uses basic Python logic and NumPy array indexing to verify time validity, and marks the cropping period in the visualization area using a red / blue semi-transparent mask. After cropping is confirmed, only the data of the corresponding time segment from the 12-lead signal is extracted, and the vertical coordinate range of each lead is immediately refreshed to adapt to the cropped signal amplitude characteristics, ensuring clear presentation of details. If dual-segment cropping is required, the time ranges for Part 1 and Part 2 can be set separately, and the system automatically distinguishes the two cropping regions and stores them independently.
[0088] Multi-scale differential preprocessing allows users to switch between "single-lead," "multi-lead," or "all-lead" modes via a lead selection dropdown. The system automatically saves the current lead parameter configuration during switching and loads historical parameters when switching back. When filtering is enabled, users can select "denoising only," "baseline removal only," or "both on" modes via independent checkboxes. When a checkbox is closed, the corresponding parameter input box is disabled (grayed out); when enabled, it automatically activates and loads default / historical parameters. During parameter input, the system strictly verifies the range: the denoising window is limited to 0 < <0.1s, baseline window 1 limit 0.1< <0.5s, baseline window 2 limit 0.3< <1.0s; if outside the range, a pop-up prompt will appear. After parameter confirmation, the system performs filtering operations based on the signal copy; the original signal is read-only throughout. When the denoising function is enabled, the input denoising window duration is converted into the number of sampling points. If the result is even, add 1 to correct it to an odd number. Then, use SciPy's medfilt function with this kernel size to perform median filtering on the signal. Boundary points are processed using edge extension. When the baseline drift removal function is enabled, first convert the baseline window duration of 1 to an odd number of sampling points. Median filtering is performed on the signal to obtain a coarse baseline estimate. Then convert the baseline window duration of 2 into an odd number of sampling points. ,right Performing median filtering again yields the accurate baseline drift curve. Ultimately, minus Correction complete. If denoising is enabled simultaneously, the denoised signal will be used. Baseline correction is performed based on the data. After filtering, the processed signal is rendered in real time in the visualization area. Unselected leads retain their original signals, allowing users to easily compare the effects.
[0089] When saving a file, the user clicks the "Save" button. The system supports simultaneous output of multiple formats, including MAT and HEA. The MAT file stores the clipped signal data by lead, while the HEA file automatically updates the total duration, number of data points, and number of leads after clipping to ensure consistency between the two. During dual-segment clipping, the system automatically adds the _part1 / _part2 suffix to the file. A full conflict check is performed before saving. If a file with the same name exists in the target directory, the conflict name is listed, and three processing strategies are provided: "Replace," "Save As New File," and "Cancel." In the "Save As" mode, the system automatically generates a _partx suffix based on the largest sequence number of the existing file to avoid data overwriting.
[0090] File navigation is achieved via the "Previous / Next" button or by entering a filename. Clicking the button switches to the corresponding file in the file list, simultaneously triggering a full-dimensional parameter reset, restoring the default values for trimming time and filtering parameters, switching the lead selection back to "All," clearing the navigation input box, and restoring the original signal display. When reaching the beginning or end of the list, a pop-up prompt is displayed, and out-of-bounds switching is prohibited. When navigating by entering a filename, the system automatically searches the file list, displays candidate files upon entering partial characters, and clears the input box after locating the target file, ensuring smooth operation.
[0091] Log recording and status prompts are integrated throughout the entire process. The system uses a QTextEdit control to record operation timestamps (accurate to the second), operation type (file loading / parameter adjustment / saving / jumping, etc.), operation object, and result in real time. Only the most recent 50 log entries are retained, and the history is automatically cleared. New log entries are automatically scrolled to the last line after being added. After a reset operation is executed, the log reports the reset completion status, ensuring that the processing is traceable and the problem can be located.
[0092] This invention implements an interactive ECG signal processing system based on multi-scale analysis and parameter control. It innovatively achieves precise ECG signal trimming, multi-scale differentiated preprocessing for single-lead / multi-lead / full-lead systems, flexible and refined control of filtering parameters, and secure and reliable full-process file management. This ensures that the signal visualization effect and parameter adjustment are dynamically adapted in real time, successfully providing high-quality and highly reliable standardized signal input for deep learning models, and laying a solid data foundation for improving the accuracy and generalization ability of intelligent arrhythmia detection.
[0093] Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. An interactive electrocardiogram signal processing system based on multi-scale analysis and parameter control, characterized in that: The system includes a visualization information display module, a lead trimming and adjustment module, a differential preprocessing module, and a file operation module. The visualization information display module is used to visually display ECG signals through leads. The lead trimming and adjustment module is used to trim and adjust the ECG signals in the visualization information display module. The differential preprocessing module is used to perform differential processing and noise reduction on the ECG signals trimmed and adjusted by the lead trimming and adjustment module for different leads. The file management module is used to switch, store, and reset ECG signal files in the recording system and to use logs to record the process of processing ECG signal files.
2. The interactive ECG signal processing system based on multi-scale analysis and parameter control according to claim 1, characterized in that: The visualization information display module includes a 12-lead independent plotting system built on Matplotlib and an information display module; The 12-lead independent plotting system uses a 12-row, 1-column subplot layout to correspond to leads I, II, III, aVR, aVL, aVF, and V1-V6 respectively. Each lead is assigned an independent plotting area and configured with a dedicated X / Y axis coordinate system. The information display module includes a layered parsing and rendering module that integrates three core types of information: file name, patient diagnosis information, and electrocardiogram signal, and implements event-driven dynamic updates. It parses and displays the current file name, processing progress, and patient clinical information in real time. It accurately extracts patient information from the HEA annotation file and completes the Chinese-English mapping conversion of the diagnosis name and the signal technical parameter dimension. It automatically calculates and displays the total signal duration based on the number of sampling points and the sampling rate.
3. The interactive ECG signal processing system based on multi-scale analysis and parameter control according to claim 2, characterized in that: In the X / Y axis coordinate system, the X-axis is uniformly the time axis, and the Y-axis is the signal amplitude.
4. The interactive ECG signal processing system based on multi-scale analysis and parameter control according to claim 2, characterized in that: The lead clipping and adjustment module includes a lead clipping module and a vertical axis adaptive adjustment module; The lead clipping module accurately marks the clipping time period using a red and blue dual-color semi-transparent mask; The ordinate adjustment module adopts a real-time adaptive mechanism, relying on a multi-segment signal extreme value fusion algorithm to calculate the maximum and minimum values of the signal in the clipping area of each lead in real time, automatically add 10% edge white space, and immediately refresh the ordinate range of the corresponding lead when the clipping time and filtering parameters are adjusted.
5. The interactive ECG signal processing system based on multi-scale analysis and parameter control according to claim 2, characterized in that: The differential preprocessing module employs a layered application of median filtering, including a denoising layer and a baseline drift removal layer. The denoising layer generates an odd-kernel-size filter based on a specified window of 0 to 0.1 seconds; The baseline drift removal layer is achieved through a dual-window cascaded median filter.
6. The interactive ECG signal processing system based on multi-scale analysis and parameter control according to claim 5, characterized in that: The differentiated preprocessing module supports two modes: "all leads" and "single lead" with parameters that do not interfere with each other. The "all leads" mode adjusts all leads uniformly, while the "single lead" mode adjusts only the selected lead. When switching leads, the current lead parameter configuration is automatically saved, and when switching back, the historical parameters are loaded.
7. The interactive ECG signal processing system based on multi-scale analysis and parameter control according to claim 5, characterized in that: In the baseline drift removal layer, window 1 is for coarse baseline estimation of 0.1 to 0.5 s, and window 2 is for fine correction of 0.3 to 1.0 s. The window can be adjusted for different lead drift characteristics.
8. The interactive ECG signal processing system based on multi-scale analysis and parameter control according to claim 5, characterized in that: The denoising and baseline drift removal functions in the lead trimming and adjustment module are each equipped with independent checkboxes, which can be turned on and off individually to meet three processing modes: "denoising only", "baseline removal only", and "both on". The filter switch status can be configured independently for any single lead or all leads in the 12 leads.
9. The interactive ECG signal processing system based on multi-scale analysis and parameter control according to claim 1, characterized in that: The file management module includes a reset and save module for saving reset ECG signal files, a file navigation module for file navigation operations, and a log recording module for establishing a full-process operation log recording system.
10. The interactive ECG signal processing system based on multi-scale analysis and parameter control according to claim 9, characterized in that: The reset and save module has multi-format synchronous processing capabilities.