Method, system and device for removing electrical stimulation artifacts in real time and storage medium

By using template subtraction and interpolation methods to process electrical stimulation artifacts, the problem of interference between electrical stimulation artifacts and deep brain stimulation signals was solved, achieving real-time and efficient artifact removal and improving signal quality and accuracy.

CN121015206APending Publication Date: 2025-11-28HANGZHOU ZHUOXI INST OF BRAIN & INTELLIGENCE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510989020.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-17
Publication Date
2025-11-28

AI Technical Summary

Technical Problem

Existing technologies struggle to balance the precision and real-time performance of electrical stimulation artifacts, resulting in real neural signals being masked or distorted by artifacts, thus affecting the accuracy and quality of deep brain stimulation signals.

Method used

Template subtraction and interpolation methods are used to process high-amplitude artifact segments in electrical signals. High-vibration telecommunication methods are used to process them in combination with template subtraction and interpolation methods. A high-pass filter is used to perform baseline removal processing on the local field potential signal to locate and remove low-amplitude tails and high-amplitude artifact segments. Template subtraction and interpolation methods are used to process different types of artifacts respectively.

Benefits of technology

It achieves real-time, efficient and accurate removal of electrical stimulation artifacts, improves signal quality and accuracy, and preserves the characteristics of underlying neural signals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121015206A_ABST
    Figure CN121015206A_ABST
Patent Text Reader

Abstract

The invention provides a real-time removal method, system and device for electrical stimulation artifacts and a storage medium, and relates to the technical field of signal processing, and the method comprises the steps: collecting a local field potential signal of a deep brain region, carrying out the baseline removal of the local field potential signal through a high-pass filter, and obtaining a preprocessed potential signal; the rising edge of the preprocessed potential signal is monitored on line, an amplitude threshold value is set, and a low-amplitude trailing artifact segment and a high-amplitude stimulation artifact segment in the preprocessed potential signal are jointly judged; and performing artifact removal on the low-amplitude trailing artifact segment by adopting a template subtraction method to obtain a first signal, and processing a high-amplitude stimulation artifact segment in the first signal by adopting an interpolation method aiming at the high-amplitude stimulation artifact segment to obtain a restored reconstruction signal. According to the method, the electrical stimulation artifacts can be removed efficiently and accurately in real time, so that the quality and the accuracy of signals are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of signal processing technology, and in particular to a method, system, device, and storage medium for real-time removal of electrical stimulation artifacts. Background Technology

[0002] Deep brain stimulation (DBS) is an established method for treating neurological and psychiatric disorders. Implanted DBS electrodes record local field potentials (LFPs) in deep brain regions, and the signal characteristics of LFPs provide a basis for the development of closed-loop DBS. However, this electrical stimulation often produces artifacts in the recorded signals, which may mask or distort the true signals related to physiological events.

[0003] Electrical stimulation artifacts can negatively impact LFP feature extraction in three ways. First, the amplitude of stimulation artifacts can reach 1000 microvolts to 100 millivolts, while local field potentials (LFPs) are weak potential changes caused by neural activity in local neural networks, typically below 50 microvolts, far lower than the amplitude of stimulation artifacts; a similar situation exists with calcium signals. Second, in the time domain, stimulation artifacts in monophasic stimulation have a duration of only tens of microseconds, while the decay portion can reach the millisecond level. Bidirectional stimulation, commonly used in deep brain stimulation (DBS), also produces artifacts with longer decay times due to brain capacitive properties; in high-frequency stimulation, these artifacts can contaminate more than 10% of the signal. Third, in the frequency domain, we are interested in a certain range of signal frequencies (0-200 Hz), and stimulation artifacts at high stimulation frequencies have a greater impact on the preservation of high-frequency signals. Aliasing at low sampling rates also provides information not present in the low-frequency portion of the signal. Therefore, improving methods for handling stimulation artifacts remains an important part of DBS research. Traditional methods typically avoid artifact interference by discarding the signal for a specific period of time after stimulation. While simple, this can lead to a significant loss of real neural signals.

[0004] Therefore, there is an urgent need for an efficient artifact removal method that balances artifact removal accuracy and real-time performance and can adapt to complex stimulus artifact morphologies. Summary of the Invention

[0005] This invention provides a method, system, device, and storage medium for real-time removal of electrical stimulation artifacts, which can achieve real-time, efficient, and accurate removal of electrical stimulation artifacts, thereby improving signal quality and accuracy.

[0006] In a first aspect, the present invention provides a method for real-time removal of electrical stimulation artifacts, the method comprising the following steps: Local field potential signals from deep brain regions are acquired, and high-pass filters are used to remove the baseline from these signals to obtain preprocessed potential signals. The rising edge of the preprocessed potential signal is monitored online and an amplitude threshold is set. The low-amplitude trailing artifact segment and the high-amplitude stimulation artifact segment in the preprocessed potential signal are jointly determined. For the low-amplitude trailing artifact segment, template subtraction is used to remove the artifact to obtain the first signal; For the high-amplitude stimulus artifact segment, an interpolation method is used to process the high-amplitude stimulus artifact segment in the first signal to obtain the recovered reconstructed signal.

[0007] According to the present invention, a real-time method for removing electrical stimulation artifacts, wherein template subtraction is used to remove the low-amplitude trailing artifact segment to obtain a first signal, comprising: The start time of each stimulus event is located by detecting the rising edge or based on known stimulus parameters; the known stimulus parameters include at least one of frequency and pulse width. Set a time window to cover the trail artifact for each of the aforementioned stimulus events; A sliding window mechanism was used to extract the tail segment signals of multiple stimulation cycles; The tail segment signals of the multiple stimulation cycles are weighted and averaged to generate an artifact template; The low-amplitude trailing artifact segment is removed using the artifact template to obtain the first signal.

