A heartbeat clustering method based on focal region registration

Through the heart-shooting clustering method based on focus area registration, the problem of large calculation volume or insufficient accuracy of the existing technology central electric waveform automatic clustering device is solved, and fast and accurate extraction of main morphology of ECG signals and clustering template generation is achieved.

CN114722874BActive Publication Date: 2025-04-22BIOX INSTR CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210394331.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-15
Publication Date
2025-04-22
Estimated Expiration
2042-04-15

AI Technical Summary

Technical Problem

The existing ECG waveform automatic clustering machine has large calculation volume or insufficient accuracy, and cannot effectively process complex multi-morphological ECG signals, resulting in insufficient accuracy of the results and requires manual participation.

Method used

The heart beat clustering method based on focus area registration is adopted. By constructing the R-wave position histogram and histogram filtering conditions, the unconcerned shots are quickly deleted, the main morphological peak characteristics are positioned, and similar heart beat data are positioned through time to calculate the similarity to generate a clustering template.

Benefits of technology

This method can quickly obtain the main form of the ECG signal with a small calculation amount, overcome baseline drift interference, improve the accuracy of the result, reduce the calculation amount and improve the matching accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114722874B_ABST
    Figure CN114722874B_ABST
Patent Text Reader

Abstract

The present invention provides a heartbeat clustering method based on focal area registration, which can quickly obtain the main form of the electrocardiogram signal with a small amount of calculation, and can overcome the interference caused by baseline drift, thereby improving the accuracy of the result. In the technical solution of the present invention, by constructing an R wave position histogram and a histogram screening condition, the irrelevant heartbeats are quickly deleted, and the heartbeats with similar characteristics are found, and the main form peak features are located. Then, the heartbeat data classified as the non-main form peak is directly located to the heartbeat data in the main form peak feature closest to it through time, and the similarity between the two is calculated. The heartbeat samples that meet the similarity accuracy requirements are found, and together with the main form peak features, a clustering template is formed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of medical artificial intelligence technology, and in particular to a heartbeat clustering method based on focal area registration. Background Art

[0002] The method of analyzing the heartbeat of ECG signal based on clustering algorithm plays a very important role in the intelligent analysis of ECG signal and clinical auxiliary diagnosis. Usually, ECG clustering algorithm is based on the heartbeat characteristic parameters or template matching to cluster the heartbeats with similar morphology into pairs, and obtain the characteristic waveform of the ECG signal of the target object for technical personnel to analyze and assist diagnosis. However, the calculation method based on characteristic parameters is susceptible to noise interference and has poor stability, and the accuracy of the obtained characteristic waveform is unstable; the calculation method based on template matching method is inefficient and has a large amount of calculation, and it is difficult to distinguish heartbeats with similar morphology. There are also technicians who combine template matching and characteristic parameter methods to analyze ECG signals, but they still cannot solve the disadvantage of large amount of calculation brought by template matching method. Ultimately, the ECG waveform automatic clusterer in the prior art has poor adaptability, cannot meet the application under complex multi-morphological ECG signals, the accuracy of the obtained results is insufficient, and manual participation is required to judge the final results. Summary of the invention

[0003] In order to solve the problem of large computational complexity or insufficient accuracy of existing ECG waveform automatic clusterers, the present invention provides a heart beat clustering method based on focal area registration, which can quickly obtain the main form of ECG signals with a smaller computational complexity, while overcoming the interference caused by baseline drift and improving the accuracy of the results.

[0004] The technical solution of the present invention is as follows: a heartbeat clustering method based on focal area registration, which comprises the following steps:

[0005] S1: Perform baseline filtering and high-pass filtering on the original ECG waveform to remove noise;

[0006] S2: Taking the voltage sampling value of the baseline position of the electrocardiogram as 0mv, QRS recognition is performed to obtain heart beat data;

[0007] S3: obtaining an original heartbeat data sequence;

[0008] Assume that the original ECG waveform includes N heart beats in total;

[0009] Sample each heartbeat, assuming that the sampling time is T milliseconds;

[0010] For each heartbeat, take the electrocardiogram of T / 2 milliseconds around the R wave as the center as the sample of the heartbeat, and get N heartbeat samples in total, which are recorded as the heartbeat samples to be processed;

[0011] Assuming that the sampling frequency of each of the heartbeat samples is F, each of the heartbeat samples to be processed includes F*T / 1000 sampling points;

[0012] It is characterized in that it also includes the following steps:

[0013] S4: constructing an R wave position histogram for all the heart beat samples to be processed;

[0014] The abscissa of the R wave position histogram is the sampling value distribution interval, and the ordinate represents the number of the heart beat samples to be processed whose sampling values ​​of the R wave position are in the corresponding abscissa interval;

[0015] S5: Find the peak features of the main pattern;

[0016] Based on the R wave position histogram, find the abscissa corresponding to the maximum ordinate value, which is recorded as Xmax;

[0017] Starting from Xmax, search left and right to find the horizontal coordinate that satisfies the following two histogram screening conditions;

[0018] Histogram screening condition 1: |X-Xmax|>1;

[0019] Histogram screening condition 2: The vertical coordinate value of point X is 0, or when searching to the left, the vertical coordinate value of point X is less than X-1, or when searching to the right, the vertical coordinate value of point X is less than X+1;

[0020] The horizontal coordinates that meet the histogram screening conditions when searching to the left are marked as LeftX, and the horizontal coordinates that meet the histogram screening conditions when searching to the right are marked as RightX; the interval [LeftX, RightX] is recorded as the same feature interval;

[0021] Divide all the heartbeat samples to be processed in the histogram into two sets, the samples whose R wave sampling value positions fall into [LeftX, RightX] form set A, and the rest form set B; at this time, the heartbeat samples to be processed in set A are samples that meet the peak characteristics of the main form;

[0022] S6: Set a basic feature sampling time tb;

[0023] The basic feature sampling time means that within the basic feature sampling time tb, the features of the heartbeat data of the same form are in the same same feature interval;

