A heart phase-locked transcranial magnetic stimulation method and system based on cardio-cerebral axis navigation positioning

By combining ECG prediction with the TimeMixer model and cardiac-brain axis navigation, the problems of large individual differences, complex closed-loop control and susceptibility to interference, and inaccurate target localization in existing transcranial magnetic stimulation techniques have been solved, realizing individualized transcranial magnetic stimulation effects and central-autonomic nervous system synergistic regulation.

CN122321344APending Publication Date: 2026-07-03XIDIAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XIDIAN UNIV
Filing Date
2026-05-19
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing transcranial magnetic stimulation (TMS) techniques suffer from problems such as large individual variability, complex closed-loop control that is susceptible to interference, and inaccurate target localization. In particular, they neglect the interaction between the central nervous system and the autonomic nervous system.

Method used

The TimeMixer model is used to combine ECG prediction with brain-heart axis navigation. By preprocessing the ECG signal, the R peak and T wave endpoint are identified, the systolic and diastolic phases of the heart are divided, and the transcranial magnetic stimulation target is determined by combining the brain fMRI signal, so as to achieve individualized closed-loop control.

Benefits of technology

It achieves individualized transcranial magnetic stimulation effects, improves prediction accuracy and anti-interference ability, solves the problem of inaccurate target localization, and realizes central-autonomic nervous system coordinated regulation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122321344A_ABST
    Figure CN122321344A_ABST
Patent Text Reader

Abstract

A heart phase-locked transcranial magnetic stimulation method and system based on heart-brain axis navigation positioning, the method comprising inputting a preprocessed electrocardiogram signal into a trained and converged TimeMixer model to output a predicted electrocardiogram waveform signal; splicing the predicted electrocardiogram waveform sequence and the original electrocardiogram waveform sequence to obtain a global electrocardiogram sequence, identifying effective R peaks and T wave peaks and determining T wave endpoints on the global electrocardiogram sequence; dividing the systole and diastole of the heart using the effective R peaks and the T wave endpoints, and assigning and encoding the systole and diastole of the heart; determining the target position of the transcranial magnetic stimulation according to the encoding labels corresponding to the systole and diastole of the heart and the transcranial magnetic stimulation target position determined by the heart-brain axis navigation mode, and controlling the parameters of the transcranial magnetic stimulation; by combining the electrocardiogram prediction of the TimeMixer model with the individualized stimulation target point determined by the heart-brain axis navigation, the problems of ignoring individual physiological state in the existing open-loop control, complex closed-loop acquisition being easily disturbed, and inaccurate target point positioning are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of transcranial magnetic stimulation (TMS) technology, specifically to a cardiac phase-locked TMS method and system based on cardiac-brain axis navigation and positioning. Background Technology

[0002] Transcranial magnetic stimulation (TMS) is a non-invasive physical neuromodulation technique with broad application prospects. Its basic principle is to generate a rapidly changing magnetic field by placing stimulation coils on the scalp, which induces current in brain tissue, thereby regulating the neuronal activity in specific brain regions.

[0003] However, the effects of transcranial magnetic stimulation (TMS) vary significantly among individuals, mainly in the following aspects: 1. Most existing TMS techniques employ open-loop methods, using the same stimulation protocol for all subjects without considering their individual physiological states, leading to substantial individual differences in stimulation effects; 2. Most current mainstream closed-loop stimulation techniques rely on EEG or near-infrared imaging for closed-loop control of TMS parameters. However, EEG and near-infrared spectroscopy signal acquisition equipment is complex in structure, cumbersome in operation, and susceptible to signal interference, making processing relatively complicated; 3. Traditional TMS navigation and positioning often employs standard brain templates, brain activation, and individualized functional connectivity, considering only the abnormal characteristics of the central nervous system while neglecting the interaction between the central and autonomic nervous systems.

[0004] The invention patent CN117531118 A proposes a personalized TMS stimulation method and system that integrates MRI imaging data and EEG signals. This method uses MRI to locate and place electrodes. After acquiring and purifying EEG signals, it uses an AR model to predict future EEG signals, thereby accurately calculating the optimal time to trigger TMS magnetic stimulation at a specific phase (zero phase) of the alpha wave. This solves the problem of spatiotemporal accuracy of TMS stimulation in clinical practice and significantly improves the therapeutic effect of TMS. However, this method uses EEG signals for closed-loop control of transcranial magnetic stimulation, resulting in a cumbersome EEG acquisition process, high time complexity of the signal processing algorithm, and low computational efficiency. Furthermore, the stability of the EEG signals is poor under interference from external magnetic fields, limb movement, and electromyographic activity. In addition, this navigation and positioning method uses a standard brain atlas for localization, neglecting the interaction between the central nervous system and the autonomic nervous system. Summary of the Invention

[0005] In order to overcome the shortcomings of the existing technology, the present invention aims to provide a cardiac phase-locked transcranial magnetic stimulation method and system based on cardiac-brain axis navigation positioning. By combining the electrocardiogram prediction of the TimeMixer model with the determination of individualized stimulation targets by cardiac-brain axis navigation, the present invention solves the problems of existing open-loop control ignoring individual physiological state, closed-loop acquisition being complex and susceptible to interference, and inaccurate target positioning.