[0008] According to the present invention, a real-time method for removing electrical stimulation artifacts, wherein template subtraction is used to remove the low-amplitude trailing artifact segment to obtain a first signal, comprising: Based on different stimulus types and parameters, the template with the highest matching degree is selected from the preset template library as the artifact template; The low-amplitude trailing artifact segment is removed using the artifact template to obtain the first signal.

[0009] According to the present invention, a real-time removal method for electrical stimulation artifacts includes processing the high-amplitude stimulation artifact segment in the first signal using an interpolation method to obtain a recovered reconstructed signal, comprising: The start and end positions of the high-amplitude stimulus artifact segment are determined by threshold detection and rising edge recognition methods, and the segment where the start and end positions are located is identified as the signal missing segment. M sampling points are selected before and after the high-amplitude stimulus artifact segment as interpolation boundary points; M is greater than or equal to 1. The target interpolation method is selected based on the processing delay constraint, and the signal is restored based on the target interpolation method and the interpolation boundary points to obtain the reconstructed signal; the target interpolation method includes at least one of the following: linear interpolation, cubic spline interpolation and fast polynomial fitting method.

[0010] According to a method for real-time removal of electrical stimulation artifacts provided by the present invention, the method further includes: The power spectral density difference between the reconstructed signal and the reference signal was calculated using the Welch method. The artifact removal effect is evaluated based on the power spectral density difference. Based on the power spectral density difference, the artifact localization parameters or target interpolation method are dynamically adjusted.

[0011] According to a real-time method for removing electrical stimulation artifacts provided by the present invention, the step of calculating the power spectral density difference between the reconstructed signal and the reference signal using the Welch method includes: The reconstructed signal is pre-windowed and segmented using overlapping sliding windows to obtain multiple reconstructed signal segments. Calculate the power spectrum of the reconstructed signal in each segment, and average the power spectrum of the reconstructed signal in each segment to obtain the power spectral density of the reconstructed signal; The reference signal is pre-windowed and segmented using overlapping sliding windows to obtain multiple reference signal segments. Calculate the power spectrum of the reference signal for each segment, and average the power spectra of the reference signal for each segment to obtain the power spectral density of the reference signal; Based on the power spectral density of the reconstructed signal and the power spectral density of the reference signal, an index of the power spectral density difference is calculated; the index of the power spectral density difference includes at least one of the following: relative energy gain within a specific frequency band, power spectral density peak shift, and frequency band energy ratio change.

[0012] Secondly, the present invention also provides a real-time removal system for electrical stimulation artifacts, the system comprising the following modules: The preprocessing module is used to acquire local field potential signals from deep brain regions and perform baseline removal processing on the local field potential signals using a high-pass filter to obtain preprocessed potential signals. The artifact localization module is used to monitor the rising edge of the preprocessed potential signal online and set an amplitude threshold, and jointly determine the low amplitude trailing artifact segment and the high amplitude stimulation artifact segment in the preprocessed potential signal. The artifact removal module is used to remove artifacts from the low-amplitude trailing artifact segment using template subtraction to obtain the first signal. For the high-amplitude stimulus artifact segment, an interpolation method is used to process the high-amplitude stimulus artifact segment in the first signal to obtain the recovered reconstructed signal.

[0013] Thirdly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the real-time removal method for electrical stimulation artifacts as described above.

[0014] Fourthly, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a real-time removal method for electrical stimulation artifacts as described above.

[0015] Fifthly, the present invention also provides a computer program product, including a computer program that, when executed by a processor, implements a real-time removal method for electrical stimulation artifacts as described above.

[0016] The present invention provides a method, system, device, and storage medium for real-time removal of electrical stimulation artifacts. First, local field potential signals from deep brain regions are acquired. A high-pass filter is used to remove the baseline from the local field potential signals to obtain a preprocessed potential signal. Then, the rising edge of the preprocessed potential signal is monitored online, and an amplitude threshold is set. Low-amplitude trailing artifact segments and high-amplitude stimulation artifact segments in the preprocessed potential signal are jointly identified. Next, for the low-amplitude trailing artifact segments, template subtraction is used to remove the artifacts, resulting in a first signal. For the high-amplitude stimulation artifact segments, an interpolation method is used to process the high-amplitude stimulation artifact segments in the first signal to obtain a restored reconstructed signal.

[0017] In this invention, the local field potential signal is subjected to baseline removal processing to locate low-amplitude trailing artifacts and high-amplitude stimulation artifacts. Then, template subtraction is first used to remove the trailing artifacts with low amplitude and long pulse width. This method can more effectively preserve the underlying neural signals. After the trailing artifacts are removed, an interpolation method is used to further remove the high-amplitude artifacts of the main stimulation phase, resulting in a restored reconstructed signal. This method can achieve real-time, efficient and accurate removal of electrical stimulation artifacts, thereby improving the quality and accuracy of the signal. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0019] Figure 1 This is one of the flowcharts illustrating the real-time removal method for electrical stimulation artifacts provided by the present invention.

[0020] Figure 2 This is a schematic diagram of the analog signal artifacts provided by the present invention.

[0021] Figure 3 This is a schematic diagram of LFP signals before and after artifact removal of analog data, provided by the present invention.

[0022] Figure 4 This is the second flowchart of the real-time removal method for electrical stimulation artifacts provided by the present invention.

[0023] Figure 5 This is a schematic diagram of the structure of the real-time removal system for electrical stimulation artifacts provided by the present invention.

[0024] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0026] To more clearly understand the various embodiments provided by the present invention, the technical content involved in the present invention will first be described as follows: Some existing technologies attempt to achieve online artifact removal. Although they avoid signal loss, they often face the following problems: First, the processing methods are too simple. For example, using only template subtraction is difficult to deal with the mixed situation of high and low amplitude artifacts under high frequency stimulation conditions, resulting in insufficient removal. Second, some interpolation algorithms or fitting calculations have high overhead, which leads to system processing delays and makes it difficult to meet real-time requirements.

[0027] Therefore, there is an urgent need for an efficient online processing method and system that balances artifact removal accuracy and real-time performance and can adapt to complex stimulus artifact morphologies.