[0024] That is, when two heartbeat samples to be processed have Nd feature points respectively in the same feature interval to the left and to the right of the R wave position as the starting point, the two are considered to be heartbeat samples of the same form;

[0025] Nd = [(T / 2) / tb ];

[0026] S7: removing all the feature points that strictly conform to the main form features from set A to obtain a feature set of the main form, specifically comprising the following steps;

[0027] a1: Assume that a basic feature sampling time tb includes d sampling points, then each of the heart beat samples to be processed takes the R wave position as the starting point, and has Nd sampling points to the left and right respectively;

[0028] a2: Starting from the R wave, find the j*dth sampling point to the left or right, and record it as the jth comparison feature point;

[0029] Wherein, j is a natural number less than or equal to Nd, j = 1, 2, ..., Nd;

[0030] a3: recording the heartbeat samples to be processed included in the set A as characteristic heartbeat samples;

[0031] a4: constructing a comparison feature point position histogram based on the jth comparison feature point for all the feature point beat samples;

[0032] The horizontal axis of the comparison feature point position histogram is the sampling value distribution interval, and the vertical axis represents the number of the heart beat samples to be processed whose sampling value of the j-th comparison feature point is in the corresponding horizontal axis interval;

[0033] a5: Based on the compared feature point position histogram, find the abscissa corresponding to the maximum ordinate value, recorded as Xmax;

[0034] Taking Xmax as the starting point, search leftward and rightward respectively to find the horizontal coordinate that satisfies both the histogram screening condition 1 and the histogram screening condition 2;

[0035] The horizontal coordinates that meet the histogram screening conditions when searching to the left are marked as LeftX, and the horizontal coordinates that meet the histogram screening conditions when searching to the right are marked as RightX; the interval [LeftX, RightX] is recorded as the same feature interval;

[0036] a6: Divide all the characteristic point beat samples into two sets, compare the samples whose characteristic point sampling value positions fall into [LeftX, RightX], and name them as set A j , the rest form set B j ;

[0037] At this time, set A j The heartbeat samples to be processed in are samples having the same features as the j*dth comparison features;

[0038] a7: Replace set A j Replace the said set A. When j < Nd, after executing j = j + 1, loop and execute steps a3 to a7;

[0039] Until j = Nd, execute step a8;

[0040] a8: Take the finally obtained set A Nd As the final set A, the set A at this time is a sample set that strictly conforms to the main morphological characteristics;

[0041] Put all the heart beat samples to be processed in all sets B j Into the said set B;

[0042] S8: Set the similarity threshold Thd;

[0043] The said similarity threshold Thd is the accuracy of the clustering template, that is, if the similarity between two heart beats is greater than the threshold Thd, then it is considered to conform to the same characteristics and belongs to the same clustering set;

[0044] S9: Based on the said similarity threshold Thd, take out the samples that meet the similarity requirements from set B and put them into set A to obtain the clustering template. The calculation process includes the following steps:

[0045] Suppose there are Nb heart beat samples to be processed in the said set B;

[0046] Take out each of the said heart beat samples to be processed one by one, denoted as heart beat i, and find the heart beat sample that is closest to heart beat i in time in the said set A, denoted as heart beat iNear;

[0047] Calculate the similarity SIM between heart beat i and heart beat iNear. If the similarity SIM is greater than the said similarity threshold Thd, then move this sample from set B to set A;

[0048] After calculating all Nb heart beat samples to be processed in set B, the samples contained in set A are a clustering template.

[0049] Its further feature lies in:

[0050] It also includes the following steps:

[0051] S10: Take the sample data in the said set B as the heart beat samples to be processed, loop and execute steps S4 to S15, and continue to calculate to obtain other clustering templates;

[0052] In step S9, the method for calculating the similarity between heart beat i and heart beat iNear includes the following steps:

[0053] b1: Find all characteristic peak areas of heartbeat i and heartbeat iNear respectively;

[0054] Assume that the set of all characteristic peak regions included in heart beat i is mFt;

[0055] The set of all characteristic peak regions included in the heartbeat iNear is nFt;

[0056] b2: Calculate the correlation between the characteristic peak set mFt and the heartbeat iNear, denoted as: correlation mSim;

[0057] b3: Calculate the correlation between the characteristic peak set nFt and the heartbeat i, denoted as: correlation nSim;

[0058] b4: copy the smaller value of mSim and nSim to the similarity SIM;

[0059] In step b1, the method for calculating the characteristic peak area includes:

[0060] c1: Set the search range to 300 milliseconds around R;

[0061] Assume: the heartbeat to be found in the characteristic peak area;

[0062] c2: Find all sampling points within 300 milliseconds before and after the R wave of the heartbeat to be found;

[0063] For each sampling point x, a window with the center at x and the range of [x-len, x+len] is set, which is called the retrieval window;

[0064] c3: Find all sampling points in the search window that simultaneously meet the following peak point conditions and record them as peak points;

[0065] Peak condition 1: point x is the maximum or minimum;

[0066] Peak point condition 2: The difference between the highest point and the lowest point in the window is greater than 0.3mv;

[0067] c4: Search for sampling points to the left and right with the peak point as the center, and find sampling points that meet the following conditions, which are recorded as xLeft and xRight respectively:

[0068] The time from x is greater than 200ms, or the sampling value of this point * the sampling value of the previous point < 0;

[0069] The region [xLeft, xRight] constitutes the characteristic peak region with x as the peak point;

[0070] c5: sorting all the characteristic peak regions found in the order in which they were found;

[0071] In steps b2 and b3, the method for calculating the correlation comprises the following steps:

[0072] d1: The characteristic peak set involved in the calculation is recorded as: set xFt, and the heartbeat involved in the calculation is recorded as heartbeat xx;

[0073] d2: According to the order of the characteristic peak regions in the set xFt, take out the characteristic peak region with the serial number xi, and record it as: the characteristic peak region to be calculated;

[0074] Assume that the width of the characteristic peak region is LenI, and the corresponding waveform is iWvFt;

[0075] d3: Find all starting points S corresponding to the characteristic peak area to be calculated in the heartbeat xx;

