Method for extracting ST segment signal in electrocardiogram
By performing R-wave detection and confidence calculation on the ECG signal, R-wave segments with low confidence are eliminated, and the reverse order method is used to determine the location of S-wave and T-wave, the problem that the prior art cannot accurately extract the ST-segment signal in the ECG is solved, and the accuracy of early diagnosis and prevention of myocardial ischemia is improved.
Patent Information
- Application Number
- CN202311384731.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-24
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art cannot accurately extract the ST segment signal in the electrocardiogram, resulting in increased difficulty in early diagnosis and prevention of myocardial ischemia.
By performing R-wave detection and confidence calculation on the electrocardiogram signal, R-wave segments with low confidence are eliminated, and the positions of S-wave and T-waves are determined by the reverse order method, thereby accurately extracting the ST-segment signal.
Accurate extraction of ST segment signals in electrocardiogram is achieved, and the accuracy of early diagnosis and prevention of myocardial ischemia is improved.
Smart Images

Figure CN119867779A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electrocardiogram monitoring, and in particular to a method for extracting ST segment signals from an electrocardiogram. Background Art
[0002] Myocardial ischemia (MI) is one of the common cardiovascular diseases, which means that the myocardium cannot support the normal functioning of the heart. With the improvement of people's living standards, the prevalence of myocardial ischemia in my country is currently increasing year by year. It has become a common and frequently-occurring disease among middle-aged and elderly people, and more and more young people are also showing symptoms of myocardial ischemia. Severe myocardial ischemia may also cause myocardial infarction or large-area myocardial necrosis, thereby endangering life safety. Therefore, early diagnosis and prevention are very important for patients with myocardial ischemia. Dynamic electrocardiogram is the most commonly used and most important examination to clarify myocardial ischemia. Hospitals usually use equipment such as Holter monitors to monitor dynamic electrocardiograms. Dynamic electrocardiograms can continuously capture or monitor electrocardiogram signals for several hours, and record the potential changes on the human body surface in the form of dynamic curves. Doctors can provide some diagnostic clues through the electrocardiogram waveform. Each cardiac cycle in the electrocardiogram waveform is composed of waveforms such as P waves, QRS waves and T waves, corresponding to different electrocardiogram activities during the heart's excitation process. Generally, the dynamic electrocardiogram ST segment level changes are analyzed to determine whether myocardial ischemia occurs, which is of great significance for the judgment of asymptomatic myocardial ischemia.
[0003] At present, researchers have established quite accurate analysis methods and algorithms for detecting abnormal R waves in arrhythmias, heart rhythm variability and atrial fibrillation, but the detection of abnormal ST waves in myocardial ischemia is still at the research level. At present, most myocardial ischemia detection is performed by professionals through computer-assisted ECG signal visual inspection, such as ST segment trend graph. In recent years, researchers have proposed more and more algorithms for the analysis and diagnosis of myocardial ischemia in the automated detection system of ischemic heart disease, but the existing technology cannot clearly locate the ST segment of the electrocardiogram and cannot accurately extract the ST segment signal in the electrocardiogram. Summary of the invention
[0004] In view of the above analysis, an embodiment of the present invention aims to provide a method for extracting ST segment signals from an electrocardiogram, so as to solve the problem that the ST segment signals from an electrocardiogram cannot be accurately extracted in the prior art.
[0005] On the one hand, an embodiment of the present invention provides a method for extracting ST segment signals in an electrocardiogram, comprising the following steps:
[0006] Acquire an electrocardiogram signal, and detect the electrocardiogram signal to obtain an R wave in the electrocardiogram signal;
[0007] Calculate the confidence of each R wave in the ECG signal; remove the R wave segments with low confidence to obtain the preprocessed ECG signal;
[0008] Based on the preprocessed ECG signal, the positions of S wave and T wave are determined by the reverse method, and the ST segment ECG signal is extracted.
[0009] Based on the further improvement of the above technical solution, the R wave segments with low confidence are eliminated to obtain the preprocessed ECG signal, including:
[0010] Taking each R wave in the ECG signal as the current R wave in turn, if the confidence of the current R wave is less than the first threshold, deleting the signal point between the current R wave peak and the previous R wave peak;
[0011] The ECG signal obtained after removing the R wave with low confidence is filtered, the R wave is re-detected on the filtered ECG signal to obtain the R wave position, the corresponding position of the ECG signal before filtering is marked as the R wave, and the pre-processed ECG signal is obtained.
[0012] Based on the further improvement of the above technical solution, the positions of the S wave and the T wave are determined by the reverse order method based on the preprocessed ECG signal, and the ST segment ECG signal is extracted, including:
[0013] Perform the following steps for each R wave in order from right to left, traverse all R waves, determine the positions of S waves and T waves, and extract the ST segment ECG signal:
[0014] From the current R wave peak, traverse to the left to find the second maximum slope point as the P wave center point, and the third maximum slope point as the T wave center point;
[0015] From the center point of the T wave, traverse to the left and find the first maximum slope point, which is the center point of the S wave;
[0016] The starting point of the T wave is found according to the center point of the T wave, and the signal from the center point of the S wave to the starting point of the T wave is extracted as the ST segment ECG signal.
[0017] Based on the further improvement of the above technical solution, the confidence of each R wave in the ECG signal is calculated in the following way:
[0018] Performing differential conversion on the ECG signal to obtain an ECG differential signal; constructing a standard R wave differential waveform corresponding to each type of R wave based on the ECG differential signal;
[0019] The confidence of each R wave segment is calculated based on the standard R wave differential waveform corresponding to each type of R wave.
[0020] Based on the further improvement of the above technical solution, the confidence of each R wave segment is calculated based on the standard R wave differential waveform corresponding to each type of R wave, including:
[0021] Perform integral reduction on each type of standard R wave differential waveform to obtain a standard R wave reduction waveform;
[0022] For each type of standard R wave, extract each R wave segment corresponding to the type in the ECG differential signal, perform integral restoration, and use the restored R wave segment as the target R wave;
[0023] Calculate the ratio of each type of standard R wave restoration waveform to the corresponding signal point in each target R wave of the corresponding type to construct a similarity ratio set;
[0024] Calculate the similarity confidence interval of each type based on the set of all similarity ratios corresponding to each type;
[0025] The confidence of each target R wave corresponding to the type is calculated according to the similarity confidence interval of the type.
[0026] Based on the further improvement of the above technical solution, a standard R wave differential waveform corresponding to each type of R wave is constructed based on the ECG differential signal, including:
[0027] For each type of R wave, the central differential waveform of the standard R wave corresponding to the type of R wave is obtained according to the differential mean value of the type of R wave in the electrocardiographic differential signal;
[0028] A bidirectional sliding window is used to synchronously slide all such R wave segments, and the boundary differential waveform of the standard R wave corresponding to this type of R wave is obtained according to the differential mean value of the R wave in each sliding window;
[0029] The standard vertebral R wave differential waveform corresponding to this type of R wave is obtained according to the central differential waveform and the boundary differential waveform of the standard R wave corresponding to this type of R wave.
[0030] Based on the further improvement of the above technical solution, a bidirectional sliding window is used to synchronously slide all such R wave segments, and the boundary differential waveform of the standard R wave corresponding to this type of R wave is obtained according to the differential mean value of the R wave in the sliding window, including:
[0031] Determine the left initial position corresponding to the left sliding window and the right initial position corresponding to the right sliding window respectively according to the width of the central differential waveform of the standard R wave;
[0032] Using a left sliding window to slide leftward from the left initial position in all such R wave segments, and determining the left boundary differential waveform of the standard R wave corresponding to the such R wave according to the differential mean of the R wave in each left sliding window;
[0033] A right sliding window is used to slide rightward from the right initial position in all such R wave segments, and the right boundary differential waveform of the standard R wave corresponding to this type of R wave is determined according to the differential mean of the R wave in each right sliding window.
[0034] Based on the further improvement of the above technical solution, the left boundary differential waveform of the standard R wave corresponding to this type of R wave is determined in the following manner:
[0035] S111221, taking each left sliding window at the left initial position as the current sliding window; calculating the differential mean of each sampling point in the current sliding window as the value of the signal point corresponding to the left boundary differential waveform of the standard R wave; the mean of each sampling point in the current sliding window constitutes a first set, and the positive and negative signs corresponding to the current sliding window are obtained according to the positive and negative signs of each value in the first set; sliding the current sliding window to the left by the first step length as the current sliding window;
[0036] S111222, calculating the differential mean of each sampling point in the current sliding window as the value of the corresponding signal point in the differential waveform of the left boundary of the standard R wave; the mean of each sampling point in the current sliding window constitutes a first set, and the positive and negative signs corresponding to the current sliding window are obtained according to the positive and negative signs of each value in the first set;
[0037] S111223. If the positive and negative signs corresponding to the current sliding window are different from those corresponding to the previous sliding window, stop sliding the window to obtain the left boundary differential waveform of the standard R wave; otherwise, slide the current sliding window to the left by the first step length as the current sliding window, and return to step S111222.
[0038] Based on the further improvement of the above technical solution, the positive and negative signs corresponding to the current sliding window are obtained according to the positive and negative signs of each value in the first set, including:
[0039] If the ratio of the number of values with positive signs in the first set to the total number of values in the first set exceeds a first threshold, the current sliding window corresponds to a positive sign, otherwise the current sliding window corresponds to a negative sign.
[0040] Based on the further improvement of the above technical solution, for each type of R wave, the central differential waveform of the standard R wave corresponding to the type of R wave is obtained according to the differential mean value of the type of R wave in the electrocardiographic differential signal, including:
[0041] For each signal point of the central differential waveform of the standard R wave, the differential mean of all sampling points corresponding to the signal point in this type of R wave is calculated as the value of the signal point; and the central differential waveform of the standard R wave is obtained.
[0042] The present invention first performs R wave detection on the electrocardiogram signal and calculates the confidence of each R wave, thereby eliminating the R wave with low confidence, providing a basis for the subsequent accurate extraction of the ST segment signal. The ST segment in the electrocardiogram signal can be accurately extracted by using the reverse method to locate the S wave and T wave according to the R wave. Traditional ST segment recognition relies on waveform classification, that is, the positive sequence method detects the S wave peak and the T wave peak. This method is easy to detect and lose the S wave peak when, for example, the ST segment is obliquely depressed, the T wave is inverted, and the ST segment appears arched upward, resulting in misjudgment or loss of the entire ST segment. The present invention uses the reverse sequence with the help of the P wave and the T wave to help the detection of ST, thereby accurately extracting the ST segment signal in the electrocardiogram.
[0043] In the present invention, the above-mentioned technical solutions can also be combined with each other to achieve more preferred combination solutions. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can become obvious from the description, or can be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained through the contents particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings are only used for the purpose of illustrating specific embodiments and are not to be considered as limiting the present invention. In the entire drawings, the same reference symbols represent the same components;
[0045] Figure 1 The present invention is a flowchart of a method for extracting ST segment signals from an electrocardiogram. DETAILED DESCRIPTION
[0046] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0047] A specific embodiment of the present invention discloses a method for extracting ST segment signals from an electrocardiogram, such as Figure 1 As shown, the following steps are included:
[0048] S1, obtaining an ECG signal, and detecting the ECG signal to obtain an R wave in the ECG signal;
[0049] S2, calculating the confidence of each R wave in the ECG signal; removing the R wave segments with low confidence to obtain the preprocessed ECG signal;
[0050] S3. Determine the positions of the S wave and the T wave based on the preprocessed ECG signal, and extract the ST segment ECG signal.
[0051] The present invention first performs R wave detection on the electrocardiogram signal and calculates the confidence of each R wave, thereby eliminating the R wave with low confidence, providing a basis for the subsequent accurate extraction of the ST segment signal. The ST segment in the electrocardiogram signal can be accurately extracted by using the reverse method to locate the S wave and T wave according to the R wave. Traditional ST segment recognition relies on waveform classification, that is, the positive sequence method detects the S wave peak and the T wave peak. This method is easy to detect and lose the S wave peak when, for example, the ST segment is obliquely depressed, the T wave is inverted, and the ST segment appears arched upward, resulting in misjudgment or loss of the entire ST segment. The present invention uses the reverse sequence with the help of the P wave and the T wave to help the detection of ST, thereby accurately extracting the ST segment signal in the electrocardiogram.
[0052] During implementation, the Pan&Tomskins algorithm can be used for detection to obtain the R wave of the ECG signal, that is, the position of the R wave peak is marked, and the R wave is classified by clustering, for example, divided into 3 categories, and the type corresponding to each R wave is marked.
[0053] The confidence of each R wave in the ECG signal is calculated in the following way:
[0054] S21, performing differential conversion on the ECG signal to obtain an ECG differential signal; constructing a standard R wave differential waveform corresponding to each type of R wave based on the ECG differential signal;
[0055] S22. Calculate the confidence of each R wave segment based on the standard R wave differential waveform corresponding to each type of R wave.
[0056] For example, the original ECG signal is represented by X = {x0, x1, x2, ..., x N The first signal point d1 after conversion is calculated by (x1-x0)×f, and the second signal point d2 after conversion is calculated by (x2-x1)×f. And so on, the ECG differential signal D={d1,d2,…,d N}, where N represents the total number of signal points in the ECG signal segment. Since the first signal point x0 in the original ECG signal has no differential value, it is deleted and the original ECG signal is represented by X = {x1, x2, …, x N}. Where f represents the sampling frequency.
[0057] By differentiating the waveform at each point, the dynamic information of all original ECG data is retained, the AC component of the ECG in the low-frequency band is emphasized, the DC component and baseline drift component are weakened, which is conducive to highlighting the ECG characteristics.
[0058] A standard R wave differential waveform corresponding to each type of R wave is constructed based on the ECG differential signal. Specifically, step S21 includes:
[0059] S211, for each type of R wave, obtain a central differential waveform of a standard R wave corresponding to the type of R wave according to a differential mean value of the type of R wave in the electrocardiographic differential signal;
[0060] S212, using a bidirectional sliding window to synchronously slide all such R wave segments, and obtaining a boundary differential waveform of a standard R wave corresponding to such R wave according to a differential mean value of the R wave in each sliding window;
[0061] S213. Obtain a standard R wave differential waveform corresponding to the type of R wave according to the central differential waveform and the boundary differential waveform of the standard R wave corresponding to the type of R wave.
[0062] The construction of the standard R wave differential waveform includes the construction of the central part waveform and the construction of the boundary waveform.
[0063] For each type of R wave, the central differential waveform of the standard R wave corresponding to the type of R wave is obtained according to the differential mean value of the type of R wave in the ECG differential signal, including:
[0064] For each signal point of the central differential waveform of the standard R wave, the differential mean of all sampling points corresponding to the signal point in this type of R wave is calculated as the value of the signal point; and the central differential waveform of the standard R wave is obtained.
[0065] Since the original ECG signal X and the ECG differential signal D are of equal length and correspond one to one, the R wave marker in the original signal can find the corresponding position in the ECG differential signal.
[0066] For example, to construct the central differential waveform of the standard R wave, it is necessary to first determine the width of the central differential waveform of the standard R wave. According to the beating law of the heart, the R wave is generally greater than 60ms. If the sampling interval is 1ms during implementation, the central waveform width can be set to 60 sampling intervals, with the R wave peak as the center, and the left and right widths are 30 sampling intervals respectively, that is, there are 30 signal points on the left and right.
[0067] For each signal point of the central differential waveform of the standard R wave, the differential mean of all sampling points corresponding to the signal point in this type of R wave is calculated as the value of the signal point in the standard R wave.
[0068] For example, the first signal point on the left side of the center position of the central differential waveform of the normal standard R wave is extracted, and the differential value corresponding to the first sampling point on the left side of each normal R wave mark point in the ECG differential signal is calculated, and the average value is calculated to obtain the value of the first signal point on the left side of the center position of the central differential waveform of the standard R wave. Similarly, after constructing the value of each limit point in the central wave differential shape, the central waveform is obtained, which is expressed as S i ={s i-k ,…,s i-1 ,s i1 ,…,sik}. Among them, s i-1 is the first signal point on the left side of the center position of the central differential waveform of the i-th type of standard R wave, s i1 is the first signal point to the right of the center position of the central differential waveform of the i-th type of standard R wave, and 2k is the width of the central differential waveform.
[0069] After the central differential waveform is constructed, it is necessary to construct the boundary waveform of the standard R wave differential waveform.
[0070] Specifically, a bidirectional sliding window is used to synchronously slide all such R wave segments, and a boundary differential waveform of a standard R wave corresponding to such R wave is obtained according to the differential mean value of the R wave in each sliding window, including:
[0071] S2121, determining a left initial position corresponding to the left sliding window and a right initial position corresponding to the right sliding window respectively according to the width of the central differential waveform of the standard R wave;
[0072] S2122, using a left sliding window to slide leftward from the left initial position in all such R wave segments, and determining a left boundary differential waveform of a standard R wave corresponding to such R wave according to a differential mean value of the R wave in each left sliding window;
[0073] S2123, using a right sliding window to slide rightward from the right initial position in all such R wave segments, and determining the right boundary differential waveform of the standard R wave corresponding to this type of R wave according to the differential mean of the R wave in each right sliding window.
[0074] First, the initial position of the left sliding window is determined based on half the width of the standard R wave center differential waveform. For example, the width of the center waveform is 60 signal points, that is, 30 signal points on the left and right of the peak. The left initial position is the position of the 31st sampling point on the left side of the R mark point, and the right initial position is the position of the 31st sampling point on the right side of the R mark point.
[0075] The process of determining the left boundary differential waveform and the right boundary differential waveform of the standard R wave is the same, the difference lies in the sliding direction, and the following is explained by taking the construction of the left boundary differential waveform as an example.
[0076] When using a sliding window, you must first determine the window size and sliding step size. During implementation, you can determine the size based on computational efficiency and accuracy. For example, if the sliding window size is determined to be 10 sampling intervals, each sliding window corresponds to 10 sampling points, and the sliding step size is 1 sampling interval, then one sampling point is slid to the left each time.
[0077] Specifically, in step S2122, the left boundary differential waveform of the standard R wave corresponding to the type of R wave is determined in the following manner:
[0078] S21221, taking each left sliding window at the left initial position as the current sliding window; calculating the differential mean of each sampling point in the current sliding window as the value of the signal point corresponding to the left boundary differential waveform of the standard R wave; the mean of each sampling point in the current sliding window constitutes a first set, and the positive and negative signs corresponding to the current sliding window are obtained according to the positive and negative signs of each value in the first set; sliding the current sliding window to the left by the first step length as the current sliding window;
[0079] S21222, calculating the differential mean of each sampling point in the current sliding window as the value of the corresponding signal point in the differential waveform of the left boundary of the standard R wave; the mean of each sampling point in the current sliding window constitutes a first set, and the positive and negative signs corresponding to the current sliding window are obtained according to the positive and negative signs of each value in the first set;
[0080] S21223. If the positive and negative signs corresponding to the current sliding window are different from those corresponding to the previous sliding window, stop sliding the window to obtain the left boundary differential waveform of the standard R wave; otherwise, slide the current sliding window to the left by the first step length as the current sliding window, and return to step S21222.
[0081] For example, the left initial position is the 31st sampling point on the left side of the R wave marker, and the sequence D = {d1, d2, …, d N} at a certain position R d There is an R wave marker (the R marker point may be between two sampling points or at a certain sampling point), and the type is normal. The first sampling point to the left of the marker point is d i , then the left sliding window is initially positioned at the marked point R d The 31st to 40th sampling points on the left (counting from right to left), the data in the sliding window is d i-30 ~d i-39 .
[0082] Extract the data of the 31st to 40th sampling points on the left side of each normal R wave mark point, and calculate the mean of each sampling point, that is, calculate the mean of the values of the 31st sampling point on the left side of the normal R wave peak as the value of the 31st signal point on the left side of the standard R wave peak, calculate the mean of the values of the 32nd sampling point on the left side of the normal R wave peak as the value of the 32nd signal point on the left side of the standard R wave peak, and so on. These means constitute the first set.
[0083] The positive and negative signs of the current window are determined according to the positive and negative signs of the means in the first set. If the ratio of the number of positive values in the first set to the total number of values in the first set exceeds the first threshold, the current sliding window corresponds to a positive sign, otherwise the current sliding window corresponds to a negative sign.
[0084] After obtaining the sign of the first sliding window, slide the current sliding window to the left by the first step as the current sliding window; at this time, the data covered by the sliding window is the data of the 32nd to 41st sampling points on the left side of the R wave mark point, and the mean value at each moment is calculated according to the above process as the data of the 32nd to 41st signal points on the left side of the standard R wave peak (at this time, the 32nd to 40th sampling points have been calculated, so only the mean value of the 41st sampling point needs to be calculated), and the mean values of the 32nd to 41st sampling points constitute a new first set, and the sign corresponding to the current window is determined according to the sign of these means in the new first set. If the sign corresponding to the current sliding window is different from the sign corresponding to the previous sliding window, stop sliding the window, obtain the left boundary waveform of the standard R wave, that is, obtain the value of the 31st to 41st signal points on the left side of the standard R wave, if the sign corresponding to the current sliding window is the same as the sign corresponding to the previous sliding window, slide the current sliding window to the left by the first step as the current sliding window, and return to step S21222.
[0085] The same process is used to obtain the right boundary differential waveform of the standard R wave. It should be noted that at this time, the sliding window starts to slide to the right from the 31st sampling point on the right side of the R wave mark point.
[0086] The center differential waveform, left boundary differential waveform, and right boundary differential waveform of the standard R wave are obtained, that is, the standard R wave differential waveform corresponding to the R wave type is obtained. The constructed standard R wave differential waveform excludes the influence of DC component and baseline drift; only the medium and low frequency AC component is retained, which is the dynamic information of the ECG waveform. It can make detection judgment more accurate.
[0087] After obtaining the standard R wave differential waveform, all ECG R waves of this type are similarly calculated with reference to the standard R wave. Specifically, step S22 calculates the confidence of each R wave segment based on the standard R wave differential waveform corresponding to each type of R wave, including:
[0088] S221, performing integral reduction on each type of standard R wave differential waveform to obtain a standard R wave reduction waveform;
[0089] S222, for each type of standard R wave, extract each R wave segment corresponding to the type in the ECG differential signal, perform integral restoration, and use the restored R wave segment as the target R wave;
[0090] S223, calculating the ratio of the standard R wave restoration waveform of each type to the corresponding signal point in each target R wave of the corresponding type to construct a similarity ratio set;
[0091] S224, calculating the similarity confidence interval of each type according to all similarity ratio sets corresponding to the type;
[0092] S223. Calculate the confidence of each target R wave corresponding to the type according to the similarity confidence interval of the type.
[0093] Since the standard R wave is obtained based on the differential waveform, it is necessary to restore it, that is, to convert the standard R wave in the form of integration. The standard R wave differential waveform is represented by S i ={s i-m ,…,s i-1 ,s i1 ,…,s in}, where s i-1 is the first signal point on the left side of the center position of the ith type standard R wave differential waveform, s i1 is the first signal point on the right side of the center position of the i-th standard R-wave differential waveform, s i-m is the left boundary signal point of the i-th standard R-wave differential waveform, s in is the right boundary signal point of the i-th standard R wave differential waveform. The total number of sampling points in the standard R wave differential waveform is m+n.
[0094] Integral restoration is to use the following formula to calculate the corresponding integral restored value for each signal point in the standard R wave differential waveform:
[0095]
[0096] Among them, sr ip represents the value of the pth signal point in the i-th standard R-wave restoration waveform, s iq represents the value of the qth signal point in the i-th standard R-wave differential waveform, and r0 represents the preset baseline value. p∈[1,m+n]. During implementation, r0 takes a positive value so that each sr ip The standard R wave restoration waveform is expressed as SR i ={sr i-m ,…,sr i-1 ,sr i1 ,...,sr in For the standard R wave of the i-th type, extract each R wave segment corresponding to the type in the ECG differential signal. That is, find an R wave marker of this type, extract its left m sampling points and right n sampling points to form an R wave segment of this type, and use the same method as above to perform integral reduction to obtain the target waveform, which is expressed as {xr i-m ,…,xr i-1 ,xr i1 ,...,xr in}.
[0097] There are two differences between the standard R wave restoration waveform and the target R wave and the usual ECG wave: they are inverted and the difference in the baseline starting point is removed, thus avoiding the influence of baseline drift.
[0098] Construct the corresponding similarity ratio set as If there are M i-th type R waves, M similarity ratio sets will be constructed.
[0099] The data in the similarity ratio set are the shape ratios of the R waveform. The waveform of the R wave is affected by many random factors, including electrophysiology, muscle movement, external electromagnetic interference, and the characteristics of the sampling circuit itself. These random factors create a ratio set that obeys or approximately obeys a normal distribution.
[0100] Therefore, calculate the mean μ and variance σ of all values in the M similarity ratio sets 2 , with the overall mean as μ and the variance as σ 2 The normal distribution of ECG energy distribution conforms to the half-normal distribution. The corresponding confidence interval is expressed as [μ-zσ,μ+zσ], where z represents the confidence scale corresponding to the confidence level. For example, the corresponding value of 94.5% confidence level is 2.
[0101] For each target R wave, the confidence of each target R wave is obtained according to the ratio of the number of elements in the corresponding similarity ratio set that fall within the confidence interval to the number of elements in the similarity ratio set.
[0102] For example, a target R wave and a standard R wave have the following similarity ratio sets:
[0103] {1.44, 1.22, 1.09, 1.33, 1.15, 1.29, 1.15, 1.27, 1.27, 1.13, 1.16, 1.15, 1.15, 1.19, 1.15, 1.3, 1.41, 1.2, 1.24, 1.22, 1.04, 1.25, 1.21, 1.01, 1.14, 1.25, 1.19, 1.2, 1.38, 1.21, 1.19, 1.09, 1.36, 1.17, 1.35, 1.1, 1.11, 1.1 9, 1.24, 1.29, 1.11, 1.18, 1.09, 1.08, 1.28, 1.36, 1.18, 1.19, 1.21, 1.11, 1.15, 1.27, 1.07, 1.15, 0.92, 1.24, 1.12, 1.24, 1.18, 1.32}; if μ=1.2, σ=0.05, and confidence scale z=2, then the number of ratios in the similarity ratio set that fall within the confidence interval is 45. Therefore, the confidence value of the target R wave is 45 / 60=75%.
[0104] Since the original ECG signal X and the ECG differential signal D are of equal length and correspond one to one, the target R wave and the R wave in the original ECG signal also correspond one to one, and the confidence of the target R wave is the confidence of the corresponding R wave in the original ECG signal.
[0105] After obtaining the confidence of each R wave, the R wave segments with low confidence are eliminated. Specifically, the preprocessed ECG signal is obtained by eliminating the R wave segments with low confidence, including:
[0106] S22, taking each R wave in the electrocardiogram signal as the current R wave in turn, and if the confidence of the current R wave is less than a first threshold, deleting the signal point between the current R wave peak and the previous R wave peak;
[0107] S24, filtering the ECG signal obtained after removing the R wave with low confidence, re-detecting the R wave on the filtered ECG signal to obtain the R wave position, marking the corresponding position of the ECG signal before filtering as the R wave, and obtaining the pre-processed ECG signal.
[0108] All signals from each R wave with low confidence in the ECG signal from its marked position to the marked position of the previous R wave are removed, so as to facilitate the subsequent accurate extraction of ST segment signals. The ECG signal after removing the R wave with low confidence is represented as X 1 ={d1,d2,…,d N}.
[0109] During implementation, the undecimated wavelet transform (UWT) is used to filter the ECG signal after removing the R wave with low confidence, so as to remove the high-frequency noise in the signal and facilitate more accurate detection. The filtered ECG signal is detected again to obtain the R wave marker, and the corresponding position of the ECG signal before filtering is marked as the R wave to obtain the pre-processed ECG signal, that is, the obtained R wave marker is placed on the ECG signal X after removing the R wave with low confidence. 1 ={d1,d2,…,d N} corresponding position.
[0110] Step S3 determines the positions of the S wave and the T wave based on the preprocessed ECG signal and extracts the ST segment ECG signal, including:
[0111] S31. Perform the following steps for each R wave in order from right to left, traverse all R waves, determine the positions of S waves and T waves, and extract ST segment ECG signals:
[0112] From the current R wave peak, traverse to the left to find the second maximum slope point as the P wave center point, and the third maximum slope point as the T wave center point;
[0113] S32, traverse from the center point of the T wave to the left and find the first slope maximum point as the center point of the S wave;
[0114] S33. Find the starting point of the T wave according to the center point of the T wave, and extract the signal from the center point of the S wave to the starting point of the T wave as the ST segment electrocardiogram signal.
[0115] During implementation, first traverse from right to left, that is, from back to front, each calibrated R wave is taken as the current R wave, and the extreme value method is used to determine the position of the P wave in reverse order, that is, from the R wave to the left, find the first slope maximum point as the Q wave, and the second slope maximum point as the center point of the P wave. After the center point of the P wave is verified, continue to look to the left for the next slope maximum point to obtain the center point of the T wave.
[0116] From the center point of the T wave, continue to traverse to the left to find the first slope maximum point, which is the center point of the S wave. From the center point of the T wave, traverse to the left to find the first slope 0 point, which is the starting point of the T wave. During implementation, the signal from the center point of the S wave to the starting point of the T wave can be extracted as the ST segment ECG signal, or from the center point of the S wave, traverse to the right to find the first slope 0 point, which is the end point of the S wave, and extract the signal from the end point of the S wave to the starting point of the T wave as the ST segment ECG signal.
[0117] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0118] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for extracting ST segment signals from an electrocardiogram, characterized in that: The following steps are involved: Acquire an electrocardiogram signal, and detect the electrocardiogram signal to obtain an R wave in the electrocardiogram signal; Calculate the confidence of each R wave in the ECG signal; remove the R wave segments with low confidence to obtain the preprocessed ECG signal; Based on the preprocessed ECG signal, the positions of S wave and T wave are determined by the reverse method, and the ST segment ECG signal is extracted.
2. The method for extracting ST segment signals from an electrocardiogram according to claim 1, characterized in that: The preprocessed ECG signal is obtained by removing the R wave segments with low confidence, including: Taking each R wave in the ECG signal as the current R wave in turn, if the confidence of the current R wave is less than the first threshold, deleting the signal point between the current R wave peak and the previous R wave peak; The ECG signal obtained after removing the R wave with low confidence is filtered, the R wave is re-detected on the filtered ECG signal to obtain the R wave position, the corresponding position of the ECG signal before filtering is marked as the R wave, and the pre-processed ECG signal is obtained.
3. The method for extracting ST segment signals from an electrocardiogram according to claim 1, characterized in that: Based on the preprocessed ECG signal, the position of the S wave and T wave is determined by the reverse method, and the ST segment ECG signal is extracted, including: Perform the following steps for each R wave in order from right to left, traverse all R waves, determine the positions of S waves and T waves, and extract the ST segment ECG signal: From the current R wave peak, traverse to the left to find the second maximum slope point as the P wave center point, and the third maximum slope point as the T wave center point; From the center point of the T wave, traverse to the left and find the first maximum slope point, which is the center point of the S wave; The starting point of the T wave is found according to the center point of the T wave, and the signal from the center point of the S wave to the starting point of the T wave is extracted as the ST segment ECG signal.
4. The method for extracting ST segment signals from an electrocardiogram according to claim 1, characterized in that: The confidence of each R wave in the ECG signal is calculated in the following way: Performing differential conversion on the ECG signal to obtain an ECG differential signal; constructing a standard R wave differential waveform corresponding to each type of R wave based on the ECG differential signal; The confidence of each R wave segment is calculated based on the standard R wave differential waveform corresponding to each type of R wave.
5. The method for extracting ST segment signals from an electrocardiogram according to claim 4, characterized in that: The confidence of each R wave segment is calculated based on the standard R wave differential waveform corresponding to each type of R wave, including: Perform integral reduction on each type of standard R wave differential waveform to obtain a standard R wave reduction waveform; For each type of standard R wave, extract each R wave segment corresponding to the type in the ECG differential signal, perform integral restoration, and use the restored R wave segment as the target R wave; Calculate the ratio of each type of standard R wave restoration waveform to the corresponding signal point in each target R wave of the corresponding type to construct a similarity ratio set; Calculate the similarity confidence interval of each type based on the set of all similarity ratios corresponding to each type; The confidence of each target R wave corresponding to the type is calculated according to the similarity confidence interval of the type.
6. The method for extracting ST segment signals in an electrocardiogram according to claim 4, characterized in that: Based on the ECG differential signal, a standard R wave differential waveform corresponding to each type of R wave is constructed, including: For each type of R wave, the central differential waveform of the standard R wave corresponding to the type of R wave is obtained according to the differential mean value of the type of R wave in the ECG differential signal; A bidirectional sliding window is used to synchronously slide all such R wave segments, and the boundary differential waveform of the standard R wave corresponding to this type of R wave is obtained according to the differential mean value of the R wave in each sliding window; The standard vertebral R wave differential waveform corresponding to this type of R wave is obtained according to the central differential waveform and the boundary differential waveform of the standard R wave corresponding to this type of R wave.
7. The method for extracting ST segment signals from an electrocardiogram according to claim 6, characterized in that: A bidirectional sliding window is used to synchronously slide all such R wave segments, and the boundary differential waveform of the standard R wave corresponding to this type of R wave is obtained according to the differential mean value of the R wave in the sliding window, including: Determine the left initial position corresponding to the left sliding window and the right initial position corresponding to the right sliding window respectively according to the width of the central differential waveform of the standard R wave; Using a left sliding window to slide leftward from the left initial position in all such R wave segments, and determining the left boundary differential waveform of the standard R wave corresponding to the such R wave according to the differential mean of the R wave in each left sliding window; A right sliding window is used to slide rightward from the right initial position in all such R wave segments, and the right boundary differential waveform of the standard R wave corresponding to this type of R wave is determined according to the differential mean of the R wave in each right sliding window.
8. The method for extracting ST segment signals from an electrocardiogram according to claim 7, characterized in that: The left boundary differential waveform of the standard R wave corresponding to this type of R wave is determined in the following manner: S21221, taking each left sliding window at the left initial position as the current sliding window; calculating the differential mean of each sampling point in the current sliding window as the value of the signal point corresponding to the left boundary differential waveform of the standard R wave; the mean of each sampling point in the current sliding window constitutes a first set, and the positive and negative signs corresponding to the current sliding window are obtained according to the positive and negative signs of each value in the first set; sliding the current sliding window to the left by the first step length as the current sliding window; S21222, calculating the differential mean of each sampling point in the current sliding window as the value of the corresponding signal point in the differential waveform of the left boundary of the standard R wave; the mean of each sampling point in the current sliding window constitutes a first set, and the positive and negative signs corresponding to the current sliding window are obtained according to the positive and negative signs of each value in the first set; S21223. If the positive and negative signs corresponding to the current sliding window are different from those corresponding to the previous sliding window, stop sliding the window to obtain the left boundary differential waveform of the standard R wave; otherwise, slide the current sliding window to the left by the first step length as the current sliding window, and return to step S21222.
9. The method for extracting ST segment signals from an electrocardiogram according to claim 8, characterized in that: The positive and negative signs corresponding to the current sliding window are obtained according to the positive and negative signs of each value in the first set, including: If the ratio of the number of values with positive signs in the first set to the total number of values in the first set exceeds a first threshold, the current sliding window corresponds to a positive sign, otherwise the current sliding window corresponds to a negative sign.
10. The method for extracting ST segment signals in an electrocardiogram according to claim 6, characterized in that: For each type of R wave, the central differential waveform of the standard R wave corresponding to the type of R wave is obtained according to the differential mean value of the type of R wave in the ECG differential signal, including: For each signal point of the central differential waveform of the standard R wave, the differential mean of all sampling points corresponding to the signal point in this type of R wave is calculated as the value of the signal point; and the central differential waveform of the standard R wave is obtained.