[0028] The following is combined with Figures 1-6 The present invention describes a method, system, apparatus, and storage medium for real-time removal of electrical stimulation artifacts.

[0029] Figure 1 This is one of the flowcharts illustrating the real-time removal method for electrical stimulation artifacts provided by the present invention, such as... Figure 1 As shown, the method includes the following: Step 101: Collect local field potential signals from deep brain regions, and use a high-pass filter to perform baseline removal processing on the local field potential signals to obtain preprocessed potential signals.

[0030] Specifically, it should first be noted that the execution subject of this embodiment is an electronic device, which is used to preprocess, locate, and remove artifacts from the local field potential signals of the acquired deep brain regions, so as to achieve real-time, efficient and accurate removal of electrical stimulation artifacts, thereby improving the quality and accuracy of the signal.

[0031] The method provided in this embodiment includes the following steps: First, local field potentials (LFPs) signals from deep brain regions are acquired. For example, local field potentials (LFPs) in deep brain regions are recorded using implanted deep brain stimulation (DBS) electrodes. This electrical stimulation often produces artifacts in the recorded signals, which may mask or distort the true signals related to physiological events. This embodiment aims to remove these electrical stimulation artifacts.

[0032] In this embodiment, a high-pass filter (e.g., 2 Hz) is used to perform baseline removal on the contaminated signal (original signal) during data acquisition, in order to reduce the weakening effect of large baseline drift on template subtraction performance.

[0033] A high-pass filter (HPF) is an electronic circuit or digital algorithm that allows high-frequency signals to pass through while attenuating or blocking low-frequency signals. Its core function is to suppress low-frequency components (such as baseline drift and DC bias) while preserving the high-frequency characteristics of the signal (such as fast transients and detailed information).

[0034] The key parameters of a high-pass filter include the following: Cutoff frequency: The frequency at which the signal attenuates to -3 dB (amplitude drops to 70.7%).

[0035] Roll-off slope: Stopband attenuation rate.

[0036] Order: Determines the roll-off slope (the larger the order, the faster the roll-off).

[0037] Step 102: Monitor the rising edge of the preprocessed potential signal online and set the amplitude threshold, and jointly determine the low amplitude trailing artifact segment and the high amplitude stimulation artifact segment in the preprocessed potential signal.

[0038] Specifically, after preprocessing the original signal, preprocessed point signals are obtained. Then, specific artifact localization is required.

[0039] For example, the rising edge can be monitored online as the location of the artifact, or the location of the stimulus artifact can be defined empirically. That is, under low sampling rate conditions, online rising edge detection can be used to initially determine the location of the stimulus artifact, or empirical parameters can be used to preset the location based on the periodic structure of the stimulus.

[0040] Figure 2 This is a schematic diagram of the analog signal artifacts provided by the present invention, as shown below. Figure 2 As shown, the left side represents the high-amplitude portion, which is the high-amplitude stimulus artifact segment, while the right side represents the low-amplitude tail, which is the low-amplitude tail artifact segment.

[0041] Since the potential signal contains not only the main artifact with high amplitude at the moment of stimulation, but also the low amplitude trailing artifact that lasts for several milliseconds, it is necessary to model and process the two types of artifacts separately.

[0042] Step 103: For the low-amplitude trailing artifact segment, template subtraction is used to remove artifacts and obtain the first signal.

[0043] In this method, the template subtraction module uses effective artifact templates from low-amplitude artifacts. Template subtraction is used to remove low-amplitude, long-pulse-width trailing artifacts, thus more effectively preserving underlying neural signals. After removing the trailing artifacts, interpolation is used to further remove high-amplitude artifacts from the main stimulus phase.

[0044] For low-amplitude trailing artifacts, template subtraction is used to remove the trailing artifacts with low amplitude and long pulse width to obtain the first signal. Template subtraction can more effectively preserve the underlying neural signals.

[0045] Step 104: For the high-amplitude stimulus artifacts, use an interpolation method to process the high-amplitude stimulus artifacts in the first signal to obtain the recovered reconstructed signal.

[0046] Specifically, to accurately extract the location of artifacts in high-amplitude stimulus artifact segments, we combined rising edge detection with amplitude threshold determination. That is, if the signal shows a sudden increase at a specific sampling point, and its amplitude exceeds a preset threshold, then that point can be determined as the starting point of the peak artifact, thus accurately providing a reference boundary for interpolation processing. The location of high-amplitude stimulus phase artifacts is determined by setting a threshold or by using an online rising edge detection module.

[0047] Furthermore, for the high-amplitude stimulus artifacts, an interpolation method is used to process the high-amplitude stimulus artifacts in the first signal to obtain the recovered reconstructed signal.

[0048] Subsequently, the processed signals from each segment are output in a loop to obtain the overall restored reconstructed signal, that is, the data after removing artifacts.

[0049] Figure 3This is a schematic diagram of the LFP signal before and after artifact removal of analog data, as provided by the present invention. Figure 3 As shown, the data includes the original data after high-pass filtering and the data after online ITS processing. The horizontal axis represents the number of frames of the electrical signal (sampling rate 44kHz), and the vertical axis represents the instantaneous amplitude of the signal (mV). Compared with the original data after high-pass filtering, the data processed by online ITS effectively removes artifacts at the artifact locations, and the overall waveform continuity is good, with no drastic changes or artifact residues. It removes artifacts introduced by electrical stimulation in real time and efficiently, achieving high-fidelity signal recovery.

[0050] The method provided in this embodiment first acquires local field potential signals from deep brain regions, performs baseline removal processing on the local field potential signals using a high-pass filter to obtain preprocessed potential signals, then monitors the rising edge of the preprocessed potential signals online and sets an amplitude threshold, jointly determining low-amplitude trailing artifact segments and high-amplitude stimulation artifact segments in the preprocessed potential signals; furthermore, for the low-amplitude trailing artifact segments, template subtraction is used to remove artifacts to obtain a first signal, and for the high-amplitude stimulation artifact segments, an interpolation method is used to process the high-amplitude stimulation artifact segments in the first signal to obtain the recovered reconstructed signal.