[0076] d4: Taking each starting point S as a starting point, take out a waveform region nWvS of the same width in the heartbeat xx, and calculate the Pearson correlation coefficient Cor of the waveform iWvFt and nWvS:

[0077] Matching value iValue = Pearson correlation coefficient Cor;

[0078] d5: Find the largest value among all the matching values ​​iValue corresponding to the feature peak region to be calculated, and set it as the matching value corresponding to the feature peak region to be calculated;

[0079] d6: The value of the correlation between the set xFt and the heartbeat xx is set to the minimum value among the matching values ​​iValue corresponding to all the characteristic peak regions to be calculated;

[0080] The method for searching the starting point S comprises the following steps:

[0081] e1: confirm the relationship between the sequence number xi and 1 of the characteristic peak region to be calculated;

[0082] If xi=1, then: execute step e2;

[0083] Otherwise xi>1, execute step e3;

[0084] e2: The starting point S corresponding to the heartbeat xx of the characteristic peak region to be calculated with the serial number xi is:

[0085] All sampling points from 300ms before the R wave of heart beat xx to 300ms after the R wave;

[0086] e3: The starting point S corresponding to the characteristic peak region to be calculated with sequence number xi in heart beat xx is:

[0087] All sampling points between 100ms in front and 100ms behind the matching position iPoint corresponding to the characteristic peak region to be calculated with sequence number xi-1;

[0088] The calculation method of the matching position iPoint is:

[0089] f1: Calculate the Pearson correlation coefficient Cor and the amplitude difference ValChange of each starting point S corresponding to the characteristic peak area to be calculated with the serial number xi-1 in the heartbeat xx;

[0090] Amplitude difference ValChange=|MaxMin1-MaxMin0| / MaxMin0;

[0091] Where: MaxMin0 is the maximum and minimum difference of all waveforms iWvFt included in the set xFt, MaxMin1 is the maximum and minimum difference of all waveforms nWvS included in the heartbeat xx;

[0092] f2: Find the starting point S that satisfies the following conditions, which is maxS:

[0093] ValChange<0.2 and the Pearson correlation coefficient Cor is the largest;

[0094] Matching position iPoint=maxS+LenI-1.

[0095] The present invention provides a heartbeat clustering method based on focal area registration. The method quickly deletes irrelevant heartbeats by constructing an R wave position histogram and a histogram screening condition, finds heartbeats with similar features, locates the main form peak feature, and then directly locates the heartbeat data classified as non-main form peaks to the heartbeat data in the main form peak feature closest to it through time, calculates the similarity between the two, finds the heartbeat samples that meet the similarity accuracy requirements, and forms a clustering template together with the main form peak feature; during the calculation process, when locating the main form peak feature, since a large number of QRS samples contained in the main form can be directly determined to be similar, no further related calculation is required, thereby greatly accelerating the matching speed; in the process of generating a clustering template based on the main form peak feature, the heartbeat data involved in the calculation are quickly located through time, and irrelevant heartbeat data do not participate in the calculation, further greatly reducing the amount of calculation and improving the matching accuracy. At the same time, in the process of calculating the similarity, the two heartbeat data involved in the calculation are divided according to the characteristic peak area. When comparing, the characteristic peak areas of the two heartbeat data are compared, which reduces the interference of baseline drift on the similarity and ensures that both the main peak characteristics and the secondary peak characteristics are included in the results, thereby improving the accuracy of the waveform similarity matching results of the two heartbeat data. BRIEF DESCRIPTION OF THE DRAWINGS

[0096] Figure 1 An embodiment of a heartbeat sample to be processed;

[0097] Figure 2 A is a schematic diagram of the position of the R wave of each heartbeat, and B is an example of an R wave position histogram;

[0098] Figure 3 Finding implementation examples for peak features of the main morphology;

[0099] Figure 4 is a sample of set A and set A j Schematic diagram of

[0100] Figure 5 is a schematic diagram of the positional relationship between heartbeat i and heartbeat iNear on the heartbeat to be processed;

[0101] Figure 6 Calculate the embodiment for characteristic peak area;

[0102] Figure 7 This is a first embodiment of similarity calculation;

[0103] Figure 8 This is the second embodiment of similarity calculation;

[0104] Fig. 9 Schematic diagram of the process of the heartbeat clustering method based on focal area registration. DETAILED DESCRIPTION

[0105] The present invention provides a heartbeat clustering method based on focal area registration, which comprises the following steps.

[0106] S1: Perform baseline filtering and high-pass filtering on the original ECG waveform to remove noise.

[0107] After filtering, the voltage sampling value of the baseline position of the electrocardiogram is considered to be 0mv. Then QRS recognition is performed to obtain N heart beats.

[0108] S2: Taking the voltage sampling value of the baseline position of the electrocardiogram as 0mv, QRS recognition is performed to obtain heart beat data.

[0109] S3: obtaining an original heartbeat data sequence;

[0110] Assume that the original ECG waveform contains N heart beats;

[0111] Sample each heartbeat, assuming that the sampling time is T milliseconds;

[0112] For each heartbeat, take the electrocardiogram of T / 2 milliseconds around the R wave as the center as the sample of the heartbeat, and get N heartbeat samples in total, which are recorded as the heartbeat samples to be processed;

[0113] Assuming that the sampling frequency of each heartbeat sample is F, each heartbeat sample to be processed includes F*T / 1000 sampling points.

[0114] like Figure 1 In the embodiment shown, T=1000ms, F=128, then: for each heartbeat, 500ms of the electrocardiogram wave is intercepted around the R wave as the center as the sample of the heartbeat, and a total of N heartbeat samples are obtained. Each sample has a duration of 1000ms, and assuming the sampling rate is 128, it contains 128 sampling points.

[0115] S4: constructing an R wave position histogram for all heart beat samples to be processed;

[0116] The abscissa of the R wave position histogram is the sampling value distribution interval, and the ordinate represents the number of heart beat samples to be processed whose sampling values ​​of the R wave position are in the corresponding abscissa interval.