[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A cardiac phase-locked transcranial magnetic stimulation method based on cardiac-brain axis navigation and localization includes the following steps: Step 1: Preprocess the acquired raw electrocardiogram signals; Step 2: Input the preprocessed ECG signal into the TimeMixer model after training and convergence, and output the predicted ECG waveform signal; Step 3: After splicing the predicted ECG waveform signal sequence with the original ECG waveform signal sequence, the global ECG sequence is obtained. The effective R peak and T wave peak are identified sequentially on the global ECG sequence, and the T wave endpoint of the global ECG sequence is determined based on the median of the interval between the T wave peak and the T wave endpoint in the original ECG waveform signal sequence. Step 4: Use the effective R peak and T wave endpoint of the global electrocardiogram sequence to divide the systolic and diastolic phases of the heart, and assign values ​​to the systolic and diastolic phases to obtain the corresponding status labels; Step 5: Determine the location of the transcranial magnetic stimulation target point using the brain-heart axis navigation method; Step 6: Control the parameters of the transcranial magnetic stimulation according to the status labels corresponding to the systolic and diastolic phases of the heart and the location of the transcranial magnetic stimulation target point.

[0007] Furthermore, step 1 specifically includes: Step 1.1: Use an IIR digital notch filter to process the power frequency interference of the acquired raw ECG signal; Step 1.2: Perform polyphase filtering on the ECG signal after power frequency interference processing to obtain the downsampled ECG signal; Step 1.3: Use the Butterworth filter to extract the ECG frequency band from the downsampled ECG signal to obtain the ECG signal with effective frequency bands; Step 1.4: Perform local normalization on the effective frequency band of the ECG signal to obtain the preprocessed ECG signal.

[0008] Furthermore, in step 3, valid R peaks and T wave peaks are sequentially identified on the global ECG sequence, and the T wave endpoint of the global ECG sequence is determined based on the median interval between the T wave peak and the T wave endpoint in the original ECG waveform signal sequence. The implementation method is as follows: A peak-finding algorithm was used to identify the location of the R-peak in the global electrocardiogram sequence and obtain candidate R-peaks. Calculate the mean and standard deviation of the candidate R peaks, and then calculate the significance of the candidate R peak voltage values ​​based on the mean and standard deviation of the candidate R peaks. If the significance of the candidate R peak voltage value is lower than the preset threshold, the candidate R peak is determined to be a false peak and is removed from the global ECG sequence. If the significance of the candidate R peak voltage value is higher than the preset threshold, the R peak is determined to be a valid R peak and is retained in the global ECG sequence. Using the effective R peak as an anchor point, the peak value of the T wave is searched within the subsequent time window. The median of the time interval between the peak value of the T wave and the end point of the T wave in the original electrocardiogram waveform sequence is counted, and the median of this time interval is superimposed on the peak value of the T wave to obtain the position of the end point of the T wave.

[0009] Furthermore, step 4 specifically includes: Step 4.1: Mark the time of each valid R peak and obtain the timestamp corresponding to each valid R peak; Step 4.2: Based on the timestamp of the current effective R peak, define the time window from the current effective R peak to the end of the T wave as the cardiac systolic period, and define the time window from the end of the T wave to the next effective R peak as the cardiac diastolic period. Step 4.3: Perform binary state encoding on the time axis of the heart's systolic and diastolic signals respectively. If the current time is within the systolic time window, the state label is assigned as 1; if it is within the diastolic time window, the state label is assigned as 0.

[0010] Furthermore, step 5 specifically includes: Step 5.1: Simultaneously acquire brain fMRI signals while acquiring raw electrocardiogram signals; Step 5.2: After performing image preprocessing on the brain fMRI signal, extract the time series corresponding to each voxel in the gray matter of the brain region from the image preprocessed brain fMRI data to obtain the fMRI time series; Step 5.3: Use the peak-finding algorithm to identify the R-peak position of the original ECG signal, calculate the RR interval sequence, and resample the RR interval sequence into an equal-interval time sequence to obtain an equal-interval RR interval sequence; Step 5.4: After bandpass filtering the fMRI time series and the equally spaced RR interval series, the RR interval series is first resampled to the fMRI sampling rate, and then Hilbert transform is used to extract the instantaneous phase of the bandpass-filtered fMRI time series and the instantaneous envelope amplitude of the RR interval series. Step 5.5: Based on the instantaneous phase of the fMRI time series and the instantaneous envelope amplitude of the RR interval sequence, calculate the true heart-brain coupling strength of each voxel using the average vector amplitude method; Step 5.6: Construct the chance-level heart-brain coupling distribution and standardize the true heart-brain coupling strength for each voxel; Step 5.7: Threshold the true heart-brain coupling intensity of each standardized voxel, and match the transcranial magnetic stimulation target location based on the thresholding result.

[0011] Furthermore, step 5.6 specifically includes: The instantaneous envelope amplitude of the RR interval sequence is cyclically shifted multiple times; Based on the instantaneous phase of the fMRI time series and the instantaneous envelope amplitude of the RR interval sequence after each cyclic translation, the chance level of cardio-brain coupling strength of each voxel after multiple translations is calculated using the average vector amplitude method. The chance-level heart-brain coupling distribution is constructed by the chance-level heart-brain coupling strength values ​​of each voxel after multiple translations. The true heart-brain coupling strength of each voxel is standardized relative to its chance-level heart-brain coupling distribution.

[0012] Furthermore, step 5.7 specifically includes: The true heart-brain coupling strength of each standardized voxel is thresholded according to a preset threshold, and candidate voxels that meet the threshold conditions are selected. Spatial connectivity analysis is performed on candidate voxels that meet the threshold conditions, and spatially connected candidate voxels are grouped into one or more candidate heart-brain coupling clusters. For candidate cardio-brain coupling clusters that meet the transcranial magnetic stimulation accessibility criteria, calculate their average normalized cardio-brain coupling strength. The candidate heart-brain coupling cluster with the highest average normalized heart-brain coupling strength was selected as the optimal candidate cluster, and the voxel with the highest normalized heart-brain coupling strength within the optimal candidate cluster was selected as the transcranial magnetic stimulation target location.

[0013] Furthermore, the accessibility conditions for the transcranial magnetic stimulation are as follows: Candidate cardio-brain coupling clusters are located in the superficial cortical region, and the number of voxels in the candidate cardio-brain coupling clusters is greater than or equal to 20.

[0014] A cardiac phase-locked transcranial magnetic stimulation system based on cardiac-brain axis navigation and positioning includes: Signal preprocessing module: preprocesses the acquired raw electrocardiogram signals; ECG waveform prediction module: Input the preprocessed ECG signal into the TimeMixer model after training and convergence, and output the predicted ECG waveform signal; The R-peak identification and T-wave endpoint determination module splices the predicted ECG waveform signal sequence with the original ECG waveform signal sequence to obtain a global ECG sequence. Valid R-peaks and T-wave peaks are identified sequentially on the global ECG sequence, and the T-wave endpoint of the global ECG sequence is determined based on the median interval between the T-wave peak and the T-wave endpoint in the original ECG waveform signal sequence. Systolic and diastolic phase segmentation and encoding module: The effective R peak and T wave endpoint of the global electrocardiogram sequence are used to segment the systolic and diastolic phases of the heart, and the systolic and diastolic phases are assigned values ​​and encoded to obtain the corresponding status labels; Transcranial stimulation target localization module: The location of transcranial magnetic stimulation target points is determined using a heart-brain axis navigation method; Transcranial magnetic stimulation parameter control module: controls the parameters of the transcranial magnetic stimulation based on the status labels corresponding to the systolic and diastolic phases of the heart and the location of the transcranial magnetic stimulation target.

[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. Step 2 of this invention involves inputting the preprocessed electrocardiogram (ECG) signal into the converged TimeMixer model. The TimeMixer model extracts the ECG waveform signal, effectively capturing ECG waveform features and predicting baseline shift. Combined with the division of systole and diastole in steps 3-4, It solves the problem of neglecting individual physiological state in existing open-loop control of transcranial magnetic stimulation, and also solves the problems of complex acquisition equipment structure, cumbersome operation process and complex signal processing in traditional EEG or near-infrared closed-loop control. It has the characteristics of accurate prediction, simple closed loop and strong anti-interference.

[0016] 2. Step 5 of this invention uses a heart-brain axis navigation method to determine the location of individualized transcranial magnetic stimulation targets, which solves the problem of inaccurate target positioning caused by neglecting the interaction between the central nervous system and the autonomic nervous system in existing navigation and positioning methods. It achieves precise individualized target positioning and good central-autonomic nervous system synergistic regulation effect, and has the characteristics of highly individualized and precise heart-brain synergistic positioning.

[0017] In summary, this invention combines ECG prediction using the TimeMixer model with cardio-brain axis navigation to determine individualized stimulation targets. This solves the problems of existing open-loop control ignoring individual physiological states, complex and easily interfered closed-loop acquisition, and inaccurate target localization. It achieves real-time individualized closed-loop regulation capability based on ECG prediction, precise individualized target localization, and central-autonomous coordinated regulation effect. It features accurate prediction, simple closed-loop, strong anti-interference, high individualization, and precise cardio-brain coordinated localization. Attached Figure Description

[0018] Figure 1 This is a flowchart of the cardiac phase-locked transcranial magnetic stimulation method based on heart-brain axis navigation and positioning according to the present invention.

[0019] Figure 2 This is a schematic diagram showing the attachment position of the three-lead ECG electrode of the present invention.

[0020] Figure 3This is the original electrocardiogram image acquired in this invention.

[0021] Figure 4 This is an architecture diagram of the TimeMixer model of the present invention.

[0022] Figure 5 This is a diagram of the electrocardiogram waveform signal predicted by the TimeMixer model of this invention.

[0023] Figure 6 This is a schematic diagram illustrating the division of the cardiac systolic and diastolic phases according to the present invention.

[0024] Figure 7 This is a statistical diagram showing the error of R-peak detection in predicting ECG waveform signals based on the TimeMixer model.

[0025] Figure 8 This is a statistical diagram showing the error of R-peak detection in ECG waveform signal prediction based on the TimesNet model.

[0026] Figure 9 This is a statistical diagram showing the error of R-peak detection in ECG waveform signal prediction based on the Informer model.

[0027] Figure 10 This is a statistical diagram showing the error of R-peak detection in ECG waveform signal prediction based on the Pyraformer model.

[0028] Figure 11 This is a statistical diagram showing the error of R-peak detection in ECG waveform signal prediction based on the Transformer model.

[0029] Figure 12 This is a statistical diagram showing the error of T-wave peak detection in ECG waveform prediction based on the TimeMixer model.

[0030] Figure 13 This is a statistical graph showing the error of T-wave endpoint detection in ECG waveform prediction based on the TimeMixer model.

[0031] Figure 14 The figure shows the statistical effect of T-wave peak detection error in ECG waveform signal prediction based on the TimesNet model.

[0032] Figure 15 This is a statistical graph showing the error of T-wave endpoint detection in ECG waveform prediction based on the TimesNet model.

[0033] Figure 16 This is a statistical diagram showing the error of T-wave peak detection in ECG waveform prediction based on the Informer model.

[0034] Figure 17This is a statistical graph showing the error of T-wave endpoint detection in ECG waveform prediction based on the Informer model.

[0035] Figure 18 This is a statistical diagram showing the error of T-wave peak detection in ECG waveform prediction based on the Pyraformer model.

[0036] Figure 19 This is a statistical graph showing the error of T-wave endpoint detection in ECG waveform prediction based on the Pyraformer model.

[0037] Figure 20 This is a statistical diagram showing the error of T-wave peak detection in ECG waveform prediction based on the Transformer model.

[0038] Figure 21 This is a statistical graph showing the error of T-wave endpoint detection in ECG waveform prediction based on the Transformer model. Detailed Implementation

[0039] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments: join Figure 1 A cardiac phase-locked transcranial magnetic stimulation method based on cardiac-brain axis navigation and positioning includes the following steps: Step 1: Preprocess the acquired raw electrocardiogram signals; The method for acquiring the original electrocardiogram signal is as follows: The preset ECG electrode locations were wiped with alcohol swabs, and the ECG electrodes were then attached to the wiped locations. The acquisition of raw ECG signals was controlled by host computer software. (See also...) Figure 2 The electrocardiogram (ECG) electrodes are three-lead ECG electrodes, including a right upper limb (RA) electrode, a left upper limb (LA) electrode, and a left lower limb (LL) electrode. The right upper limb electrode is attached to the first intercostal space along the right sternal border and the midclavicular line. The left upper limb electrode (LA) is attached to the first intercostal space along the left sternal border and the midclavicular line. The left lower limb (LL) electrode is attached to the left midclavicular line at the level of the xiphoid process or below the left costal margin. Figure 3 The raw ECG signal was collected. As can be seen from the image, the R-peak is obvious, but there is significant noise. Therefore, further preprocessing is needed to improve the robustness and accuracy of subsequent R-peak identification and detection. This embodiment uses the ECG signal as the transcranial recognition benchmark. Compared with existing closed-loop control of transcranial magnetic stimulation based on EEG or near-infrared imaging, analyzing the ECG signal significantly reduces the difficulty of signal acquisition and analysis, and yields a signal with a higher signal-to-noise ratio, providing a good signal benchmark for subsequent closed-loop control of transcranial magnetic stimulation.

[0040] Step 1 specifically includes: Step 1.1: Use an IIR digital notch filter to process the power frequency interference of the acquired raw ECG signal; the frequency of the raw ECG signal in this embodiment is 1000Hz or 2000Hz. By applying an IIR digital notch filter in the original high sampling rate (such as the original ECG signal with a frequency of 1000Hz) domain, compared with the low sampling rate, the notch filter under the high sampling rate can more accurately remove 50Hz and its harmonics, and has less distortion to the signal phase.

[0041] Step 1.2: Perform polyphase filtering on the ECG signal after power frequency interference processing to obtain the downsampled ECG signal; in this embodiment, the ECG signal is unified to a sampling rate of 50Hz by downsampling, which greatly reduces the amount of subsequent calculations, while retaining the main morphological features of the QRS complex (10ms resolution) to meet the subsequent R peak localization requirements.

[0042] Step 1.3: Use the Butterworth filter to extract the ECG frequency band from the downsampled ECG signal to obtain the effective frequency band of the ECG signal; in this embodiment, when using the Butterworth filter, it is set to "lfilter" causal mode with a frequency band of 0.5Hz~30Hz; by using the low-frequency cutoff (0.5Hz), the baseline fluctuations caused by respiration can be effectively removed, and the high-frequency cutoff (30Hz) can filter out high-frequency electromyographic interference, smooth the waveform, and prevent the subsequent model from focusing on meaningless spikes.

[0043] Step 1.4: Perform local normalization on the effective frequency band of the ECG signal to obtain the preprocessed ECG signal; the relevant calculation formula for the local normalization is: in, The normalized electrocardiogram signal The ECG signal before normalization. The mean, The standard deviation is denoted as .

[0044] Step 2: Input the preprocessed ECG signal into the TimeMixer model after training and convergence, and output the predicted ECG waveform signal; See Figure 4 In this embodiment, the TimeMixer model is a multi-scale feature decoupling and bidirectional mixing network, which includes a multi-scale time series module, a trend and detail decomposition module, a cross-scale bidirectional feature mixing module, and a prediction reconstruction and multi-scale fusion module connected in sequence. 1) Multi-scale time series module, including multiple average pooling layers, which are preset to 3 layers in this embodiment and implemented using one-dimensional average pooling; this module is used to downsample the preprocessed ECG signal layer by layer to obtain multi-scale time series signals; specifically, each layer generates an ECG sequence with half the time resolution through an average pooling operation with a set specific window size, and finally forms an M-layer (M=4, including the original scale and 3 downsampling scales) multi-scale sequence representation including the original resolution; the function of this module is to be able to simultaneously capture high-resolution transient waveforms (such as QRS waves) and low-resolution global trends (such as baseline drift) in the ECG signal.

[0045] After the preprocessed ECG signal is input into the TimeMixer model, a multi-scale pyramid is constructed. Let the original sequence of the preprocessed ECG signal be... , No. The sequence after layer downsampling is The downsampling process is then expressed as: in, This is a downsampling operation, specifically one-dimensional average pooling, with a window size of [value missing]. Step size is ,but: The final set of multi-scale sequences is { },in, The original sequence, This is the lowest resolution sequence.

[0046] In this embodiment, the TimeMixer model reads 256 points from the original electrocardiogram signal, and after average pooling downsampling, generates three sets of lower-resolution copies, forming the following pyramid structure: Level 0 (original view): 256 points, containing all details, but also high-frequency noise; Level 1 (coarse view): 128 points, averaged from every 2 points, noise reduced, main waveforms preserved; Level 2 (Macro Perspective): 64 points, with the average of 4 points taken, only showing a general outline; Level 3 (Global Perspective): 32 points, with an average of 8 points per point, mainly reflecting the baseline trend.

[0047] 2) Trend and Detail Decomposition Module: This module consists of a moving average decomposition unit. This unit employs a boundary processing strategy of repeated endpoint expansion and uses one-dimensional average pooling (with a step size of 1) with a kernel size equal to the length of the moving average window to calculate the local mean, obtaining the trend term (representing the low-frequency baseline). Subtracting the trend term from the original sequence yields the detail term (representing the high-frequency heartbeat waveform). This decomposition is performed for each scale of the sequence representation in the pyramid to enhance the separation of low-frequency trends and high-frequency details, providing component representations for subsequent cross-scale mixing and prediction, and achieving complete decoupling of different frequency bands and morphological features of the signal.