[0051] In this invention, the local field potential signal is subjected to baseline removal processing to locate low-amplitude trailing artifacts and high-amplitude stimulation artifacts. Then, template subtraction is first used to remove the trailing artifacts with low amplitude and long pulse width. This method can more effectively preserve the underlying neural signals. After the trailing artifacts are removed, an interpolation method is used to further remove the high-amplitude artifacts of the main stimulation phase, resulting in a restored reconstructed signal. This method can achieve real-time, efficient and accurate removal of electrical stimulation artifacts, thereby improving the quality and accuracy of the signal.

[0052] According to the present invention, a real-time method for removing electrical stimulation artifacts uses template subtraction to remove low-amplitude trailing artifact segments to obtain a first signal, including: The start time of each stimulus event is located by detecting the rising edge or based on known stimulus parameters; the known stimulus parameters include at least one of frequency and pulse width. Set a time window to cover the trail artifact for each stimulus event; A sliding window mechanism was used to extract the tail segment signals of multiple stimulation cycles; Weighted average of the trailing signals from multiple stimulation cycles is used to generate an artifact template; The low-amplitude trailing artifact segment was removed using an artifact template to obtain the first signal.

[0053] Specifically, in some embodiments, step 102, which uses template subtraction to remove artifacts, is implemented through the following steps: To address the trailing artifacts with low amplitude and long pulse width, a real-time processing strategy based on template subtraction is employed. Specific steps include: First, the start time of each stimulus event is located by rising edge detection or based on known stimulus parameters, including at least one of frequency and pulse width, and a time window for covering the trailing artifact is set for each stimulus event.

[0054] Based on this, a sliding window mechanism is used to extract the trailing signal from multiple stimulation cycles. The trailing signals from multiple stimulation cycles are then weighted and averaged to generate an artifact template. In other words, trailing signals are extracted from multiple cycles to construct an average or weighted average artifact template.

[0055] To ensure a balance between real-time performance and artifact removal accuracy, a sliding window update mechanism is introduced during template construction, allowing the template to automatically adjust according to signal changes. In the process of generating artifact templates using the sliding window mechanism, the update mechanism is the core element ensuring that the template can dynamically adapt to signal changes (such as artifact morphology drift and noise fluctuations). Its core idea is to replace old data with newly entering data, maintaining the freshness of the data within the window. The following is a detailed explanation of the update mechanism: Assuming the window size is set to K stimulation cycles (i.e., the window accommodates the tail segments of the most recent K cycles), the update steps are as follows: (1) Initialize the window: Collect the tail segment signals {S1,S2,…,S} from the first K stimulation cycles. K}

[0056] Calculate the initial artifact template: or Among them, Template init Let S be the initial artifact template, K represent the K-period trailing signal, and S be the initial artifact template. i w represents the tailing signal of the i-th stimulation cycle. i This represents the weight of the i-th stimulation cycle.

[0057] (2) Triggering update conditions: Periodic-driven update: The tail signal S of each new stimulation cycle new This triggers an update (the most common method).

[0058] Event-driven updates: Update only when a significant change in signal characteristics is detected (such as motion interference markers).

[0059] (3) Window data update: Remove the oldest data: Remove the oldest period signal S within the window. oldest Remove.

[0060] Add new data: Add new signals S new Add to the end of the window.