[0117] like Figure 2 As shown in Figure A, the sampling values ​​of each heartbeat R wave position are counted. The distribution of the sampling values ​​is counted and a histogram is drawn to obtain Figure 2 Figure B is the R wave position histogram in this embodiment.

[0118] The horizontal coordinate x=122 of the histogram represents that there are 900 samples whose R wave position sampling value is in [1.05mv,1.1mv). Each horizontal coordinate point represents a sampling value distribution interval: 0 represents <-5mv, 1 represents [-5mv,-5+0.05mv),...i represents [-5+(i-1)*0.05mv,-5+i*0.05mv],....200 represents [5.95mv,5mv), 201 represents >=5mv. The vertical coordinate represents the number of heartbeats whose "R wave position sampling value" is in the corresponding horizontal coordinate interval.

[0119] S5: Find the peak features of the main pattern;

[0120] Based on the R wave position histogram, find the horizontal coordinate corresponding to the maximum vertical coordinate value, recorded as Xmax;

[0121] Starting from Xmax, search left and right to find the horizontal coordinate that satisfies the following two histogram screening conditions;

[0122] Histogram screening condition 1: |X-Xmax|>1;

[0123] Histogram screening condition 2: The vertical coordinate value of point X is 0, or when searching to the left, the vertical coordinate value of point X is less than X-1, or when searching to the right, the vertical coordinate value of point X is less than X+1.

[0124] The horizontal coordinates that meet the histogram filtering conditions when searching to the left are marked as LeftX, and the horizontal coordinates that meet the histogram filtering conditions when searching to the right are marked as RightX; the interval [LeftX, RightX] is recorded as the same feature interval;

[0125] All the heartbeat samples to be processed in the histogram are divided into two sets, the samples whose R wave sampling value position falls into [LeftX, RightX] form set A, and the rest form set B; at this time, the heartbeat samples to be processed in set A are samples that meet the peak characteristics of the main form.

[0126] like Figure 3 As shown, an embodiment of searching for peak features of the main morphology.

[0127] ① Find the horizontal coordinate point Xmax=122 corresponding to the maximum vertical coordinate value (900) of the histogram.

[0128] ②Search left and right from the horizontal coordinate Xmax=122 as the starting point. If the horizontal coordinate X satisfies the following two conditions at the same time:

[0129] First: |X-Xmax|>1

[0130] Second: "The ordinate value of point X is 0" or "the ordinate value of point X is less than the ordinate value of point X±1" (-1 to the left and +1 to the right);

[0131] When the vertical coordinate value of point X is 0, the next point, whether upward or downward, enters the statistical range of another "peak"; when the vertical coordinate value of point X is less than X±1, it also means that it enters the morphological range of another "peak" from the X±1 coordinate; Figure 3 In the embodiment, the next point "X±1" of the horizontal coordinate X that meets the conditions is also counted in the main form peak of this time. In the actual data collection process, there will be slight changes in adjacent sampling points caused by disturbances, but there are no two different peaks. In this method, when the voltage difference between adjacent sampling points is less than 0.1mv, even if |X-Xmax|>1 occurs, the data of the adjacent X±1 coordinate points are also counted in the current peak form data, ensuring that the data changes caused by disturbances are also taken into account, so that this method conforms to the actual data changes, and further ensures the accuracy of the calculation results of this method. Then, this embodiment obtains the left boundary point LeftX=120 and the right boundary point RightX=125, and divides all samples in the histogram into two sets. The samples whose R wave sampling value positions fall into the interval [LeftX, RightX] constitute set A, and the rest constitute set B.

[0132] S6: Set a basic feature sampling time tb;

[0133] The basic feature sampling time means that within the basic feature sampling time tb, the features of the heartbeat data with the same form are in the same same feature interval;

[0134] That is, when two heartbeat samples to be processed have Nd feature points in the same feature interval to the left and to the right of the R wave position, respectively, they are considered to be heartbeat samples of the same morphology;

[0135] Nd = [(T / 2) / tb ].

[0136] In this embodiment, tb is set to 30ms, that is, it is considered that the waveform within 30ms can represent the characteristics of the heartbeat sample to be processed. When T is 1000,

[0137] (1000 / 2) / 30 = 16.667

[0138] After ignoring decimal places and rounding, Nd = 16, that is, when two heartbeat data start from the R wave position and there are 16 points to the left or right in the same characteristic interval, it is considered that the two heartbeats have the same morphology and belong to the same cluster set.

[0139] S7: removing all feature points that strictly conform to the main form features in set A to obtain the feature set of the main form, which specifically includes the following steps.

[0140] a1: Assume that a basic feature sampling time tb includes d sampling points. Then, each heart beat sample to be processed starts from the R wave position and has Nd sampling points to the left and right respectively.

[0141] a2: Starting from the R wave, find the j*dth sampling point to the left or right, and record it as the jth comparison feature point;

[0142] Wherein, j is a natural number less than or equal to Nd, j=1, 2,…,Nd.

[0143] In this embodiment, with the R wave as the center, the value of j to the left or right is: j=1, 2, ..., 16;

[0144] With the R wave as the center on the horizontal axis, the sampling points involved in the calculation in the left and right directions are: 4, 8, 12, ..., 64.

[0145] a3: The heartbeat samples to be processed included in set A are recorded as characteristic heartbeat samples.

[0146] a4: construct a histogram of the position of the comparative feature points based on the jth comparative feature point for all the feature point beat samples;

[0147] The abscissa of the comparison feature point position histogram is the sampling value distribution interval, and the ordinate represents the number of the to-be-processed heartbeat samples whose sampling value of the j-th comparison feature point is in the corresponding abscissa interval.

[0148] a5: Based on the comparison feature point position histogram, find the abscissa corresponding to the maximum value of the ordinate, denoted as Xmax;

[0149] Search left and right respectively starting from Xmax to find the abscissas that simultaneously meet Histogram Screening Condition 1 and Histogram Screening Condition 2;

