A real-time artifact removal method and system for deep brain electrical stimulation
By using the same clock source to synchronize electrical stimulation and signal sampling in deep brain stimulation, and combining dynamic template subtraction and demeaning processing, the problem of artifact removal at extremely low sampling rates is solved, achieving efficient and low-latency artifact removal, which is suitable for real-time closed-loop control of embedded systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- FUDAN UNIVERSITY
- Filing Date
- 2025-05-27
- Publication Date
- 2026-07-10
AI Technical Summary
Existing technologies struggle to achieve real-time artifact removal for deep brain stimulation at extremely low sampling rates, and existing methods are computationally complex and cannot meet the requirements for real-time closed-loop control.
By controlling the electrical stimulation output and signal sampling with the same clock source, the sampling point is aligned with the phase of the artifact. Combined with dynamic template subtraction and de-meaning processing, artifact removal is achieved in real time.
It achieves efficient artifact removal at extremely low sampling rates, reduces computational complexity, is suitable for embedded systems, and ensures the reliability of real-time closed-loop control.
Smart Images

Figure CN120849799B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical devices and instruments, and in particular to a method and system for real-time artifact removal for deep brain stimulation. Background Technology
[0002] Deep brain stimulation (DBS) is a widely used technique for treating movement disorders. Introducing closed-loop feedback control holds promise for optimizing its therapeutic effects while minimizing side effects. One promising closed-loop DBS (CL-DBS) approach uses local field potentials (LFPs) from the stimulating electrodes as feedback signals. These LFPs contain information about brain activity during stimulation, allowing stimulation parameters to be adjusted in real time based on neural state. However, to accurately decode brain activity, clean LFPs must be recovered from signals contaminated with stimulation artifacts.
[0003] Removing stimulus artifacts presents significant challenges. First, the amplitude of artifacts is often much larger than physiological, leading to severe distortion of recorded neural activity. Second, the frequency components of stimulus artifacts often overlap with those of the target LFP (Large Fiber Physician), making it difficult to distinguish and accurately extract the true LFP signal. Finally, artifact removal methods require high time efficiency to achieve real-time closed-loop modulation of DBS (Deep Brain Stimulation).
[0004] One effective method for artifact removal is filtering. Using a hardware filter before signal acquisition can remove stimulus artifacts in real time. This technique is effective during high-frequency stimulation because it significantly suppresses artifacts while preserving low-frequency physiological signals. However, this method has limited flexibility because real-time adjustment of filter parameters is difficult and introduces phase shifts into the low-frequency photofilter (LFP). Furthermore, during low-frequency stimulation, filtering may remove both stimulus artifacts and the LFP simultaneously, leading to suboptimal results.
[0005] In recent years, irregular sampling methods have been proposed. In this method, contaminated signal regions are replaced by linear interpolation, thereby achieving real-time artifact removal. Although this method can generate high-quality recovered LFPs, accurate identification of contaminated regions requires a high sampling rate and a wide dynamic range of the sampling circuit. Furthermore, this method may fail when the artifact region is too large.
[0006] Template subtraction is another effective method. This method removes artifacts by subtracting a predefined artifact template from the recorded signal. Recent advances in this field include the application of machine learning algorithms, optimized template matching strategies, and advanced signal reconstruction techniques; these advancements have demonstrated superior performance in offline artifact removal and LFP recovery. However, existing template subtraction algorithms still have several limitations. First, these methods typically require high sampling rates to capture the complete stimulus artifacts. Alternatively, they rely on high-sampling-rate signal reconstruction under offline conditions and accurate artifact alignment and removal algorithms. Second, these methods require significant computational resources and often necessitate offline data processing. Summary of the Invention
[0007] The purpose of this invention is to overcome the shortcomings of existing technologies by providing a real-time artifact removal method and system for deep brain stimulation (DBS). This method achieves real-time artifact removal with minimal computational requirements at extremely low sampling rates. The method removes artifacts with low latency and low computational complexity, ensuring reliable real-time artifact removal during DBS.
[0008] On the one hand, a real-time artifact removal method for deep brain stimulation is provided, comprising the following steps:
[0009] S1: Control the electrical stimulation output and signal sampling through the same clock source to ensure that the sampling points in each stimulation cycle are on the same phase of the stimulation artifact and are aligned with the phase of the stimulation artifact template.
[0010] S2: Before performing real-time artifact removal, dynamically set the artifact template update parameters based on the latest historical data;
[0011] S3: First, initialize the artifact template based on the early acquired signals after the stimulus begins. Then, remove artifacts from each newly input sampling point using the dynamic template subtraction method. The artifact template is dynamically updated based on the current sampling point data and the set artifact template update parameters.
[0012] S4: At the end of each stimulation cycle, the updated artifact template is de-meaned to eliminate low-frequency cumulative errors.
[0013] Further, in step S1, controlling the stimulus signal output and signal sampling through the same clock source includes:
[0014] Select a clock source, set frequency division constraints to make the sampling frequency an integer multiple of the stimulus frequency, and control the generation of the stimulus signal and the sampling trigger signal by the same selected clock source and ensure that the two are strictly aligned by a hardware trigger circuit.
[0015] Hardware triggering ensures that the sampling points in each cycle always fall on the same stimulus artifact phase.
[0016] Furthermore, in step S2, dynamically setting the artifact template update parameters based on the latest historical data specifically includes:
[0017] S21: In the latest historical data, obtain LFP signals from stimulus-off and stimulus-on records of the same duration, and use the LFP signal recorded during the stimulus-off period as the reference LFP signal. ;
[0018] S22: The artifact trajectory that changes over time is obtained by averaging several cycles before and after the stimulus activation period. ;
[0019] S23: The artifact trajectory is superimposed on the reference LFP signal to generate a contaminated LFP signal, so as to construct a simulated stimulus contamination curve;
[0020] S24: Select candidate update parameter sets sequentially. Each update parameter in The artifact template update parameter used in the dynamic template subtraction method is used to remove artifacts from the contaminated LFP signal, resulting in the recovered LFP signal. ;
[0021] S25: Determine the optimal update parameters based on the signal evaluation criteria and set them as the new artifact template update parameters.
[0022] Preferably, the step of determining the optimal artifact template update parameters according to the signal evaluation criteria specifically includes:
[0023] The recovered LFP signal was calculated using the Welch method. With reference LFP signal power spectral density and ;
[0024] Calculate the recovered LFP signal With reference LFP signal Relative error in different frequency bands The calculation formula is expressed as follows:
[0025] ;
[0026] The calculated relative error Minimum update parameters The optimal update parameters were determined.
[0027] Furthermore, in step S3, the artifact removal for each new input sampling point using the dynamic template subtraction method further includes:
[0028] The signals collected during the first few cycles after the stimulus begins are averaged over cycles to generate the initial template, as shown in the following formula:
[0029]
[0030] in, Number of samples per period This represents the initial number of stimulation cycles used for template calculations;
[0031] For each new input sampling point, the original LFP signal Calculate the phase index The artifact template corresponding to the index is called. The original LFP signal Subtract the artifact template of the call The artifact-free LFP signal is obtained. The formula is expressed as follows:
[0032] .
[0033] Furthermore, in step S3, the dynamic updating of the artifact template based on the current sampling point data and the set artifact template update parameters further includes:
[0034] Update parameters using the fake template The update speed of the artifact template is controlled, and the template update formula is expressed as follows:
[0035] ;
[0036] If the difference between the artifact amplitude and the template in the input period exceeds a preset threshold, temporarily increase the artifact template update parameter. To accelerate template updates and restore the initial artifact template update parameters after a set number of cycles. value.
[0037] Furthermore, in step S4, the demeaning process for the updated artifact template specifically includes:
[0038] At the end of each stimulation cycle, the low-frequency components of the artifact template are eliminated by subtracting the mean value of the artifact template within the cycle from the artifact template at each sampling point. The demeaning formula is expressed as follows:
[0039]
[0040] The dynamic template subtraction method is implemented to retain the low-frequency components of the LFP signal while removing stimulus artifacts.
[0041] On the other hand, a real-time artifact removal system for deep brain stimulation is provided, comprising:
[0042] The stimulation sampling synchronization control module is used to control the electrical stimulation output and signal sampling through the same clock source, ensuring that the sampling points in each stimulation cycle are on the same phase of the stimulation artifact and are aligned with the phase of the stimulation artifact template.
[0043] The template update parameter setting module is used to dynamically set the artifact template update parameters based on the latest historical data before performing real-time artifact removal.
[0044] The artifact removal module is used to first initialize the artifact template based on the early acquired signals after the stimulus begins, and then remove artifacts from each newly input sampling point through dynamic template subtraction. The artifact template is dynamically updated based on the current sampling point data and the set artifact template update parameters.
[0045] The low-frequency component processing module is used to perform mean-reduction processing on the updated artifact template at the end of each stimulation cycle to eliminate low-frequency cumulative errors.
[0046] Meanwhile, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that the program includes a bootloader and an application program, which, when executed by a processor, implements the real-time artifact removal method for deep brain stimulation as described above.
[0047] In addition, an electronic device is provided, comprising: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the real-time artifact removal method for deep brain stimulation as described above.
[0048] Compared with the prior art, the beneficial effects of the present invention are:
[0049] This invention uses stimulus-sampling synchronization technology to ensure that the sampling points in each stimulus cycle are on a fixed phase of the stimulus artifact and are aligned with the phase of the artifact template. This enables efficient artifact removal at extremely low sampling rates, which is significantly lower than traditional methods.
[0050] The template subtraction method and mean removal operation of this invention only require addition, subtraction and mean calculation, which significantly reduces the single processing latency and is suitable for embedded systems;
[0051] This invention can track artifact waveform changes (such as electrode impedance fluctuations) in real time through dynamic template updates and adaptive parameter selection, thus avoiding the failure problem of traditional static templates.
[0052] This invention effectively eliminates low-frequency interference (such as electrode drift) by template demeaning, while preserving the physiological components of LFP. Attached Figure Description
[0053] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0054] Figure 1 This is a schematic diagram of a real-time artifact removal method for deep brain electrical stimulation according to the present invention.
[0055] Figure 2 This is a schematic diagram illustrating a stimulus-sampling synchronization scenario according to the present invention;
[0056] Figure 3 This is a schematic diagram illustrating the real-time alignment of a template according to the present invention;
[0057] Figure 4 This is a schematic diagram illustrating the difference between traditional alignment and stimulus sampling synchronous alignment at low sampling frequencies according to the present invention.
[0058] Figure 5 This is a schematic table illustrating the relative error results at various stimulation frequencies and specific frequency bands according to the present invention.
[0059] Figure 6 This is a hardware structure block diagram for implementing the method of this invention. Detailed Implementation
[0060] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0061] This invention proposes a real-time artifact removal method and system for deep brain stimulation (DBS), which is applied to closed-loop DBS modulation. The method achieves real-time artifact removal under extremely low sampling rate conditions through stimulation sampling synchronization technology, real-time updating and subtraction algorithm of dynamic template, and adaptive dynamic template update parameter selection algorithm.
[0062] The specific embodiments of the present invention will be described below with reference to the accompanying drawings and examples.
[0063] Example 1
[0064] Please see Figure 1 The technical solution for a real-time artifact removal method for deep brain stimulation provided in this embodiment includes the following steps:
[0065] S1: Control the electrical stimulation output and signal sampling through the same clock source to ensure that the sampling points in each stimulation cycle are on the same phase of the stimulation artifact and are aligned with the phase of the stimulation artifact template.
[0066] S2: Before performing real-time artifact removal, dynamically set the artifact template update parameters based on the latest historical data;
[0067] S3: First, initialize the artifact template based on the early acquired signals after the stimulus begins. Then, remove artifacts from each newly input sampling point using the dynamic template subtraction method. The artifact template is dynamically updated based on the current sampling point data and the set artifact template update parameters.
[0068] S4: At the end of each stimulation cycle, the updated artifact template is de-meaned to eliminate low-frequency cumulative errors.
[0069] In this process, we adopt stimulus-sampling synchronization control as described in step S1, where sampling and stimulation are controlled by the same clock, such as... Figure 2 As shown, this ensures that they maintain a consistent temporal relationship within each stimulus cycle. Therefore, the sampling points within each cycle always fall on the same stimulus artifact phase, thus guaranteeing accurate real-time alignment of the stimulus artifact and the artifact template, and enabling real-time template subtraction. This method differs from traditional low-sampling-rate alignment as follows: Figure 3 As shown.
[0070] Specifically, first, a clock source is selected, and frequency division constraints are set so that the sampling frequency is an integer multiple of the stimulation frequency. The stimulation signal generation and the sampling trigger signal are controlled by the same selected clock source, and the two are strictly aligned by a hardware trigger circuit.
[0071] Then, hardware triggering is used to ensure that the sampling points in each cycle always fall on the same stimulus artifact phase.
[0072] In this embodiment, since the alignment of stimulus artifacts during the sampling process is controlled by the hardware system, the method can effectively remove artifacts even at low sampling rates, greatly improving adaptability and enabling its application to lightweight devices. Figure 4As shown, the sampling frequency can be any multiple of the stimulation frequency. For example, at a stimulation frequency of 130 Hz, the minimum required sampling rate is only 260 Hz. Therefore, this sampling rate is compatible with commercial devices, such as PINS Medical's DBS devices.
[0073] To achieve artifact removal as described in this invention, we propose a dynamic template subtraction method to adapt to artifact waveform changes caused by variations in the physiological environment during deep brain stimulation (DBS). This method continuously updates the artifact template to adapt to real-time artifact changes, thereby achieving more accurate artifact removal.
[0074] Specifically, we first perform the dynamic setting of the artifact template update parameters based on the latest historical data as described in step S2, including:
[0075] S21: In the latest historical data, obtain LFP signals from stimulus-off and stimulus-on records of the same duration, and use the LFP signal recorded during the stimulus-off period as the reference LFP signal. ;
[0076] S22: The artifact trajectory that changes over time is obtained by averaging several cycles before and after the stimulus activation period. ;
[0077] S23: The artifact trajectory is superimposed on the reference LFP signal to generate a contaminated LFP signal, so as to construct a simulated stimulus contamination curve;
[0078] S24: Select candidate update parameter sets sequentially. Each update parameter in The artifact template update parameter used in the dynamic template subtraction method is used to remove artifacts from the contaminated LFP signal, resulting in the recovered LFP signal. ;
[0079] S25: Determine the optimal update parameters based on the signal evaluation criteria and set them as the new artifact template update parameters.
[0080] Specifically, the optimal artifact template update parameters determined according to the signal evaluation criteria include:
[0081] The recovered LFP signal was calculated using the Welch method. With reference LFP signal power spectral density and By segmenting the signal and allowing overlap, and then averaging the results after performing Fourier transforms on each segment, the variance of the spectral estimation is reduced. The reference formula for calculating the power spectral density is as follows:
[0082]
[0083] in, For the number of segments, Indicates the first Fourier transform of the segment To remove the mean factor from the energy of the window function. , For window functions, The window length is 2 seconds, and the overlap length is 1 second in this embodiment.
[0084] The recovered LFP signal is then calculated within the frequency range of 1–150 Hz. With reference LFP signal Relative error in different frequency bands The calculation formula is expressed as follows:
[0085] ;
[0086] The calculated relative error Minimum update parameters The optimal update parameters were determined.
[0087] In this embodiment, the procedures for the human body and the in vitro process are the same. We choose to show an example of template parameter selection under the in vitro process, as follows:
[0088] 1. Record the local field potential data for 1 minute when the stimulus is turned on;
[0089] 2. Record the local field potential data for 1 minute after the stimulus is turned off;
[0090] 3. The data at the start of stimulation were averaged over a time window of 300 stimulation cycles to exclude EEG components and retain only the changing stimulus artifact curves;
[0091] 4. The changing stimulus artifacts are superimposed on the local field potential data when the stimulus is off to construct a simulated stimulus contamination curve (the size of the artifacts, the amplitude of the artifact changes, and the amplitude of the EEG in this curve are all consistent with the patient).
[0092] 5. Use dynamic template subtraction to filter out the template using different update parameters to obtain the recovered signal (try 0-0.2, with a scale value of 0.01, and try a total of 20 cases. If there is a higher computational burden, the scale value can be further reduced).
[0093] 6. Calculate the relative error between the recovery signal and the local field potential when the stimulus is turned off. The update parameter corresponding to the signal with the smallest relative error is the optimal update parameter. In this embodiment, we selected an update parameter of 0.005 for the in vitro experiment. The selection of the update parameter is crucial because a small error is detrimental. This results in slower template updates, making it difficult to track changes in artifact waveforms. Larger... This may introduce excessive LFP components into the template, thereby distorting the recovered LFP signal. Therefore, selecting an appropriate template is crucial. Crucially, it must find a balance between the tracking speed of the artifact waveform and the integrity of the LFP signal.
[0094] Under this updated parameter, we performed artifact removal on stimuli of different frequencies and calculated their relative errors, as shown in the table below. Figure 5 As shown. Under this updated parameter, the further specific process of artifact removal using the dynamic template subtraction method in step S3 includes:
[0095] The signals collected during the first few cycles after the stimulus begins are averaged over cycles to generate the initial template, as shown in the following formula:
[0096]
[0097] in, Number of samples per period This represents the initial number of stimulation cycles used for template calculations;
[0098] For each new input sampling point, the original LFP signal Calculate the phase index The artifact template corresponding to the index is called. The original LFP signal Subtract the artifact template of the call The artifact-free LFP signal is obtained. The formula is expressed as follows:
[0099] .
[0100] Since the stimulus artifacts change over time, the template must be updated in real time based on the latest data to adapt to the changes in the artifact waveform. The artifact template is dynamically updated based on the current sampling point data and the set artifact template update parameters, specifically including:
[0101] Using the updated parameters obtained by the method described in S2, and the latest sample point data, the template is updated. The update formula is expressed as follows:
[0102] ;
[0103] If the difference between the artifact amplitude and the template in the input period exceeds a preset threshold, which is set to 20% in this embodiment, the artifact template update parameter is temporarily increased. To accelerate template updates and adapt to new artifacts more quickly, and to restore the initial artifact template update parameters after a set number of cycles. value.
[0104] At the end of each stimulation cycle, the template undergoes a mean-reduction process as described in step S4, which eliminates low-frequency components (such as baseline drift caused by electrodes, external noise in the experimental environment) by subtracting the template mean from each data point within the cycle. The mean-reduction formula is expressed as follows:
[0105]
[0106] This step enables the dynamic template subtraction method to retain the low-frequency components of the LFP signal while removing stimulus artifacts.
[0107] To implement the above method, taking in vitro experiments as an example, we select hardware devices such as... Figure 6 As shown in the figure. Experimental results demonstrate that this method can remove stimulus artifacts with low latency and low computational complexity, making it suitable for low-power embedded systems (such as microcontroller units, MCUs). This ensures that the method can reliably remove stimulus artifacts in real time during DBS.
[0108] On the other hand, this embodiment also provides a real-time artifact removal system for deep brain stimulation, comprising:
[0109] The stimulus sampling synchronization control module is used to control the generation and sampling of stimulus signals through the same clock source, ensuring that the sampling points in each stimulus cycle are on the same phase of the stimulus artifact and are aligned with the real-time phase of the artifact template.
[0110] The template update parameter setting module is used to dynamically set the artifact template update parameters based on the latest historical data before performing real-time artifact removal.
[0111] The artifact removal module is used to first initialize the artifact template based on the early acquired signals after the stimulus begins, and then remove artifacts from each newly input sampling point through dynamic template subtraction. The artifact template is dynamically updated based on the current sampling point data and the set artifact template update parameters.
[0112] The low-frequency component processing module is used to perform de-meaning processing on the updated artifact template at the end of each stimulation cycle to eliminate low-frequency cumulative errors.
[0113] It should be noted that the steps in the real-time artifact removal method for deep brain stimulation provided in this embodiment can be implemented using corresponding modules in the real-time artifact removal system for deep brain stimulation. Those skilled in the art can refer to the technical solution of the system to implement the steps of the method. That is, the embodiments in the system can be understood as preferred examples of implementing the method, and will not be elaborated here.
[0114] Besides implementing the system and its various devices provided by this invention in purely computer-readable program code, the same functions can be achieved by logically programming the method steps, making the system and its various devices of this invention appear as logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, the system and its various devices provided by this invention can be considered as a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component; alternatively, the devices for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0115] Finally, it should be noted that the above description is only a preferred embodiment of the present invention, and the scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be pointed out that for those skilled in the art, any improvements and modifications made without departing from the principle of the present invention should also be considered within the scope of protection of the present invention.
[0116] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
Claims
1. A method for real-time artifact removal for deep brain stimulation, characterized in that, Includes the following steps: S1: Control the electrical stimulation output and signal sampling through the same clock source to ensure that the sampling points in each stimulation cycle are on the same phase of the stimulation artifact and are aligned with the phase of the stimulation artifact template. S2: Before performing real-time artifact removal, dynamically set the artifact template update parameters based on the latest historical data; S3: First, initialize the artifact template based on the early acquired signals after the stimulus begins. Then, remove artifacts from each newly input sampling point using the dynamic template subtraction method. The artifact template is dynamically updated based on the current sampling point data and the set artifact template update parameters. S4: At the end of each stimulation cycle, the updated artifact template is de-meaned to eliminate low-frequency cumulative errors; In step S3, the artifact removal for each new input sampling point using the dynamic template subtraction method further includes: The signals collected during the first few cycles after the stimulus begins are averaged over cycles to generate the initial template, as shown in the following formula: , in, Number of samples per period This represents the initial number of stimulation cycles used for template calculations; For each new input sampling point, the original LFP signal Calculate the phase index The artifact template corresponding to the index is called. The original LFP signal Subtract the artifact template of the call The artifact-free LFP signal is obtained. The formula is expressed as follows: ; The dynamic updating of the artifact template based on the current sampling point data and the set artifact template update parameters further includes: Update parameters using the fake template The update speed of the artifact template is controlled, and the template update formula is expressed as follows: ; If the difference between the artifact amplitude and the template in the input period exceeds a preset threshold, temporarily increase the artifact template update parameter. To accelerate template updates and restore the initial artifact template update parameters after a set number of cycles. value; In step S4, the process of removing the mean from the updated artifact template specifically includes: At the end of each stimulation cycle, the low-frequency components of the artifact template are eliminated by subtracting the mean value of the artifact template within the cycle from the artifact template at each sampling point. The demeaning formula is expressed as follows: , The dynamic template subtraction method is implemented to retain the low-frequency components of the LFP signal while removing stimulus artifacts.
2. The real-time artifact removal method for deep brain stimulation according to claim 1, characterized in that, In step S1, controlling the stimulus signal output and signal sampling through the same clock source further includes: Select a clock source, set frequency division constraints to make the sampling frequency an integer multiple of the stimulus frequency, and control the generation of the stimulus signal and the sampling trigger signal by the same selected clock source and ensure that the two are strictly aligned by a hardware trigger circuit. Hardware triggering ensures that the sampling points in each cycle always fall on the same stimulus artifact phase.
3. The real-time artifact removal method for deep brain stimulation according to claim 1, characterized in that, In step S2, dynamically setting the artifact template update parameters based on the latest historical data further includes: S21: In the latest historical data, obtain LFP signals from stimulus-off and stimulus-on records of the same duration, and use the LFP signal recorded during the stimulus-off period as the reference LFP signal. ; S22: The artifact trajectory that changes over time is obtained by averaging several cycles before and after the stimulus activation period. ; S23: The artifact trajectory is superimposed on the reference LFP signal to generate a contaminated LFP signal, so as to construct a simulated stimulus contamination curve; S24: Select candidate update parameter sets sequentially. Each update parameter in The artifact template update parameter used in the dynamic template subtraction method is used to remove artifacts from the contaminated LFP signal, resulting in the recovered LFP signal. ; S25: Determine the optimal update parameters based on the signal evaluation criteria and set them as the new artifact template update parameters.
4. The real-time artifact removal method for deep brain stimulation according to claim 3, characterized in that, The optimal artifact template update parameters determined according to the signal evaluation criteria specifically include: The recovered LFP signal was calculated using the Welch method. With reference LFP signal power spectral density and ; Calculate the recovered LFP signal With reference LFP signal Relative error in different frequency bands The calculation formula is expressed as follows: ; The calculated relative error Minimum update parameters The optimal update parameters were determined.
5. A real-time artifact removal system for deep brain stimulation, characterized in that, include: The stimulation sampling synchronization control module is used to control the electrical stimulation output and signal sampling through the same clock source, ensuring that the sampling points in each stimulation cycle are on the same phase of the stimulation artifact and are aligned with the phase of the stimulation artifact template. The template update parameter setting module is used to dynamically set the artifact template update parameters based on the latest historical data before performing real-time artifact removal. The artifact removal module is used to first initialize the artifact template based on the early acquired signals after the stimulus begins, and then remove artifacts from each newly input sampling point through dynamic template subtraction. The artifact template is dynamically updated based on the current sampling point data and the set artifact template update parameters. The low-frequency component processing module is used to perform de-meaning processing on the updated artifact template at the end of each stimulation cycle to eliminate low-frequency cumulative errors. The artifact removal process for each new input sampling point using the dynamic template subtraction method further includes: The signals collected during the first few cycles after the stimulus begins are averaged over cycles to generate the initial template, as shown in the following formula: , in, Number of samples per period This represents the initial number of stimulation cycles used for template calculations; For each new input sampling point, the original LFP signal Calculate the phase index The artifact template corresponding to the index is called. The original LFP signal Subtract the artifact template of the call The artifact-free LFP signal is obtained. The formula is expressed as follows: ; The dynamic updating of the artifact template based on the current sampling point data and the set artifact template update parameters further includes: Update parameters using the fake template The update speed of the artifact template is controlled, and the template update formula is expressed as follows: ; If the difference between the artifact amplitude and the template in the input period exceeds a preset threshold, temporarily increase the artifact template update parameter. To accelerate template updates and restore the initial artifact template update parameters after a set number of cycles. value; The process of removing the mean from the updated artifact template specifically includes: At the end of each stimulation cycle, the low-frequency components of the artifact template are eliminated by subtracting the mean value of the artifact template within the cycle from the artifact template at each sampling point. The demeaning formula is expressed as follows: , The dynamic template subtraction method is implemented to retain the low-frequency components of the LFP signal while removing stimulus artifacts.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the real-time artifact removal method for deep brain electrical stimulation as described in any one of claims 1-4.
7. An electronic device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the real-time artifact removal method for deep brain stimulation as described in any one of claims 1-4.