[0061] Updated window data: {S2,S3,…,S K ,S new (The window still maintains K signals) (4) Template recalculation: Based on the updated window data, the weighted average is recalculated: Among them, Template new For the artifact template of average or weighted average, the weight w j It can be dynamically adjusted, where K represents the K-cycle tail segment signal, and S... i w represents the tailing signal of the i-th stimulation cycle. i This represents the weight of the i-th stimulation cycle.

[0062] Common weight allocation strategies include the following: Equal weight: w j =1 / K (simple average).

[0063] Weighting based on signal-to-noise ratio (SNR): periods with higher SNR are assigned higher weights.

[0064] Furthermore, after obtaining the updated artifact template (average or weighted average artifact template), the low-amplitude trailing artifact segments are removed using the artifact template to obtain the first signal.

[0065] The method provided in this embodiment models and processes two types of artifacts separately. First, template subtraction is used to remove low-amplitude, long-pulse-width trailing artifacts, which can more effectively preserve underlying neural signals. After removing the trailing artifacts, interpolation is used to further remove high-amplitude artifacts in the main stimulus phase. This invention can achieve real-time, efficient, and accurate removal of electrical stimulation artifacts, thereby improving signal quality and accuracy.

[0066] According to the present invention, a real-time method for removing electrical stimulation artifacts uses template subtraction to remove low-amplitude trailing artifact segments to obtain a first signal, including: Based on different stimulus types and parameters, the template with the highest matching degree is selected from the preset template library as the artifact template; The low-amplitude trailing artifact segment was removed using an artifact template to obtain the first signal.

[0067] Specifically, in some embodiments, step 102 further includes: Furthermore, considering that various stimulation modes may exist during actual neural stimulation (such as monophasic stimulation, biphasic stimulation, frequency-modulated stimulation, etc.), this invention also designs a multi-template dynamic selection mechanism. This mechanism can select the most matching template from a preset or real-time learned template library for subtraction based on different stimulation types and parameters, thereby significantly improving the adaptability and robustness of artifact removal.

[0068] That is, based on different stimulus types and parameters, the template with the highest matching degree is selected from the preset template library as the artifact template, and the low amplitude trailing artifact segment is removed using the artifact template to obtain the first signal.

[0069] The method provided in this embodiment also incorporates a multi-template dynamic selection mechanism. This mechanism can select the most matching artifact template from a preset or real-time learned template library for subtraction based on different stimulus types and parameters, thereby significantly improving the adaptability and robustness of artifact removal.

[0070] According to the present invention, a real-time removal method for electrical stimulation artifacts involves processing high-amplitude stimulation artifact segments in a first signal using an interpolation method to obtain a recovered reconstructed signal, including: By using threshold detection and rising edge recognition methods, the start and end positions of high-amplitude stimulus artifact segments are determined, and the segments where the start and end positions are located are identified as signal missing segments. M sampling points are selected before and after the high-amplitude stimulus artifact segment as interpolation boundary points; M is greater than or equal to 1. The target interpolation method is selected based on the processing delay constraint, and the signal is restored based on the target interpolation method and the interpolation boundary points to obtain the reconstructed signal. The target interpolation method includes at least one of the following: linear interpolation, cubic spline interpolation and fast polynomial fitting method.

[0071] Specifically, in some embodiments, after removing low-amplitude trailing artifacts, the process moves to the stage of processing high-amplitude main stimulus artifacts. These artifacts typically occur instantaneously during stimulation and have amplitudes much higher than the background neural signal, making interpolation methods more suitable.

[0072] Step 104 is achieved through the following steps: First, the start and end positions of the high-amplitude stimulus artifact segment are determined using threshold detection and rising edge recognition methods, and the segment containing these start and end positions is identified as the signal missing segment. Then, M sampling points are selected before and after the high-amplitude stimulus artifact segment as interpolation boundary points; M is greater than or equal to 1.

[0073] Then, based on the processing delay constraint, the target interpolation method is selected, and based on the target interpolation method and the interpolation boundary points, the signal missing segment is restored to obtain the reconstructed signal.

[0074] The target interpolation method includes at least one of the following: linear interpolation, cubic spline interpolation, and fast polynomial fitting. In signal processing and data analysis, interpolation strategies are used to estimate values ​​at unknown locations based on known discrete data points. The following is a comparison of the principles, characteristics, and applications of three common interpolation methods: 1. Linear Interpolation Construct a straight line between two adjacent data points (x0, y0) and (x1, y1). Unknown points. x value y Calculated by distance ratio: 2. Cubic Spline Interpolation Construct a piecewise cubic polynomial using four adjacent data points.

[0075] At the nodes, the following conditions must be met: continuous function values, continuous first derivative (smooth curve), and continuous second derivative (smooth curvature). Boundary conditions can be selected as: natural boundary (second derivative is 0), fixed boundary, etc.

[0076] 3. Fast Polynomial Fitting The principle is as follows: Local polynomial fitting: Fitting data with a low-order polynomial in the neighborhood of the target point.

[0077] Core acceleration strategies: Savitzky-Golay filter: achieves real-time fitting through pre-computed convolution kernels; recursive least squares: incrementally updates fitting coefficients to avoid matrix inversion; piecewise low-order fitting: avoids high-order polynomial oscillations.

[0078] The following recommendations can be followed when choosing an interpolation strategy: High real-time requirements → linear interpolation: for example, embedded devices completing GPS tracks in real time. Prioritizing accuracy and smoothness → cubic splines: for example, reconstructing aerodynamic curves of aircraft airfoils. Balancing speed and noise reduction → Fast polynomial fitting: For example, real-time enhancement of the central electrical signal of wearable devices.

[0079] Optionally, to improve the continuity and physiological interpretability of the interpolated signal, the edges of the interpolated segments can be further smoothed and fused.

[0080] The method provided in this embodiment first uses template subtraction to remove low-amplitude, long-pulse-width trailing artifacts, which can more effectively preserve underlying neural signals. After removing the trailing artifacts, interpolation is used to further remove high-amplitude artifacts in the main stimulus phase, enabling real-time, efficient, and accurate removal of electrical stimulation artifacts, thereby improving signal quality and accuracy.

[0081] According to the present invention, a method for real-time removal of electrical stimulation artifacts is provided, the method further comprising: The power spectral density difference between the reconstructed signal and the reference signal was calculated using the Welch method. The artifact removal effect was evaluated based on the power spectral density difference. Based on the difference in power spectral density, the artifact localization parameters or target interpolation method are dynamically adjusted.

[0082] Specifically, in some embodiments, after artifact removal, the method further includes: estimating the power spectral density difference between the recovered signal and the reference signal using the Welch method to evaluate the artifact removal effect in the frequency domain and providing real-time feedback for dynamically adjusting artifact recognition parameters. The specific steps are as follows: First, the power spectral density difference between the reconstructed signal and the reference signal is calculated using the Welch method. The Welch method is a widely used technique in signal processing for estimating power spectral density. It divides the data into short, overlapping segments, windows each segment, calculates its periodogram, and finally averages the periodograms of all segments. This effectively reduces the variance of power spectral estimation at acceptable frequency resolution and suppresses spectral leakage. It is an improvement over the traditional periodogram method, primarily addressing the problems of large variance and limited spectral resolution inherent in the periodogram method.

[0083] The core principles and steps of the Welch method include: signal sequence segmentation, windowing (applying a window function to each data segment), calculation of the corrected periodogram (calculating the discrete Fourier transform of each windowed data segment), averaging (averaging the corrected periodograms of all K data segments to obtain the final Welch power spectral density estimate), and so on.

[0084] The Welch method was used to calculate the corresponding power spectral density (PSD) estimates for the reconstructed signal and the reference signal, respectively.

[0085] Furthermore, the artifact removal effect is evaluated based on the power spectral density difference. Since the reference signal is also the reference real signal, the power spectral density difference between the reconstructed signal and the reference signal can be used to evaluate the artifact removal effect. The system calculates the spectral differences between the two, such as the relative energy gain, power spectral density peak shift, or band energy ratio change within a specific frequency band (e.g., 30-100Hz).

[0086] If a significant energy anomaly (such as excessive or insufficient gain) is detected in the recovered signal in the key frequency band, the system will determine that the artifact has not been completely removed or that the interpolation segment signal is abnormal.

[0087] Furthermore, the artifact localization parameters or target interpolation method can be dynamically adjusted based on the power spectral density difference.

[0088] Based on this frequency domain feedback, the system can automatically or manually adjust the following parameters to optimize the artifact removal process: for example, adjusting the threshold setting to improve the positioning accuracy of high-amplitude artifacts; modifying the interpolation segment length or interpolation method (such as switching from linear to cubic spline) to improve the continuity and smoothness of the restored signal; and optimizing the template update frequency or construction method to improve the adaptability of template subtraction.

[0089] To ensure the accuracy of artifact localization and removal, the method provided in this embodiment, after completing artifact identification based on threshold setting and rising edge detection, and signal recovery operations consisting of template subtraction and interpolation, further introduces the Welch method for frequency domain feature evaluation and feedback adjustment. This method quantifies the artifact removal effect in the frequency domain by performing power spectral density analysis on the recovered reconstructed signal and the original signal or system reference signal before artifact removal.

[0090] According to the present invention, a real-time removal method for electrical stimulation artifacts calculates the power spectral density difference between the reconstructed signal and the reference signal using the Welch method, including: The reconstructed signal is pre-windowed and segmented using overlapping sliding windows to obtain multiple reconstructed signal segments. Calculate the power spectrum of each segment of the reconstructed signal, and average the power spectrum of each segment to obtain the power spectral density of the reconstructed signal. The reference signal is pre-windowed and segmented using overlapping sliding windows to obtain multiple reference signal segments; Calculate the power spectrum of each segment of the reference signal, and average the power spectrum of each segment of the reference signal to obtain the power spectral density of the reference signal. Based on the power spectral density of the reconstructed signal and the power spectral density of the reference signal, calculate the index of power spectral density difference; the index of power spectral density difference includes at least one of the following: relative energy gain within a specific frequency band, power spectral density peak shift, and frequency band energy ratio change.

[0091] Specifically, in some embodiments, the power spectral density difference between the reconstructed signal and the reference signal is calculated using the Welch method, including the following steps: Step 1: Estimation of the power spectral density of the reconstructed signal: (1) Pre-window the reconstructed signal (such as Hanning window), and segment it in an overlapping sliding window manner to obtain multiple reconstructed signals.

[0092] (2) Calculate the power spectrum of each segment of the reconstructed signal, average the power spectrum of each segment of the reconstructed signal, and obtain the power spectral density of the reconstructed signal, that is, the complete PSD curve of the reconstructed signal.

[0093] Step 2: Estimation of the power spectral density of the reference signal: In comparison, the same processing is applied to the reference real signal (which can be pre-stimulus data or a long-term statistical template), and its PSD is calculated. This includes: (1) The reference signal is pre-windowed and segmented by overlapping sliding windows to obtain multiple reference signals.

[0094] (2) Calculate the power spectrum of each segment of the reference signal, and average the power spectrum of each segment of the reference signal to obtain the power spectral density of the reference signal.

[0095] Step 3: Calculate the power spectral density difference index based on the power spectral density of the reconstructed signal and the power spectral density of the reference signal.

[0096] The indicators of power spectral density difference include at least one of the following: relative energy gain within a specific frequency band, power spectral density peak shift, and band energy ratio change. These three indicators are important metrics used in signal processing to quantify changes in spectral characteristics, and are used to quantify the characteristic values ​​of the spectrum as a function of time or conditions.

[0097] The meaning of relative energy gain in a specific frequency band is: within a selected frequency range (band), the increase in signal energy (power) relative to a certain reference state (such as baseline, normal operating condition) or other frequency bands is the proportion or multiple of the increase.

[0098] Power Spectral Density Peak Shift (PSD) refers to the shift or offset of the frequency position corresponding to the significant peak (maximum point) in a signal relative to a reference state (such as a baseline or nominal value).

[0099] The meaning of Change in Frequency Band Energy Ratio: refers to the change in the ratio of signal energy within two or more predefined frequency bands relative to a reference state.

[0100] The method provided in this embodiment estimates the power spectral density of the reconstructed signal and the reference signal. Based on the power spectral density of the reconstructed signal and the power spectral density of the reference signal, it calculates an index of the power spectral density difference. The index includes at least one of the following: relative energy gain within a specific frequency band, power spectral density peak offset, and frequency band energy ratio change. These indexes are used to quantify the changes in power spectral density (PSD) characteristics with system state or time, thereby enabling monitoring, diagnosis, or evaluation to ensure the accuracy of artifact localization and removal.

[0101] Figure 4 This is the second flowchart illustrating the real-time removal method for electrical stimulation artifacts provided by the present invention, as shown below. Figure 4 As shown, the method includes: Step 401: Use a high-pass filter to sample a segment of data to estimate artifacts; Step 402: Detect the rising edge online or set the artifact's arrival and departure times based on experience to accurately estimate the artifact's location; Step 403: Estimate the artifact template and use the artifact template to remove the low-amplitude portion of the artifact; Step 404: Perform high-amplitude artifact interpolation on each segment of the processed signal; Step 405: Output each processed signal segment in a loop to obtain the artifact-free data.

[0102] The method provided in this embodiment includes baseline detection and filtering, automatic or manual artifact location identification, and real-time artifact removal. The key to this invention lies in designing an online interpolated template method that combines the advantages of template removal and irregular sampling. Specifically, it is a real-time, efficient online interpolated template subtraction (Online ITS) method for removing electrical stimulation artifacts in the time domain. This method can effectively process periodic artifacts with combined high and low amplitudes, large pulse widths, and high stimulation frequencies online, thereby preserving more neural activity information.

[0103] The real-time removal device for electrical stimulation artifacts provided by the present invention will be described below. The real-time removal device for electrical stimulation artifacts described below can be referred to in correspondence with the real-time removal method for electrical stimulation artifacts described above.

[0104] Figure 5 This is a schematic diagram of the real-time removal system for electrical stimulation artifacts provided by the present invention. The real-time removal system 500 for electrical stimulation artifacts includes the following modules: Preprocessing module 510 is used to acquire local field potential signals from deep brain regions and perform baseline removal processing on the local field potential signals using a high-pass filter to obtain preprocessed potential signals; The artifact localization module 520 is used to monitor the rising edge of the preprocessed potential signal online and set an amplitude threshold, and jointly determine the low amplitude trailing artifact segment and the high amplitude stimulation artifact segment in the preprocessed potential signal. The artifact removal module 530 is used to remove artifacts from the low-amplitude trailing artifact segment using template subtraction to obtain the first signal. For the high-amplitude stimulus artifact segment, an interpolation method is used to process the high-amplitude stimulus artifact segment in the first signal to obtain the recovered reconstructed signal.

[0105] The apparatus provided in this embodiment firstly includes a preprocessing module 510, which acquires local field potential signals from deep brain regions and performs baseline removal processing on the local field potential signals using a high-pass filter to obtain a preprocessed potential signal. Then, an artifact localization module 520 is used to monitor the rising edge of the preprocessed potential signal online and set an amplitude threshold, jointly determining low-amplitude trailing artifact segments and high-amplitude stimulation artifact segments in the preprocessed potential signal. Subsequently, an artifact removal module 530 is used to remove artifacts from the low-amplitude trailing artifact segments using template subtraction to obtain a first signal, and to process the high-amplitude stimulation artifact segments in the first signal using an interpolation method to obtain a restored reconstructed signal.

[0106] In this invention, the local field potential signal is subjected to baseline removal processing to locate low-amplitude trailing artifacts and high-amplitude stimulation artifacts. Then, template subtraction is first used to remove the trailing artifacts with low amplitude and long pulse width. This method can more effectively preserve the underlying neural signals. After the trailing artifacts are removed, an interpolation method is used to further remove the high-amplitude artifacts of the main stimulation phase, resulting in a restored reconstructed signal. This method can achieve real-time, efficient and accurate removal of electrical stimulation artifacts, thereby improving the quality and accuracy of the signal.

[0107] According to the present invention, a real-time removal system 500 for electrical stimulation artifacts is provided, wherein the artifact removal module 530 is specifically used for: The start time of each stimulus event is located by detecting the rising edge or based on known stimulus parameters; the known stimulus parameters include at least one of frequency and pulse width. Set a time window to cover the trail artifact for each of the aforementioned stimulus events; A sliding window mechanism was used to extract the tail segment signals of multiple stimulation cycles; The tail segment signals of the multiple stimulation cycles are weighted and averaged to generate an artifact template; The low-amplitude trailing artifact segment is removed using the artifact template to obtain the first signal.

[0108] According to the present invention, a real-time removal system 500 for electrical stimulation artifacts is provided, wherein the artifact removal module 530 is further configured to: Based on different stimulus types and parameters, the template with the highest matching degree is selected from the preset template library as the artifact template; The low-amplitude trailing artifact segment is removed using the artifact template to obtain the first signal.

[0109] According to the present invention, a real-time removal system 500 for electrical stimulation artifacts is provided, wherein the artifact removal module 530 is further configured to: The start and end positions of the high-amplitude stimulus artifact segment are determined by threshold detection and rising edge recognition methods, and the segment where the start and end positions are located is identified as the signal missing segment. M sampling points are selected before and after the high-amplitude stimulus artifact segment as interpolation boundary points; M is greater than or equal to 1. The target interpolation method is selected based on the processing delay constraint, and the signal is restored based on the target interpolation method and the interpolation boundary points to obtain the reconstructed signal; the target interpolation method includes at least one of the following: linear interpolation, cubic spline interpolation and fast polynomial fitting method.

[0110] According to the present invention, a real-time removal system 500 for electrical stimulation artifacts is provided, wherein the real-time removal system 500 for electrical stimulation artifacts further includes a power spectral density evaluation module. The power spectral density evaluation module is used for: The power spectral density difference between the reconstructed signal and the reference signal was calculated using the Welch method. The artifact removal effect is evaluated based on the power spectral density difference. Based on the power spectral density difference, the artifact localization parameters or target interpolation method are dynamically adjusted.

[0111] According to the present invention, a real-time removal system 500 for electrical stimulation artifacts is provided, wherein the power spectral density evaluation module is specifically used for: The reconstructed signal is pre-windowed and segmented using overlapping sliding windows to obtain multiple reconstructed signal segments. Calculate the power spectrum of the reconstructed signal in each segment, and average the power spectrum of the reconstructed signal in each segment to obtain the power spectral density of the reconstructed signal; The reference signal is pre-windowed and segmented using overlapping sliding windows to obtain multiple reference signal segments. Calculate the power spectrum of the reference signal for each segment, and average the power spectra of the reference signal for each segment to obtain the power spectral density of the reference signal; Based on the power spectral density of the reconstructed signal and the power spectral density of the reference signal, an index of the power spectral density difference is calculated; the index of the power spectral density difference includes at least one of the following: relative energy gain within a specific frequency band, power spectral density peak shift, and frequency band energy ratio change.

[0112] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6 As shown, the electronic device may include: a processor 610, a communications interface 620, a memory 630, and a communication bus 640, wherein the processor 610, the communications interface 620, and the memory 630 communicate with each other via the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute a real-time removal method for electrical stimulation artifacts, the method including: Local field potential signals from deep brain regions are acquired, and high-pass filters are used to remove the baseline from these signals to obtain preprocessed potential signals. The rising edge of the preprocessed potential signal is monitored online and an amplitude threshold is set. The low-amplitude trailing artifact segment and the high-amplitude stimulation artifact segment in the preprocessed potential signal are jointly determined. For the low-amplitude trailing artifact segment, template subtraction is used to remove the artifact to obtain the first signal; For the high-amplitude stimulus artifact segment, an interpolation method is used to process the high-amplitude stimulus artifact segment in the first signal to obtain the recovered reconstructed signal.

[0113] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0114] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is capable of performing the real-time removal method for electrical stimulation artifacts provided by the above methods, the method comprising: Local field potential signals from deep brain regions are acquired, and high-pass filters are used to remove the baseline from these signals to obtain preprocessed potential signals. The rising edge of the preprocessed potential signal is monitored online and an amplitude threshold is set. The low-amplitude trailing artifact segment and the high-amplitude stimulation artifact segment in the preprocessed potential signal are jointly determined. For the low-amplitude trailing artifact segment, template subtraction is used to remove the artifact to obtain the first signal; For the high-amplitude stimulus artifact segment, an interpolation method is used to process the high-amplitude stimulus artifact segment in the first signal to obtain the recovered reconstructed signal.