[0150] The abscissa found when searching left that meets the histogram screening condition is denoted as LeftX, and the abscissa found when searching right that meets the histogram screening condition is denoted as RightX; Denote the interval [LeftX, RightX] as the same feature interval.

[0151] a6: Divide all the feature point heartbeat samples into two sets. The samples whose comparison feature point sampling value positions fall into [LeftX, RightX] are named Set A j , and the rest form Set B j ;

[0152] At this time, the to-be-processed heartbeat samples in Set A j are samples with the same features as the j*d-th comparison feature.

[0153] As Figure 4 shown, it is a schematic diagram of the samples in Set A and Set A j .

[0154] a7: Replace Set A with Set A. When j < Nd, after executing j = j + 1, loop and execute steps a3 to a7; j

[0155] Until j = Nd, execute step a8.

[0156] a8: Take the finally obtained Set A Nd as the final Set A. At this time, Set A is the sample set that strictly conforms to the main morphological features;

[0157] Put all the to-be-processed heartbeat samples in all Set B j into Set B.

[0158] S8: Set the similarity threshold Thd;

[0159] The similarity threshold Thd is the accuracy of the clustering template, that is, if the similarity of two heartbeats is greater than the threshold Thd, then it is determined that they conform to the same features and belong to the same clustering set.

[0160] ​The specific value of Thd is set according to the accuracy requirement of this calculation. The accuracy of the result is controlled according to the actual needs by setting Thd to ensure that this method is applicable to different application scenarios. In this embodiment, Thd=95%. When the similarity threshold of two waveforms is above 95%, they are considered to meet the same characteristics and belong to the same cluster set.

[0161] S9: Based on the similarity threshold Thd, samples that meet the similarity requirement are taken from set B and put into set A to obtain a clustering template. The calculation process includes the following steps:

[0162] Assume that there are Nb heartbeat samples to be processed in set B;

[0163] Take out each heartbeat sample to be processed from set B one by one, record it as heartbeat i, and find the heartbeat sample to be processed that is closest to heartbeat i in time in set A, record it as heartbeat iNear; Figure 5 As shown, it is a schematic diagram of the position relationship between heartbeat i and heartbeat iNear on the heartbeat to be processed;

[0164] Calculate the similarity SIM between heartbeat i and heartbeat iNear. If the similarity SIM is greater than the similarity threshold Thd, move the sample from set B to set A.

[0165] After calculating all Nb heartbeat samples to be processed in set B, the samples contained in set A are obtained, which is a clustering template.

[0166] S10: The sample data in set B is used as the heartbeat samples to be processed, and steps S4 to S15 are executed in a loop to continue calculating and obtaining other clustering templates.

[0167] In step S9, the method for calculating the similarity between heartbeat i and heartbeat iNear comprises the following steps:

[0168] b1: Find all characteristic peak areas of heartbeat i and heartbeat iNear respectively;

[0169] Assume that the set of all characteristic peak regions included in heart beat i is mFt;

[0170] The set of all characteristic peak regions included in the heartbeat iNear is nFt;

[0171] b2: Calculate the correlation between the characteristic peak set mFt and the heartbeat iNear, denoted as: correlation mSim;

[0172] b3: Calculate the correlation between the characteristic peak set nFt and the heartbeat i, denoted as: correlation nSim;

[0173] b4: Copy the smaller value of mSim and nSim to the similarity SIM.

[0174] In this method, the smaller value of mSim and nSim is used as the similarity SIM between heartbeat i and heartbeat iNear, which is compared with the degree threshold Thd to ensure that the similarity calculated in this method is a strict similarity, thereby ensuring the accuracy of the clustering set obtained in this method.

[0175] In step b1, the method for calculating the characteristic peak area includes:

[0176] c1: Set the search range to 300 milliseconds around R;

[0177] Assume: the heartbeat to be found in the characteristic peak area;

[0178] c2: Find all sampling points within 300 milliseconds before and after the R wave of the heartbeat to be found;

[0179] For each sampling point x, a window with the center at x and the range of [x-len, x+len] is set, which is called the retrieval window;

[0180] c3: Find all sampling points in the search window that simultaneously meet the following peak point conditions and record them as peak points;

[0181] Peak condition 1: point x is the maximum or minimum;

[0182] Peak point condition 2: The difference between the highest point and the lowest point in the window is greater than 0.3mv;

[0183] c4: Search for sampling points to the left and right with the peak as the center, and find sampling points that meet the following conditions, which are recorded as xLeft and xRight respectively:

[0184] The time from x is greater than 200ms, or the sampling value of this point * the sampling value of the previous point < 0;

[0185] The region [xLeft, xRight] constitutes the characteristic peak region with x as the peak point;

[0186] c5: Sort all the characteristic peak regions found in the order in which they were found.

[0187] The sampling points within 300 seconds before and after the R wave are used for comparison because 300ms represents the size of the matching area. This method examines the waveform within the time range of a complete cardiac cycle of a heartbeat. In actual applications, 300ms before and after the R wave can contain the PQRST wave process of a heartbeat cycle, so the regional waveform of 300ms before and after the R wave is used for calculation.

[0188] The waveform within the time range of a complete cardiac cycle of a heartbeat includes P wave, QRS wave and T wave. In this method, the similarity of P wave does not need to be considered in the matching process, only the similarity of QRS wave and T wave is considered. The limit of the height of the normal P wave in the electrocardiogram is 0.3mv, and "the difference between the highest point and the lowest point in the window is greater than 0.3mv", indicating that the window is not a window dominated by the peak caused by the P wave. In order to find the peaks caused by the QRST wave in the electrocardiogram and its corresponding left and right boundaries, the height and duration of the QRST wave have specific ranges. In practical applications, because the peak point of the QRST wave will not exceed 200ms from its boundary, in this method, xLeft and xRight are restricted by the condition of 200ms, and a point that meets the "time from x is greater than 200ms" will no longer be found.

[0189] This method examines the similarity of the QRS wave and the T wave within the time range of a complete cardiac cycle of a heartbeat. Here, Len is set to use the window method to search for the peaks corresponding to the QRS wave and the T wave. Len can be taken as data less than the heartbeat length. In this embodiment, Len is taken as 100ms, which can cover the peak area caused by the QRST wave.