[0048] Let the first The layer sequence is The moving average window size is Step size is Then the trend component and details The calculation formula is: in, As a trend component, For the sake of detail, For moving average, for the sequence Each position Calculate its surroundings The average value of each point (boundaries are expanded using an endpoint repetition strategy): The trend component is a smooth curve obtained by filtering out high-frequency fluctuations through a moving average. In an electrocardiogram (ECG), it represents baseline drift (such as low-frequency fluctuations caused by breathing). The detail component is the part remaining after subtracting the trend term from the original signal. In an ECG, it represents all high-frequency waveform details (such as P-QRS-T complexes).

[0049] 3) Cross-scale bidirectional feature mixing module: This module includes a bottom-up detail mixer and a top-down trend mixer. The detail mixer downsamples the detail terms of the high-resolution layer through a fully connected layer and then superimposes them onto the detail terms of the adjacent low-resolution layer via residual connections to obtain fused low-resolution detail terms, preventing the smooth loss of waveform features (especially the R-peak) caused by downsampling. The trend mixer upsamples the trend terms of the low-resolution layer through a fully connected layer and then superimposes them onto the trend terms of the adjacent high-resolution layer to obtain fused high-resolution trend terms, correcting baseline prediction shifts caused by local high-frequency noise through a macroscopic perspective. This cross-scale bidirectional feature mixing module achieves complementary advantages of information from different scales.