[0115] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a real-time method for removing electrical stimulation artifacts provided by the methods described above, the method comprising: Local field potential signals from deep brain regions are acquired, and high-pass filters are used to remove the baseline from these signals to obtain preprocessed potential signals. The rising edge of the preprocessed potential signal is monitored online and an amplitude threshold is set. The low-amplitude trailing artifact segment and the high-amplitude stimulation artifact segment in the preprocessed potential signal are jointly determined. For the low-amplitude trailing artifact segment, template subtraction is used to remove the artifact to obtain the first signal; For the high-amplitude stimulus artifact segment, an interpolation method is used to process the high-amplitude stimulus artifact segment in the first signal to obtain the recovered reconstructed signal.

[0116] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0117] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0118] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for real-time removal of electrical stimulation artifacts, characterized in that, include: Local field potential signals from deep brain regions are acquired, and high-pass filters are used to remove the baseline from these signals to obtain preprocessed potential signals. The rising edge of the preprocessed potential signal is monitored online and an amplitude threshold is set. The low-amplitude trailing artifact segment and the high-amplitude stimulation artifact segment in the preprocessed potential signal are jointly determined. For the low-amplitude trailing artifact segment, template subtraction is used to remove the artifact to obtain the first signal; For the high-amplitude stimulus artifact segment, an interpolation method is used to process the high-amplitude stimulus artifact segment in the first signal to obtain the recovered reconstructed signal.