[0190] like Figure 6 As shown, it is a schematic diagram of the positional relationship of the characteristic peak regions in the set mFt and the set nFt in the heart beat data where they are located.

[0191] In steps b2 and b3, the method for calculating the correlation includes the following steps:

[0192] d1: The characteristic peak set involved in the calculation is recorded as: set xFt, and the heartbeat involved in the calculation is recorded as heartbeat xx;

[0193] d2: According to the order of the characteristic peak regions in the set xFt, take out the characteristic peak region with the serial number xi, and record it as: the characteristic peak region to be calculated;

[0194] Assume the width of the characteristic peak area is LenI, and the corresponding waveform is iWvFt;

[0195] d3: Find all starting points S corresponding to the characteristic peak area to be calculated in the heartbeat xx;

[0196] d4: Taking each starting point S as the starting point, take out the waveform area nWvS of the same width in the heartbeat xx, and calculate the Pearson correlation coefficient Cor of the waveform iWvFt and nWvS:

[0197] Matching value iValue = Pearson correlation coefficient Cor;

[0198] d5: Find the largest value among all the matching values ​​iValue corresponding to the feature peak region to be calculated, and set it as the matching value corresponding to the feature peak region to be calculated;

[0199] d6: The value of the correlation between the set xFt and the heartbeat xx is set to the minimum value among the matching values ​​iValue corresponding to all the characteristic peak regions to be calculated;

[0200] When calculating the similarity, the characteristic peak regions in the set xFt are taken out one by one, and for each characteristic peak region, starting from S on the waveform of heartbeat xx and LenI as the width, all regions with the same width are searched for by sliding, and then the Pearson Correlation Coefficient (Pearson Correlation Coefficient) of each region on heartbeat xx and the characteristic peak region to be calculated is calculated respectively;

[0201] For the Pearson correlation coefficient, the larger the absolute value, the stronger the correlation. The most similar region on the heartbeat xx for each feature peak region to be calculated is found by maximizing the matching value; then, the smallest Pearson correlation coefficient corresponding to all feature peak regions is used to represent the correlation between the set xFt and the heartbeat xx, ensuring that the calculated correlation is the most stringent correlation.

[0202] The method for finding the starting point S includes the following steps:

[0203] e1: confirm the relationship between the sequence number xi and 1 of the characteristic peak area to be calculated;

[0204] If xi=1, then: execute step e2;

[0205] Otherwise xi>1, execute step e3;

[0206] e2: The starting point S of the characteristic peak region to be calculated with serial number xi corresponding to the heart beat xx is:

[0207] All sampling points from 300ms before the R wave of heart beat xx to 300ms after the R wave;

[0208] e3: The starting point S corresponding to the characteristic peak region to be calculated with serial number xi in heart beat xx is:

[0209] All sampling points between 100ms in front and 100ms behind the matching position iPoint corresponding to the characteristic peak region to be calculated with sequence number xi-1.

[0210] When determining the starting point S, this method searches for the characteristic peak region to be calculated with a serial number of 1 within 300ms before and after the R wave of the heartbeat to be found. Once the characteristic peak region to be calculated with a serial number of 1 is found, the second characteristic peak region to be calculated is searched within 100ms before and after the characteristic peak region to be calculated with a serial number of 1. Similarly, the subsequent characteristic peak region to be calculated is searched within 100ms before and after the characteristic peak region to be calculated with a serial number of 2… Through the 100ms restriction, it is ensured that the positional relationship between the characteristic peak region found on the heartbeat xx and the previous characteristic peak region is consistent with the positional relationship between the characteristic peak regions to be calculated in the set xFt, thereby ensuring that the final similarity result between the heartbeat i and the heartbeat iNear is accurate.

[0211] The calculation method of the matching position iPoint is:

[0212] f1: Calculate the Pearson correlation coefficient Cor and amplitude difference ValChange of each starting point S corresponding to the characteristic peak area to be calculated with sequence number xi-1 in the heart beat xx;

[0213] Amplitude difference ValChange=|MaxMin1-MaxMin0| / MaxMin0;

[0214] Where: MaxMin0 is the maximum and minimum difference of all waveforms iWvFt included in the set xFt, MaxMin1 is the maximum and minimum difference of all waveforms nWvS included in the heartbeat xx;

[0215] If only the Pearson correlation coefficient Cor of the waveforms iWvFt and nWvS is considered when calculating the similarity, even if Cor is very large (close to 100%), it can only indicate that the rising and falling trends of the waveforms iWvFt and nWvS are consistent, and it cannot ensure that the amplitudes of the two waveforms are consistent; in the present invention, the amplitude difference ValChange is calculated by MaxMin0 and MaxMin1, and combined with the Pearson correlation coefficient Cor, it is ensured that the two similar waveforms found based on this method not only have the same waveform trend, but also the same waveform amplitude. This ensures the accuracy of the clustering template calculated based on this method.

[0216] f2: Find the starting point S that satisfies the following conditions, which is maxS:

[0217] ValChange<0.2 and the Pearson correlation coefficient Cor is the largest;

[0218] Matching position iPoint=maxS+LenI-1.

[0219] like Figure 7 FIG. 1 is a first example of similarity calculation.

[0220] Take out the characteristic peak area with serial number 1 on heart beat m. After calculation, there are 3 characteristic peak areas: characteristic peak areas 1 to 3, arranged from left to right on the horizontal axis in the order found; take out the characteristic peak area with serial number 1 as the characteristic peak area to be calculated. On the waveform of heart beat n, take all sampling points from 300ms before the R wave to 300ms after the R wave as the starting point S, and calculate the Pearson correlation coefficient one by one.

[0221] Assume that, through calculation, on heart beat n, the Pearson correlation coefficient between the area with a starting point S of -300ms and the characteristic peak area to be calculated is 0%, and the Pearson correlation coefficient between the area with a starting point S of -100ms and the characteristic peak area to be calculated is 30%, then the matching value iValue of characteristic peak area 1 is 30%.