[0050] Detail Mixer: After downsampling the detail components of the high-resolution layer through a fully connected layer, the residual is connected to the detail components of the adjacent low-resolution layer to prevent the loss of waveform features caused by downsampling.

[0051] Let the first Layer detail components are The downsampled detail components are The mixing process is as follows: in, For a fully connected downsampling layer, The length from Mapped to ( = / 2 ).

[0052] Trend mixer: After upsampling the trend components of the low-resolution layer through a fully connected layer, the residual is connected to the trend components of the adjacent high-resolution layer, using the macroscopic trend to correct local noise. Let the first... Layer trend components are The trend component after upsampling is The mixing process is as follows: in, For a fully connected upsampling layer, The length from Mapped to ( = ).

[0053] 4) Prediction Reconstruction and Multi-Scale Fusion Module: This module consists of intra-scale prediction units and weighted fusion units. After completing cross-scale feature mixing, the trend and detail terms at each scale already contain rich contextual information. This module independently performs prediction mapping for the mixed features at each scale, and finally fuses the multi-scale prediction results into the final output through learnable weights.

[0054] Intra-scale prediction unit: for each level in the pyramid Utilizing the mixed trend components and details Linear predictions are performed separately. This process uses fully connected layers to combine the historical sequence lengths at each scale. Mapped to target prediction length To enable prediction of future trends and fluctuations at different time granularities: in, and The first The trend and detail items predicted by the layer. It is a linear mapping layer.

[0055] Weighted fusion unit: To adaptively aggregate prediction information from different resolutions, learnable scale weight parameters are introduced. Prediction results from all scales are fused using either Softmax normalization or direct weighted summation to obtain the final reconstructed sequence. That is, the electrocardiogram waveform signal: in, For the first Layer fusion weights.

[0056] The training method for the TimeMixer model in this embodiment is as follows: a) Divide the preprocessed ECG signals into training, validation and test sets according to a preset ratio (e.g. 7:1:2), and use the sliding window method to segment the samples. Set the length of the historical observation window to 256 sampling points and the length of the target prediction window to 64 sampling points. b) Input the historical ECG sequences in the training set into the TimeMixer model in batches. After multi-scale processing and mapping, the output is a predicted sequence of length 64. c) Calculate the joint loss between the predicted sequence and the actual ECG tag sequence; the joint loss function includes mean squared error loss (MSE) and total variation loss (TV Loss). The mean squared error loss is used to constrain the overall point-to-point error between the predicted waveform and the actual waveform. The TV Loss is used to suppress high-frequency artifacts in the predicted waveform and ensure the smoothness of the output ECG waveform by calculating the sum of the absolute values ​​of the differences between adjacent points in the predicted sequence. d) The Adam optimizer is used to calculate the network gradient based on the joint loss, and the learning rate is dynamically adjusted using a step-decay learning rate scheduling strategy (i.e., the learning rate is halved every epoch starting from the second epoch). The network parameters of the TimeMixer model are updated by backpropagation. e) After each training epoch, the average loss is calculated on the validation set to evaluate the performance of the TimeMixer model. When the validation set loss no longer decreases within a preset number of consecutive epochs (e.g., 5 epochs), an early stopping mechanism is triggered. The model weights corresponding to the lowest validation set loss are extracted as the optimal model, and training continues until convergence is achieved.

[0057] Figure 5This is a diagram of the electrocardiogram waveform signal predicted by the TimeMixer model of this invention. Blue represents the actual signal, and orange represents the predicted signal.

[0058] Step 3: After splicing the predicted ECG waveform signal sequence with the original ECG waveform signal sequence, the global ECG sequence is obtained. The effective R peak and T wave peak are identified sequentially on the global ECG sequence, and the T wave endpoint of the global ECG sequence is determined based on the median of the interval between the T wave peak and the T wave endpoint in the original ECG waveform signal sequence. The specific operation of splicing in this embodiment is as follows: the predicted ECG time series is appended to the end of the original ECG signal sequence, thereby reconstructing a complete ECG signal in the time dimension. That is, the predicted ECG waveform signal sequence is 64 points, the original ECG signal sequence is 256 points, and the spliced ​​global ECG sequence is 320 points.

[0059] In step 3, the effective R peak and T wave peak are sequentially identified on the global ECG sequence, and the T wave endpoint of the global ECG sequence is determined based on the median interval between the T wave peak and the T wave endpoint in the original ECG waveform signal sequence. Specifically, this includes: A peak-finding algorithm is used to identify the location of the R-peak in the global electrocardiogram sequence and obtain candidate R-peaks; the peak-finding algorithm in this embodiment is the Pan-Tompkins QRS wave detection algorithm. Calculate the mean and standard deviation of the candidate R peaks, and then calculate the significance of the candidate R peak voltage values ​​based on the mean and standard deviation of the candidate R peaks. Suppose that within a given analysis window, the extracted data is... One candidate R peak, The set of voltage amplitudes corresponding to the candidate R peaks is denoted as ,in, For the first Voltage values ​​of each candidate peak; mean value of candidate R peaks This represents the average level of the voltage of all candidate R peaks within the analysis window, and the corresponding calculation formula is: Standard deviation of candidate R peak The formula used to measure the fluctuation or dispersion of all candidate peak voltages within the analysis window is as follows: The significance of each candidate R-peak is described by the z-score, and the corresponding calculation formula is as follows: If the significance of the candidate R-peak voltage value is lower than a preset threshold, the candidate R-peak is determined to be a spurious peak and removed from the global ECG sequence. If the significance of the candidate R-peak voltage value is higher than the preset threshold, the R-peak is determined to be a valid R-peak and retained in the global ECG sequence. The threshold 3 set in this embodiment is based on the following principle: This threshold is an adjustable parameter, and its value directly affects the trade-off between "how many peaks to retain" and "how many spurious peaks to remove": a smaller threshold retains more candidate peaks and is more sensitive to weak R-peaks, but is more likely to misjudge noise fluctuations as R-peaks, thus increasing the dispersion of subsequent localization errors; a larger threshold more strictly removes spurious peaks and improves the reliability and stability of retained peaks, but may also discard some true R-peaks with low amplitude or unclear predictions, resulting in a reduction in the number of effective samples. In the test, the preset threshold was set to 3 because R-peaks are usually significant spike events in ECG signals and should have stronger prominence than background fluctuations; using a strict threshold close to "three standard deviations" can effectively suppress spurious peaks and improve the reliability of R-peak localization assessment, while still maintaining a sufficient number of effective events on most samples, balancing assessment stability and sample coverage.