2. The method for real-time removal of electrical stimulation artifacts according to claim 1, characterized in that, The first signal is obtained by template subtraction for removing the low-amplitude trailing artifact segment, including: The start time of each stimulus event is located by detecting the rising edge or based on known stimulus parameters; the known stimulus parameters include at least one of frequency and pulse width. Set a time window to cover the trail artifact for each of the aforementioned stimulus events; A sliding window mechanism was used to extract the tail segment signals of multiple stimulation cycles; The tail segment signals of the multiple stimulation cycles are weighted and averaged to generate an artifact template; The low-amplitude trailing artifact segment is removed using the artifact template to obtain the first signal.

3. The method for real-time removal of electrical stimulation artifacts according to claim 1, characterized in that, The first signal is obtained by template subtraction for removing the low-amplitude trailing artifact segment, including: Based on different stimulus types and parameters, the template with the highest matching degree is selected from the preset template library as the artifact template; The low-amplitude trailing artifact segment is removed using the artifact template to obtain the first signal.

4. The method for real-time removal of electrical stimulation artifacts according to claim 1, characterized in that, The high-amplitude stimulus artifact segment is processed using an interpolation method to obtain the recovered reconstructed signal, including: The start and end positions of the high-amplitude stimulus artifact segment are determined by threshold detection and rising edge recognition methods, and the segment where the start and end positions are located is identified as the signal missing segment. M sampling points are selected before and after the high-amplitude stimulus artifact segment as interpolation boundary points; M is greater than or equal to 1. The target interpolation method is selected based on the processing delay constraint, and the signal is restored based on the target interpolation method and the interpolation boundary points to obtain the reconstructed signal; the target interpolation method includes at least one of the following: linear interpolation, cubic spline interpolation and fast polynomial fitting method.