[0222] like Figure 8 FIG. 2 shows a second example of similarity calculation.

[0223] exist Figure 7 On the basis of the embodiment shown, the characteristic peak region with the sequence number 2 is continuously taken out as the characteristic peak region to be calculated. The second characteristic peak region to be calculated is searched within 100ms before and after the matching position iPoint corresponding to the characteristic peak region to be calculated with the sequence number 1 on the waveform of heart beat n, and the minimum correlation between the characteristic peak set mFt of heart beat m and heart beat n is calculated one by one.

[0224] Figure 7 In the region where the starting point S is -100ms, if the condition "ValChange<0.2 and the Pearson correlation coefficient Cor is the largest" is met, the starting point S of -100ms is used as maxS to calculate the matching position iPoint of the feature peak region to be calculated with sequence number 1. Then all sampling points within 100ms before and after iPoint are used as the starting point S for subsequent calculations.

[0225] After using the technical solution of the present invention, in terms of computational efficiency, the "threading and stripping" of the focus area is used to quickly remove the messy waveform and find out the peak characteristics of the main form. Since a large number of QRS samples contained in the main form can be directly judged as similar, no further correlation calculation is required, thereby greatly enhancing the matching speed. In terms of matching accuracy, by finding all the characteristic peak areas on the heartbeat data, taking all the characteristic peak areas as the focus, using the "focus area correlation" method, and using similarity to measure the similarity between two QRS waves on different heartbeat data, it avoids the traditional use of the entire QRS interval for correlation coefficient matching, resulting in weak anti-interference ability against baseline drift and ignoring the shortcomings of the similarity of secondary peaks.

Claims

1. A heartbeat clustering method based on focal area registration, comprising the following steps: S1: Perform baseline filtering and high-pass filtering on the original ECG waveform to remove noise; S2: Taking the voltage sampling value of the baseline position of the electrocardiogram as 0mv, QRS recognition is performed to obtain heart beat data; S3: obtaining an original heartbeat data sequence; Assume that the original ECG waveform includes N heart beats in total; Sample each heartbeat, assuming that the sampling time is T milliseconds; For each heartbeat, take the electrocardiogram of T / 2 milliseconds around the R wave as the center as the sample of the heartbeat, and get N heartbeat samples in total, which are recorded as the heartbeat samples to be processed; Assuming that the sampling frequency of each of the heartbeat samples is F, each of the heartbeat samples to be processed includes F*T / 1000 sampling points; It is characterized in that it also includes the following steps: S4: constructing an R wave position histogram for all the heart beat samples to be processed; The abscissa of the R wave position histogram is the sampling value distribution interval, and the ordinate represents the number of the heart beat samples to be processed whose sampling values ​​of the R wave position are in the corresponding abscissa interval; S5: Find the peak features of the main pattern; Based on the R wave position histogram, find the abscissa corresponding to the maximum ordinate value, which is recorded as Xmax; Starting from Xmax, search left and right to find the horizontal coordinate that satisfies the following two histogram screening conditions; Histogram screening condition 1: |X-Xmax|>1; Histogram screening condition 2: The vertical coordinate value of point X is 0, or when searching to the left, the vertical coordinate value of point X is less than X-1, or when searching to the right, the vertical coordinate value of point X is less than X+1; The horizontal coordinates that meet the histogram screening conditions when searching to the left are marked as LeftX, and the horizontal coordinates that meet the histogram screening conditions when searching to the right are marked as RightX; the interval [LeftX, RightX] is recorded as the same feature interval; Divide all the heartbeat samples to be processed in the histogram into two sets, the samples whose R wave sampling value positions fall into [LeftX, RightX] form set A, and the rest form set B; at this time, the heartbeat samples to be processed in set A are samples that meet the peak characteristics of the main form; S6: Set a basic feature sampling time tb; The basic feature sampling time means that within the basic feature sampling time tb, the features of the heartbeat data of the same form are in the same same feature interval; That is, when two heartbeat samples to be processed have Nd feature points respectively in the same feature interval to the left and to the right of the R wave position as the starting point, the two are considered to be heartbeat samples of the same form; Nd = [(T / 2) / tb ]; S7: removing all the feature points that strictly conform to the main form features from set A to obtain a feature set of the main form, specifically comprising the following steps; a1: Assume that a basic feature sampling time tb includes d sampling points, then each of the heart beat samples to be processed takes the R wave position as the starting point, and has Nd sampling points to the left and right respectively; a2: Starting from the R wave, find the j*dth sampling point to the left or right, and record it as the jth comparison feature point; Wherein, j is a natural number less than or equal to Nd, j = 1, 2, ..., Nd; a3: recording the heartbeat samples to be processed included in the set A as characteristic heartbeat samples; a4: constructing a comparison feature point position histogram based on the jth comparison feature point for all the feature point beat samples; The horizontal axis of the comparison feature point position histogram is the sampling value distribution interval, and the vertical axis represents the number of the heart beat samples to be processed whose sampling value of the j-th comparison feature point is in the corresponding horizontal axis interval; a5: Based on the compared feature point position histogram, find the abscissa corresponding to the maximum ordinate value, recorded as Xmax; Taking Xmax as the starting point, search leftward and rightward respectively to find the horizontal coordinate that satisfies both the histogram screening condition 1 and the histogram screening condition 2; The horizontal coordinates that meet the histogram screening conditions when searching to the left are marked as LeftX, and the horizontal coordinates that meet the histogram screening conditions when searching to the right are marked as RightX; the interval [LeftX, RightX] is recorded as the same feature interval; a6: Divide all the characteristic point beat samples into two sets, compare the samples whose characteristic point sampling value positions fall into [LeftX, RightX], and name them as set A j , the rest form set B j ; At this time, set A j The heartbeat samples to be processed in are samples having the same features as the j*dth comparison features; a7: Replace the set A j Replace the set A. When j < Nd, after executing j = j + 1, loop and execute steps a3 to a7; Until j=Nd, execute step a8; a8: The final set A Nd As the final set A, the set A at this time is a sample set that strictly conforms to the main morphological characteristics; All sets B j Put the heartbeat samples to be processed in into the set B; S8: Setting similarity threshold Thd; The similarity threshold Thd is the accuracy of the clustering template, that is, if the similarity of two heartbeats is greater than the threshold Thd, they are considered to have the same characteristics and belong to the same clustering set; S9: Based on the similarity threshold Thd, samples meeting the similarity requirement are taken from set B and put into set A to obtain a clustering template. The calculation process includes the following steps: Assume that there are Nb heartbeat samples to be processed in the set B; Take out each of the heartbeat samples to be processed one by one, record it as heartbeat i, and find the heartbeat sample to be processed closest to the heartbeat i in time in the set A, record it as heartbeat iNear; Calculate the similarity SIM between heartbeat i and heartbeat iNear, and if the similarity SIM is greater than the similarity threshold Thd, move the sample from set B to set A; After calculating all Nb heartbeat samples to be processed in set B, the samples contained in set A are obtained, which is a clustering template.