[0060] Using the effective R peak as an anchor point, the peak value of the T wave is searched within the subsequent time window. The median time interval between the peak value and the end point of the T wave in the original ECG waveform sequence is counted, and this median time interval is superimposed on the peak value of the T wave to obtain the position of the end point of the T wave. The specific process is as follows: After completing the candidate R-peak detection based on the Pan-Tompkins algorithm and the spurious peak removal based on significance scores, this embodiment further uses each retained valid R-peak as an anchor point of the cardiac cycle, and searches for and locates the T-peak within a preset time window after the R-peak, thereby obtaining the T-peak position corresponding to each cardiac cycle. To avoid misdetecting residual QRS waveforms or noise fluctuations as T-peaks, the search delay after the R-peak is converted from milliseconds to sampling points according to the sampling rate, and the T-peak is limited to only when... Range search: in, This is the index of the sampling point of the currently valid R peak in the global sequence. and These represent the minimum or maximum delay (in milliseconds) for searching the peak value of the T wave after the R peak. Sampling rate (in Hz). This indicates rounding down to obtain the integer sampling point position; To reduce the impact of baseline drift on peak search, this embodiment selects a length of [missing information] at the end of the search window. The short intervals are used as the local baseline, and the median is taken as the local baseline. : in, For global electrocardiogram sequences at sampling points amplitude, For median operations, Window length (in sampling points) used to estimate local baselines; Based on this, for each sampling point within the search window Calculate its magnitude deviation relative to the local baseline. : in, For absolute value operations, To characterize the peak significance of this point relative to the baseline; subsequently, it will be made The sampling point with the maximum value is taken as the T-wave peak position. : in, To find the position of the independent variable that maximizes the objective function, This is the index of the peak T-wave sampling points corresponding to the cardiac cycle; To enhance the T-wave endpoint ( Tend The stability of localization in real waveforms and the robustness of estimation in predicted waveforms are first assessed by statistically analyzing the time interval from the peak of the T wave to the end of the T wave in each cardiac cycle of a real electrocardiogram sequence. And the median is taken as a robust statistic; among them, the true electrocardiogram Tend Positioning based on the obtained T-wave peak value Starting from this point, the search duration shall not exceed the maximum search duration thereafter. The search is performed within the window, and the corresponding upper bound sampling point is: in, The maximum duration (in milliseconds) for searching for the end of the T-wave from its peak value. This is the index of the corresponding maximum search sampling point; To reduce the impact of local glitch on endpoint determination, a length of [length missing] is applied to this signal segment. The moving average smoothing is obtained. : in, The length of the smoothing window (in sampling points). The signal amplitude after smoothing; The first-order difference is then calculated on the smoothed signal as the discrete derivative. : in, Sampling points The change in slope is used to measure whether the signal has entered the regression baseline and the change has stabilized.

[0061] The maximum value of the difference magnitude within the search interval is taken as the local slope scale. : in, This is the maximum slope amplitude that may occur during the T-wave decline or regression in the cardiac cycle, used to relatively threshold the decrease in slope. Simultaneously, the amplitude of the T-wave peak relative to the baseline. As a measure of amplitude: in, This indicates the magnitude of the T-wave peak relative to the local baseline, and is used for relative thresholding of the regression baseline; Based on this, this embodiment... The earliest sampling point that satisfies the joint condition of "amplitude regression baseline + slope stabilization" is selected as the candidate point for the T-wave endpoint; specifically, when a certain sampling point Simultaneously satisfying both the magnitude condition and the slope condition: in, The regression baseline tolerance ratio (dimensionless). The slope tolerance ratio (dimensionless). The signal has returned to an amplitude range close to the baseline. This indicates that the rate of signal change has decreased to a relatively small level compared to the local maximum change; To avoid misjudgment caused by accidental fulfillment of conditions at a single point, this embodiment further requires that the above-mentioned joint conditions be met continuously for no less than [number missing]. It holds true at each sampling point, that is, it exists. Makes all All of the following are available: in, The number of stable points (in sampling points) is used to constrain the stability of endpoint determination; the minimum number of points satisfying this condition. This is recorded as the true T-wave endpoint position of that cycle. ; For the The peak position of the T wave and the actual end position of the T wave obtained from each cardiac cycle are denoted as follows: and Then the sampling point interval corresponding to this period is: in, For the first The interval (in units of sampling points) from the peak of the T wave to the end of the T wave within one cardiac cycle, corresponding to the time interval is: (Unit: seconds). For all conditions satisfying... The robust statistical interval is obtained by taking the median of the effective period: in, The median represents the typical sampling interval from the peak of the T wave to the end of the T wave in a real electrocardiogram. The median is used to reduce the influence of abnormal cycles or local noise on the statistical results. Subsequently, only the peak position of the T-wave needs to be stably located in the predicted waveform. The estimated location of the predicted T-wave endpoint can be obtained by adding the aforementioned median interval to the predicted T-wave peak value. : in, This is the index of the T-wave peak sampling point located in the predicted waveform. This estimation method provides an estimated sampling point index for predicting the T-wave endpoint, avoiding direct manipulation of the predicted waveform. Tend The uncertainty in positioning introduced by the unclear endpoint morphology during detection makes the subsequent division of systolic and diastolic phases more stable.

[0062] Step 4: The effective R peak and T wave endpoint of the global electrocardiogram sequence are used to divide the systolic and diastolic phases of the heart, and the systolic and diastolic phases are assigned values ​​and encoded to obtain corresponding state labels. Compared with the existing open-loop transcranial magnetic stimulation technology, this embodiment achieves accurate characterization of physiological state by identifying the systolic and diastolic phases of the heart, effectively improving the regulatory effect of transcranial magnetic stimulation.

[0063] Step 4 specifically includes: Step 4.1: Mark the time of each valid R peak and obtain the timestamp corresponding to each valid R peak; Step 4.2: See Figure 6 Using the timestamp of the current effective R peak as a reference, the time window from the current effective R peak to the end of the T wave is defined as the systolic phase, and the time window from the end of the T wave to the next effective R peak is defined as the diastolic phase; let the sampling point index of the current effective R peak be... The sampling point index of the next effective R peak after the current effective R peak is: The current cycle predicts the end point of the T wave as... The sampling point index of the T-wave endpoint is Then the time window Defined as the cardiac systolic period, the time window Defined as the diastolic phase of the heart; among which, Depend on Give, This marks the end of the T-wave.

[0064] Alternatively, the time window between two adjacent effective R peaks can be defined as the systolic period, with the first third of the time window (RR interval) defined as the systolic period and the second two-thirds as the diastolic period, based on the timestamp of the current effective R peak. Step 4.3: Perform binary state encoding on the time axis of the heart's systolic and diastolic signals respectively. If the current time is within the systolic time window, the state label is assigned as 1; if it is within the diastolic time window, the state label is assigned as 0.

[0065] Step 5: Determine the location of the transcranial magnetic stimulation target using the cardio-brain axis navigation method; Compared with existing transcranial magnetic stimulation navigation and positioning methods, this embodiment fully considers the interaction between the central nervous system and the autonomic nervous system through the cardio-brain axis navigation method, further improving the accuracy of individualized transcranial magnetic stimulation target positioning.

[0066] Step 5 specifically includes: Step 5.1: Before performing transcranial magnetic stimulation, perform offline spatial target localization; while acquiring raw electrocardiogram signals, simultaneously acquire brain fMRI (functional magnetic resonance imaging) signals; in this embodiment, the device for acquiring brain fMRI is a functional magnetic resonance imaging scanner.

[0067] Step 5.2: After performing image preprocessing on the brain fMRI signal, extract the time series corresponding to each voxel in the gray matter of the brain region from the image preprocessed brain fMRI data to obtain the fMRI time series; In step 5.2, the image preprocessing includes sequential temporal correction, head motion correction, registration, segmentation, spatial normalization and smoothing, and noise regression.

[0068] In step 5.2, extracting the time series corresponding to each voxel in the gray matter of the brain region from the preprocessed fMRI data specifically includes: The signal intensity of each voxel is read sequentially at each time point along the time dimension. The signal intensity at each time point is arranged in chronological order to obtain the time series corresponding to that voxel. The time series corresponding to each voxel are integrated in chronological order to form an fMRI time series.

[0069] Step 5.3: Use the peak finding algorithm to identify the R peak position of the original ECG signal, calculate the RR interval sequence, and resample the RR interval sequence into an equally spaced time sequence to obtain an equally spaced RR interval sequence; the peak finding algorithm in this embodiment is the Pan-Tompkins QRS wave detection algorithm. In step 5.3, the calculation of the RR interval sequence specifically includes: Calculate the time interval between two adjacent R peaks in the original electrocardiogram signal sequentially; sort all the time intervals between two adjacent R peaks in chronological order to obtain the RR interval sequence. Step 5.4: After bandpass filtering the fMRI time series and the equally spaced RR interval sequences, the RR interval sequences are first resampled to the fMRI sampling rate, and then Hilbert transform is used to extract the instantaneous phase of the bandpass-filtered fMRI time series and the instantaneous envelope amplitude of the RR interval sequences. In this embodiment, a bandpass filter of 0.01~0.1Hz is set for the fMRI time series, and a bandpass filter of 0.15-0.4Hz is set for the equally spaced RR interval sequences. Step 5.5: Based on the instantaneous phase of the fMRI time series and the instantaneous envelope amplitude of the RR interval sequence, calculate the true heart-brain coupling strength for each voxel using the average vector amplitude method: in, For the first Individual factor true heart-brain coupling strength This represents the number of time points in the voxel fMRI time series. The instantaneous envelope amplitude of the RR interval sequence. For the first Instantaneous phase of a voxel fMRI time series For voxel indexing, The imaginary unit; Step 5.6: Construct the chance-level heart-brain coupling distribution and standardize the true heart-brain coupling strength for each voxel; specifically: The instantaneous envelope amplitude of the RR interval sequence is cyclically shifted multiple times to obtain the cyclically shifted instantaneous envelope amplitude: in, The instantaneous envelope amplitude of the RR interval sequence Instantaneous envelope amplitude after the second translation For cyclic translation operations, The instantaneous envelope amplitude of the RR interval sequence before translation. For the first Cyclic time shift , This represents the number of cyclic translations. Based on the instantaneous phase of the fMRI time series and the instantaneous envelope amplitude of the RR interval sequence after each cyclic translation, the chance level of cardio-brain coupling strength of each voxel after multiple translations is calculated using the average vector amplitude method. in, For the first The chance level of heart-brain coupling strength is calculated by the kth translation of the individual element and the instantaneous envelope amplitude of the RR interval. The chance-level heart-brain coupling distribution is constructed using the chance-level heart-brain coupling strength values ​​of each voxel after multiple translations. K indivual This constitutes a chance-level distribution of heart-brain coupling. The true heart-brain coupling strength of each voxel is standardized relative to its chance-level heart-brain coupling distribution: in, For the first Mean of the individual chance level heart-brain coupling distribution. For the first Standard deviation of the individual chance level heart-brain coupling distribution; Step 5.7: Threshold the true heart-brain coupling intensity of each standardized voxel, and match the transcranial magnetic stimulation target location based on the thresholding result; specifically: The true heart-brain coupling strength of each standardized voxel is thresholded according to a preset threshold, and candidate voxels that meet the threshold conditions are selected. Spatial connectivity analysis is performed on candidate voxels that meet the threshold conditions, and spatially connected candidate voxels are grouped into one or more candidate heart-brain coupling clusters. In this embodiment, the preset threshold is greater than 2.58. The selection of this threshold should be adjusted according to the degree of dispersion of the candidate heart-brain coupling clusters obtained after spatial connectivity analysis to avoid the candidate heart-brain coupling clusters being too dispersed. For candidate cardio-brain coupling clusters that meet the transcranial magnetic stimulation accessibility criteria, calculate their average normalized cardio-brain coupling strength: in, For the first The average normalized cardio-brain coupling strength of each candidate cluster For the first 1 candidate cluster For the first Number of voxels within each candidate cluster Represents the voxel index within the candidate cluster. For the first The first candidate cluster Standardized cardio-brain coupling strength of individual elements; selection under the condition of transcranial magnetic stimulation accessibility. The largest cluster is selected as the optimal candidate cluster. The transcranial magnetic stimulation accessibility criteria are: the candidate cardio-brain coupling cluster is located in the superficial cortical region, including but not limited to the prefrontal cortex, primary motor area, and somatosensory cortex, and the number of voxels in the candidate cardio-brain coupling cluster is greater than or equal to 20; The candidate heart-brain coupling cluster with the highest average normalized heart-brain coupling strength was selected as the optimal candidate cluster, and the voxel with the highest normalized heart-brain coupling strength within the optimal candidate cluster was selected as the transcranial magnetic stimulation target location. in, As the optimal candidate cluster, The first in the optimal candidate cluster Standardized cardio-brain coupling strength of individual elements; Alternatively, the geometric centroid of the optimal candidate target area can be used as the transcranial stimulation target point: The formula for calculating the centroid of the optimal candidate target area is: in, As the optimal candidate cluster, To determine the optimal number of voxels within a candidate cluster, The first in the optimal candidate cluster The three-dimensional coordinates of an individual element in the MRI space of an individual structure.

[0070] Step 6: Control the parameters of the transcranial magnetic stimulation according to the status labels corresponding to the systolic and diastolic phases of the heart and the location of the transcranial magnetic stimulation target point.

[0071] The above-mentioned cardiac phase-locked transcranial magnetic stimulation method based on the heart-brain axis navigation and positioning is applied to the host computer. The host computer is connected to the transcranial magnetic stimulation device (TCP / IP communication protocol or serial communication protocol), and the stimulation site is automatically controlled by the infrared binocular positioning system and the robotic arm. Then, transcranial magnetic stimulation is applied according to the matching parameters.

[0072] A cardiac phase-locked transcranial magnetic stimulation system based on cardiac-brain axis navigation and positioning includes: Signal preprocessing module: preprocesses the acquired raw electrocardiogram signals; ECG waveform prediction module: Input the preprocessed ECG signal into the TimeMixer model after training and convergence, and output the predicted ECG waveform signal; The R-peak identification and T-wave endpoint determination module splices the predicted ECG waveform signal sequence with the original ECG waveform signal sequence to obtain a global ECG sequence. Valid R-peaks and T-wave peaks are identified sequentially on the global ECG sequence, and the T-wave endpoint of the global ECG sequence is determined based on the median interval between the T-wave peak and the T-wave endpoint in the original ECG waveform signal sequence. Systolic and diastolic phase segmentation and encoding module: The effective R peak and T wave endpoint of the global electrocardiogram sequence are used to segment the systolic and diastolic phases of the heart, and the systolic and diastolic phases are assigned values ​​and encoded to obtain the corresponding status labels; Transcranial stimulation target localization module: The location of transcranial magnetic stimulation target points is determined using a heart-brain axis navigation method; Transcranial magnetic stimulation parameter control module: controls the parameters of the transcranial magnetic stimulation based on the status labels corresponding to the systolic and diastolic phases of the heart and the location of the transcranial magnetic stimulation target.

[0073] The application effects of this invention will be described in detail below with reference to simulation experiments: The experiment used 10 minutes of ECG data with an original sampling rate of 1000Hz, which was then downsampled to 50Hz after preprocessing. The TimeMixer model of this invention and several comparative models (including TimesNet, Informer, Pyraformer, and traditional Transformer) were used to predict ECG waveforms, and the R-peak and T-peak were located based on this. The results were quantitatively evaluated using indicators such as the mean absolute error (MAE), mean error (Mean), standard deviation of error (Std), distribution percentage under different error thresholds, and weak peak drop rate of the predicted R-peak and T-wave endpoints.

[0074] See Figure 7-11 The TimeMixer model demonstrates superior overall performance in the R-peak detection task, with a mean absolute error of 13.97 milliseconds, a mean error of 0.86 milliseconds, and a standard deviation of 20.27 milliseconds for R-peak prediction. Regarding error distribution, a high percentage (89.2%) of the prediction error is strictly controlled within ±20 milliseconds, while 98.0% of the error falls within the acceptable range of ±40 milliseconds. More importantly, the TimeMixer model exhibits a weak peak drop rate of only 20.9%, indicating that while maintaining high accuracy, it effectively identifies and retains most of the valid R-peaks, avoiding information loss that may result from over-filtering.

[0075] Compared to the Informer model (mean absolute error 57.85 ms, weak peak dropout rate 92.8%) and the Transformer model (mean absolute error 49.16 ms, weak peak dropout rate 95.7%), TimeMixer demonstrates overwhelming superiority across all performance metrics, particularly in mean absolute error and weak peak dropout rate, significantly improving prediction accuracy and R-peak recall. Compared to TimesNet (mean absolute error 17.38 ms, weak peak dropout rate 23.6%) and Pyraformer (mean absolute error 16.43 ms, weak peak dropout rate 33.1%), the TimeMixer model slightly leads in mean absolute error and error distribution compactness, and outperforms Pyraformer in weak peak dropout rate, essentially matching TimesNet. This demonstrates the effectiveness of the TimeMixer model in multi-scale feature fusion and noise robustness.

[0076] See Figure 12-21 In T-peak prediction, the Pyraformer model performed best, with a mean absolute error (MAO) of 10.35 ms, a mean error of -1.47 ms, and a standard deviation of 26.96 ms. 95.8% of the errors were within ±20 ms, and 98.8% were within ±40 ms. The TimeMixer model also showed excellent performance in T-peak prediction, with a MAO of 17.89 ms, a mean error of -1.61 ms, and a standard deviation of 28.90 ms. 81.3% of its errors were within ±20 ms, and 95.6% were within ±40 ms. The TimesNet model had an MAO of 18.28 ms. In contrast, the Informer and traditional Transformer models performed poorly in T-peak prediction, with the Informer having an MAO of 83.67 ms and the Transformer having an MAO of 42.88 ms. This further confirms the advantages of TimeMixer, Pyraformer, and TimesNet in extracting and predicting complex waveform features.

[0077] In T-wave endpoint assessment, the models also showed differences. The Pyraformer model performed best in this task, with a mean absolute error (MAO) of 10.69 ms, a mean error of -2.90 ms, and a standard deviation of 24.98 ms for predicting the T-wave endpoint. Its error distribution was also the most concentrated, with 95.4% of the prediction errors controlled within ±20 ms and 98.7% within the tolerance range of ±40 ms. The TimeMixer model performed similarly to TimesNet, which had a MAO of 15.30 ms, a mean error of -2.17 ms, and a standard deviation of 25.73 ms, with 87.7% of the errors within ±20 ms and 96.6% within ±40 ms. The TimeMixer model followed closely behind, with a mean absolute error (MAO) of 17.18 ms, a mean error of -2.34 ms, and a standard deviation of 26.97 ms. 83.1% of the errors were within ±20 ms, and 95.1% were within ±40 ms. In contrast, the Informer and traditional Transformer models performed poorly in predicting the T-wave endpoint. The Informer model had a high MAO of 65.21 ms, a mean error of -61.47 ms, and a standard deviation of 47.19 ms, with only 26.2% of the errors within ±20 ms. The Transformer model had a MAO of 38.21 ms, a mean error of -30.82 ms, and a standard deviation of 41.53 ms, with 54.2% of the errors within ±20 ms. This indicates that Pyraformer, TimeMixer, and TimesNet significantly outperformed the Informer and Transformer models in terms of accuracy and stability in predicting the T-wave endpoint.

[0078] Based on the comprehensive evaluation results of R-peak, T-peak, and T-peak endpoints, the TimeMixer model demonstrates excellent overall performance in ECG waveform prediction and keypoint localization tasks. Whether in terms of mean absolute error, error distribution, and weak peak drop rate for R-peak detection, or in the prediction accuracy of T-peak endpoints and peaks, the TimeMixer model significantly outperforms models such as Informer and the traditional Transformer. Although the Pyraformer model slightly leads in certain specific metrics for T-peak endpoints and peaks, TimeMixer exhibits stronger stability and robustness in overall performance, especially in the core task of R-peak detection, where its overall performance is more outstanding. This fully demonstrates the effectiveness and advancement of the TimeMixer model in processing time series data, particularly in complex and accuracy-critical scenarios such as ECG signals.

[0079] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Therefore, any modifications, equivalent substitutions, or improvements made by those skilled in the art within the spirit and principles of this invention should be covered within the scope of protection of this invention.

Claims

1. A cardiac phase-locked transcranial magnetic stimulation method based on cardiac-brain axis navigation and positioning, characterized in that, Includes the following steps: Step 1: Preprocess the acquired raw electrocardiogram signals; Step 2: Input the preprocessed ECG signal into the TimeMixer model after training and convergence, and output the predicted ECG waveform signal; Step 3: After splicing the predicted ECG waveform signal sequence with the original ECG waveform signal sequence, the global ECG sequence is obtained. The effective R peak and T wave peak are identified sequentially on the global ECG sequence, and the T wave endpoint of the global ECG sequence is determined based on the median of the interval between the T wave peak and the T wave endpoint in the original ECG waveform signal sequence. Step 4: Use the effective R peak and T wave endpoint of the global electrocardiogram sequence to divide the systolic and diastolic phases of the heart, and assign values ​​to the systolic and diastolic phases to obtain the corresponding status labels; Step 5: Determine the location of the transcranial magnetic stimulation target point using the brain-heart axis navigation method; Step 6: Control the parameters of the transcranial magnetic stimulation according to the status labels corresponding to the systolic and diastolic phases of the heart and the location of the transcranial magnetic stimulation target point.

2. The cardiac phase-locked transcranial magnetic stimulation method based on cardiac-brain axis navigation and positioning according to claim 1, characterized in that, Step 1 specifically includes: Step 1.1: Use an IIR digital notch filter to process the power frequency interference of the acquired raw ECG signal; Step 1.2: Perform polyphase filtering on the ECG signal after power frequency interference processing to obtain the downsampled ECG signal; Step 1.3: Use the Butterworth filter to extract the ECG frequency band from the downsampled ECG signal to obtain the ECG signal with effective frequency bands; Step 1.4: Perform local normalization on the effective frequency band of the ECG signal to obtain the preprocessed ECG signal.

3. The cardiac phase-locked transcranial magnetic stimulation method based on cardiac-brain axis navigation and positioning according to claim 1, characterized in that, In step 3, valid R peaks and T wave peaks are sequentially identified on the global ECG sequence, and the T wave endpoint of the global ECG sequence is determined based on the median interval between the T wave peak and the T wave endpoint in the original ECG waveform signal sequence. The implementation method is as follows: A peak-finding algorithm was used to identify the location of the R-peak in the global electrocardiogram sequence and obtain candidate R-peaks. Calculate the mean and standard deviation of the candidate R peaks, and then calculate the significance of the candidate R peak voltage values ​​based on the mean and standard deviation of the candidate R peaks. If the significance of the candidate R peak voltage value is lower than the preset threshold, the candidate R peak is determined to be a false peak and is removed from the global ECG sequence. If the significance of the candidate R peak voltage value is higher than the preset threshold, the R peak is determined to be a valid R peak and is retained in the global ECG sequence. Using the effective R peak as an anchor point, the peak value of the T wave is searched within the subsequent time window. The median of the time interval between the peak value of the T wave and the end point of the T wave in the original electrocardiogram waveform sequence is counted, and the median of this time interval is superimposed on the peak value of the T wave to obtain the position of the end point of the T wave.

4. A method for cardiac phase-locked transcranial magnetic stimulation based on cardiac-brain axis navigation and positioning according to claim 1 or 3, characterized in that, Step 4 specifically includes: Step 4.1: Mark the time of each valid R peak and obtain the timestamp corresponding to each valid R peak; Step 4.2: Based on the timestamp of the current effective R peak, define the time window from the current effective R peak to the end of the T wave as the cardiac systolic period, and define the time window from the end of the T wave to the next effective R peak as the cardiac diastolic period. Step 4.3: Perform binary state encoding on the time axis of the heart's systolic and diastolic signals respectively. If the current time is within the systolic time window, the state label is assigned as 1; if it is within the diastolic time window, the state label is assigned as 0.

5. A method for cardiac phase-locked transcranial magnetic stimulation based on cardiac-brain axis navigation and positioning according to claim 1, characterized in that, Step 5 specifically includes: Step 5.1: Simultaneously acquire brain fMRI signals while acquiring raw electrocardiogram signals; Step 5.2: After performing image preprocessing on the brain fMRI signal, extract the time series corresponding to each voxel in the gray matter of the brain region from the image preprocessed brain fMRI data to obtain the fMRI time series; Step 5.3: Use the peak-finding algorithm to identify the R-peak position of the original ECG signal, calculate the RR interval sequence, and resample the RR interval sequence into an equal-interval time sequence to obtain an equal-interval RR interval sequence; Step 5.4: After bandpass filtering the fMRI time series and the equally spaced RR interval series, the RR interval series is first resampled to the fMRI sampling rate, and then Hilbert transform is used to extract the instantaneous phase of the bandpass-filtered fMRI time series and the instantaneous envelope amplitude of the RR interval series. Step 5.5: Based on the instantaneous phase of the fMRI time series and the instantaneous envelope amplitude of the RR interval sequence, calculate the true heart-brain coupling strength of each voxel using the average vector amplitude method; Step 5.6: Construct the chance-level heart-brain coupling distribution and standardize the true heart-brain coupling strength for each voxel; Step 5.7: Threshold the true heart-brain coupling intensity of each standardized voxel, and match the transcranial magnetic stimulation target location based on the thresholding result.

6. A method for cardiac phase-locked transcranial magnetic stimulation based on cardiac-brain axis navigation and positioning according to claim 5, characterized in that, Step 5.6 specifically includes: The instantaneous envelope amplitude of the RR interval sequence is cyclically shifted multiple times; Based on the instantaneous phase of the fMRI time series and the instantaneous envelope amplitude of the RR interval sequence after each cyclic translation, the chance level of cardio-brain coupling strength of each voxel after multiple translations is calculated using the average vector amplitude method. The chance-level heart-brain coupling distribution is constructed by the chance-level heart-brain coupling strength values ​​of each voxel after multiple translations. The true heart-brain coupling strength of each voxel is standardized relative to its chance-level heart-brain coupling distribution.

7. A method for cardiac phase-locked transcranial magnetic stimulation based on cardiac-brain axis navigation and positioning according to claim 5, characterized in that, Step 5.7 specifically includes: The true heart-brain coupling strength of each standardized voxel is thresholded according to a preset threshold, and candidate voxels that meet the threshold conditions are selected. Spatial connectivity analysis is performed on candidate voxels that meet the threshold conditions, and spatially connected candidate voxels are grouped into one or more candidate heart-brain coupling clusters. For candidate cardio-brain coupling clusters that meet the transcranial magnetic stimulation accessibility criteria, calculate their average normalized cardio-brain coupling strength. The candidate heart-brain coupling cluster with the highest average normalized heart-brain coupling strength was selected as the optimal candidate cluster, and the voxel with the highest normalized heart-brain coupling strength within the optimal candidate cluster was selected as the transcranial magnetic stimulation target location.

8. A method for cardiac phase-locked transcranial magnetic stimulation based on cardiac-brain axis navigation and positioning according to claim 7, characterized in that, The conditions for the accessibility of transcranial magnetic stimulation are: Candidate cardio-brain coupling clusters are located in the superficial cortical region, and the number of voxels in the candidate cardio-brain coupling clusters is greater than or equal to 20.

9. A cardiac phase-locked transcranial magnetic stimulation system based on cardiac-brain axis navigation and positioning, characterized in that, include: Signal preprocessing module: preprocesses the acquired raw electrocardiogram signals; ECG waveform prediction module: Input the preprocessed ECG signal into the TimeMixer model after training and convergence, and output the predicted ECG waveform signal; The R-peak identification and T-wave endpoint determination module splices the predicted ECG waveform signal sequence with the original ECG waveform signal sequence to obtain a global ECG sequence. Valid R-peaks and T-wave peaks are identified sequentially on the global ECG sequence, and the T-wave endpoint of the global ECG sequence is determined based on the median interval between the T-wave peak and the T-wave endpoint in the original ECG waveform signal sequence. Systolic and diastolic phase segmentation and encoding module: The effective R peak and T wave endpoint of the global electrocardiogram sequence are used to segment the systolic and diastolic phases of the heart, and the systolic and diastolic phases are assigned values ​​and encoded to obtain the corresponding status labels; Transcranial stimulation target localization module: The location of transcranial magnetic stimulation target points is determined using a heart-brain axis navigation method; Transcranial magnetic stimulation parameter control module: controls the parameters of the transcranial magnetic stimulation based on the status labels corresponding to the systolic and diastolic phases of the heart and the location of the transcranial magnetic stimulation target point.