5. The method for real-time removal of electrical stimulation artifacts according to claim 4, characterized in that, The method further includes: The power spectral density difference between the reconstructed signal and the reference signal was calculated using the Welch method. The artifact removal effect is evaluated based on the power spectral density difference. Based on the power spectral density difference, the artifact localization parameters or target interpolation method are dynamically adjusted.

6. The method for real-time removal of electrical stimulation artifacts according to claim 5, characterized in that, The calculation of the power spectral density difference between the reconstructed signal and the reference signal using the Welch method includes: The reconstructed signal is pre-windowed and segmented using overlapping sliding windows to obtain multiple reconstructed signal segments. Calculate the power spectrum of the reconstructed signal in each segment, and average the power spectrum of the reconstructed signal in each segment to obtain the power spectral density of the reconstructed signal; The reference signal is pre-windowed and segmented using overlapping sliding windows to obtain multiple reference signal segments. Calculate the power spectrum of the reference signal for each segment, and average the power spectra of the reference signal for each segment to obtain the power spectral density of the reference signal; Based on the power spectral density of the reconstructed signal and the power spectral density of the reference signal, an index of the power spectral density difference is calculated; the index of the power spectral density difference includes at least one of the following: relative energy gain within a specific frequency band, power spectral density peak shift, and frequency band energy ratio change.

7. A real-time removal system for electrical stimulation artifacts, characterized in that, include: The preprocessing module is used to acquire local field potential signals from deep brain regions and perform baseline removal processing on the local field potential signals using a high-pass filter to obtain preprocessed potential signals. The artifact localization module is used to monitor the rising edge of the preprocessed potential signal online and set an amplitude threshold, and jointly determine the low amplitude trailing artifact segment and the high amplitude stimulation artifact segment in the preprocessed potential signal. The artifact removal module is used to remove artifacts from the low-amplitude trailing artifact segment using template subtraction to obtain the first signal. For the high-amplitude stimulus artifact segment, an interpolation method is used to process the high-amplitude stimulus artifact segment in the first signal to obtain the recovered reconstructed signal.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the real-time removal method for electrical stimulation artifacts as described in any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the real-time removal method for electrical stimulation artifacts as described in any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the real-time removal method for electrical stimulation artifacts as described in any one of claims 1 to 6.