2. The heartbeat clustering method based on focal area registration according to claim 1, characterized in that: It also includes the following steps: S10: The sample data in the set B is used as the heartbeat samples to be processed, and steps S4 to S15 are executed in a loop to continue calculating and obtaining other clustering templates.

3. The heartbeat clustering method based on focal area registration according to claim 1, characterized in that: In step S9, the method for calculating the similarity between heartbeat i and heartbeat iNear comprises the following steps: b1: Find all characteristic peak areas of heartbeat i and heartbeat iNear respectively; Assume that the set of all characteristic peak regions included in heart beat i is mFt; The set of all characteristic peak regions included in the heartbeat iNear is nFt; b2: Calculate the correlation between the characteristic peak set mFt and the heartbeat iNear, denoted as: correlation mSim; b3: Calculate the correlation between the characteristic peak set nFt and the heartbeat i, denoted as: correlation nSim; b4: Copy the smaller value of mSim and nSim to the similarity SIM.

4. The heartbeat clustering method based on focal area registration according to claim 3, characterized in that: In step b1, the method for calculating the characteristic peak area includes: c1: Set the search range to 300 milliseconds around R; Assume: the heartbeat to be found in the characteristic peak area; c2: Find all sampling points within 300 milliseconds before and after the R wave of the heartbeat to be found; For each sampling point x, a window with x as the center and a range of [x-len, x+len] is set, which is called the retrieval window; c3: Find all sampling points in the search window that simultaneously meet the following peak point conditions and record them as peak points; Peak condition 1: point x is the maximum or minimum; Peak point condition 2: The difference between the highest point and the lowest point in the window is greater than 0.3mv; c4: Search for sampling points to the left and right with the peak point as the center, and find sampling points that meet the following conditions, which are recorded as xLeft and xRight respectively: The time from x is greater than 200ms, or the sampling value of this point * the sampling value of the previous point < 0; The region [xLeft, xRight] constitutes the characteristic peak region with x as the peak point; c5: Sort all the characteristic peak regions found in the order in which they are found.

5. The heartbeat clustering method based on focal area registration according to claim 3, characterized in that: In steps b2 and b3, the method for calculating the correlation comprises the following steps: d1: The characteristic peak set involved in the calculation is recorded as: set xFt, and the heartbeat involved in the calculation is recorded as heartbeat xx; d2: According to the order of the characteristic peak regions in the set xFt, take out the characteristic peak region with the serial number xi, and record it as: the characteristic peak region to be calculated; Assume that the width of the characteristic peak region is LenI, and the corresponding waveform is iWvFt; d3: Find all starting points S corresponding to the characteristic peak area to be calculated in the heartbeat xx; d4: Taking each starting point S as a starting point, take out a waveform region nWvS of the same width in the heartbeat xx, and calculate the Pearson correlation coefficient Cor of the waveform iWvFt and nWvS: Matching value iValue = Pearson correlation coefficient Cor; d5: Find the largest value among all the matching values ​​iValue corresponding to the feature peak region to be calculated, and set it as the matching value corresponding to the feature peak region to be calculated; d6: The value of the correlation between the set xFt and the heartbeat xx is set to the minimum value among all the matching values ​​iValue corresponding to the characteristic peak regions to be calculated.

6. The heartbeat clustering method based on focal area registration according to claim 5, characterized in that: The method for searching the starting point S comprises the following steps: e1: confirm the relationship between the sequence number xi and 1 of the characteristic peak region to be calculated; If xi=1, then: execute step e2; Otherwise xi>1, execute step e3; e2: The starting point S corresponding to the heartbeat xx of the characteristic peak region to be calculated with the serial number xi is: All sampling points from 300ms before the R wave of heart beat xx to 300ms after the R wave; e3: The starting point S corresponding to the characteristic peak region to be calculated with sequence number xi in heart beat xx is: All sampling points between 100ms in front of and 100ms behind the matching position iPoint corresponding to the characteristic peak region to be calculated with sequence number xi-1.

7. The heartbeat clustering method based on focal area registration according to claim 6, characterized in that: The calculation method of the matching position iPoint is: f1: Calculate the Pearson correlation coefficient Cor and the amplitude difference ValChange of each starting point S corresponding to the characteristic peak area to be calculated with the serial number xi-1 in the heartbeat xx; Amplitude difference ValChange=|MaxMin1-MaxMin0| / MaxMin0; Where: MaxMin0 is the maximum and minimum difference of all waveforms iWvFt included in the set xFt, MaxMin1 is the maximum and minimum difference of all waveforms nWvS included in the heartbeat xx; f2: Find the starting point S that satisfies the following conditions, which is maxS: ValChange<0.2 and the Pearson correlation coefficient Cor is the largest; Matching position iPoint=maxS+LenI-1.

Citation Information

Patent Citations

  • Electrocardiosignal P wave extraction method based on wavelet transformation and K average clustering algorithm

    CN110084096A

  • Improved electrocardiosignal quick clustering analysis method

    CN110367969A