Method, system, device and storage medium for generating simulated electrocardiogram data
By constructing a mathematical model of the characteristics of ECG data, simulated ECG data is generated, which solves the problem that the existing ECG database cannot cover complex data samples, and realizes the real simulation of the approximation of complex ECG data.
Patent Information
- Application Number
- CN202111572391.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2021-11-09
- Filing Date
- 2021-12-21
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2041-12-21
AI Technical Summary
The existing ECG database cannot cover all complex ECG data samples, making it difficult to obtain certain ECG data.
By constructing a mathematical model of the electrocardiogram data characteristics of a single cardiac cycle, including sine wave and sharp wave models, the specific parameters of each waveform are determined based on the electrocardiogram data characteristics to be simulated, the specific graphics of each waveform are generated, and they are connected to the end in the order of P-QRS-T-u to obtain the simulated electrocardiogram data.
The simulation of any complex ECG data is realized, and the problem of difficulty in obtaining ECG data is solved, and the ECG data generated through the data model can be approached by the reality.
Smart Images

Figure CN116098625B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of biomedical engineering technology, and in particular relates to a method, system, device and storage medium for generating simulated electrocardiogram data based on a mathematical model. Background Art
[0002] It has been more than a hundred years since the electrocardiogram was invented. Even today, when medicine has developed to a high level, the electrocardiogram is still widely used in medical institutions and its importance remains irreplaceable.
[0003] With the advancement of electronic technology, network, artificial intelligence, sensors and other technologies, ECG equipment is gradually developing towards intelligent analysis, networking, and digitization. In terms of the intelligent development of ECG products and the quality of ECG automatic analysis, various research groups around the world are focusing on several aspects, including:
[0004] 1. Enrich the ECG database to evaluate the analysis program;
[0005] 2. Use the information in each heartbeat to associate related heart conditions: Each heartbeat is a cardiac cycle, which is represented by a set of P-QRS-Tu graphs on the electrocardiogram, that is, a set of P-QRS-Tu electrocardiogram data. Multiple electrocardiogram data are connected end to end to form the entire electrocardiogram data. Different electrocardiogram data correspond to different graphs, reflecting different electrocardiogram conditions, and can be associated with related heart conditions;
[0006] 3. Integrate the results of different programs: Different ECG automatic diagnosis programs may produce different diagnostic results for the same ECG data. The conclusions drawn by multiple automatic diagnosis programs on the same ECG data can be used to synthesize the main conclusions and evaluate the ECG automatic diagnosis programs;
[0007] 4. Using the knowledge of the body surface potential simulation model: by attaching multiple electrodes to different positions of the human body in different conditions (even on the endocardium or extracardiac model), the electrocardiogram performance and corresponding potential change data of different positions can be collected. Through these data, simulation data models of different human conditions can be established. Using these models can increase people's understanding of electrocardiogram;
[0008] 5. Use non-ECG data, etc.: Non-ECG data includes a wide range of information, such as imaging, ultrasound, medical history, etc. The use of the ECG performance corresponding to this information can help people increase their understanding of ECG patterns and improve the correct recognition rate of ECG data by ECG automatic diagnosis programs.
[0009] Every effort is beneficial and will promote the further improvement of the quality of ECG automatic analysis. Whether it is the intelligent research and development of ECG products or the automatic analysis and evaluation of ECG products, ECG data is indispensable. It can be said that the development of ECG intelligence must be supported by data. Rich ECG data is also needed in scientific research, teaching, product testing, quality verification and other occasions.
[0010] Although there are many public ECG databases in the world (such as the MIT-BIH ECG database of the Massachusetts Institute of Technology; the AHA arrhythmia ECG database of the American Heart Association; the CSE ECG database of the European Union and the ST-T ECG database of the European Union, etc.), these databases cannot cover all the complex ECG data samples for the complex and changeable ECG activities. In particular, for some special ECGs, it is difficult to find the corresponding patients, which makes it very difficult to obtain these ECG data. In order to obtain the required ECGs, some scholars have even studied methods to extract ECG data from book illustrations. Summary of the invention
[0011] The purpose of the present invention is to provide a method, system, device and storage medium for generating simulated electrocardiogram data, so as to solve the problem that the existing electrocardiogram database does not cover all complex electrocardiogram data samples, making it difficult to obtain certain electrocardiogram data.
[0012] The present invention solves the above technical problem through the following technical solution: a method for generating simulated electrocardiogram data, comprising the following steps:
[0013] Step 1: According to the ECG data characteristics of a single cardiac cycle, a mathematical model of the P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform is constructed. The specific expression of the mathematical model is:
[0014] Sine wave type: dx = 0:180 / (D wav *S r ):180
[0015] dy=A wav *sin(dx*π / 180)
[0016] tx=T start :1 / S r :D wav +T start
[0017] Spike type: tx q =0:1 / S r :D wav / 2
[0018] dy q=(2*A wav / D wav )*tx q
[0019]
[0020] dy h =(2*A wav / D wav )*abs(D wav -tx h )
[0021] Among them, dx is the angle data set of the sine waveform, dy is the amplitude data set of the sine waveform, tx is the time data set of the sine waveform, D wav is the time width of the sine wave or spike wave, A wav is the amplitude height of the sine wave or sharp wave, T start is the starting time of the sine wave, S r is the sampling rate of the sine wave or spike wave; tx q is the time data set of the front branch of the sharp wave, tx h is the data set of the post-spike time, dy q is the data set of the amplitude of the front branch of the sharp wave, dy h is the data set of the amplitude of the post-spike branch, and abs() is used to find the absolute value;
[0022] Step 2: Determine the characteristics of the electrocardiogram data to be simulated according to the requirements, and judge whether the electrocardiogram data of each cardiac cycle is regular or irregular, and whether the regularity is the same according to the characteristics of the electrocardiogram data to be simulated;
[0023] If the ECG data of each cardiac cycle is regular and has the same pattern, proceed to step 3; if the ECG data of each cardiac cycle is irregular, or the ECG data of each cardiac cycle is regular and has different patterns, proceed to step 7;
[0024] Step 3: Determine the sampling rate, number of samples and frequency of each waveform according to the characteristics of the electrocardiogram data to be simulated, and then determine the amplitude height, time width and time starting point of the P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform of a single cardiac cycle;
[0025] Step 4: According to the waveform to be simulated, the amplitude height, time width, time starting point and sampling rate of each waveform in step 3 are substituted into the sine wave mathematical model of step 1 to obtain the angle data set, amplitude data set and time data set corresponding to each waveform; or, the amplitude height, time width and sampling rate of each waveform in step 3 are substituted into the sharp wave mathematical model of step 1 to obtain the sharp wave front branch time data set, sharp wave rear branch time data set, sharp wave front branch amplitude data set and sharp wave rear branch amplitude data set corresponding to each waveform;
[0026] Step 5: Generate a specific graph of each waveform according to the angle data set, amplitude data set and time data set of the sine wave corresponding to each waveform in step 4, and connect the specific graphs of each waveform end to end in the P-QRS-Tu sequence to obtain an electrocardiogram of a single cardiac cycle; or generate a specific graph of each waveform according to the spike wave anterior branch time data set, spike wave posterior branch time data set, spike wave anterior branch amplitude data set and spike wave posterior branch amplitude data set corresponding to each waveform in step 4, and connect the specific graphs of each waveform end to end in the P-QRS-Tu sequence to obtain an electrocardiogram of a single cardiac cycle;
[0027] Step 6: Determine the number n of cardiac cycles according to the time length of a single cardiac cycle and the total time length, copy n electrocardiograms in step 5, and connect the n electrocardiograms end to end to generate the entire electrocardiogram data or electrocardiogram;
[0028] Step 7: Determine the sampling rate, number of samples and frequency of each waveform according to the characteristics of the electrocardiogram data to be simulated, and then determine the amplitude height, time width and time starting point of the P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform of each cardiac cycle;
[0029] Step 8: According to the waveform to be simulated, the amplitude height, time width, time starting point and sampling rate of each waveform of each cardiac cycle in step 7 are substituted into the sine wave mathematical model of step 1 to obtain the angle data set, amplitude data set and time data set corresponding to each waveform of the cardiac cycle; or, the amplitude height, time width and sampling rate of each waveform in step 3 are substituted into the sharp wave mathematical model of step 1 to obtain the sharp wave front branch time data set, sharp wave rear branch time data set, sharp wave front branch amplitude data set and sharp wave rear branch amplitude data set corresponding to each waveform;
[0030] Step 9: Generate specific graphs of the corresponding waveforms of each cardiac cycle according to the angle data set, amplitude data set and time data set of the sine wave corresponding to each waveform of each cardiac cycle in step 8, and connect the specific graphs of each waveform end to end in the P-QRS-Tu sequence to obtain the electrocardiogram of the corresponding cardiac cycle; or generate specific graphs of each waveform according to the sharp wave anterior branch time data set, sharp wave posterior branch time data set, sharp wave anterior branch amplitude data set and sharp wave posterior branch amplitude data set corresponding to each waveform in step 8, and connect the specific graphs of each waveform end to end in the P-QRS-Tu sequence to obtain the electrocardiogram of a single cardiac cycle;
[0031] Step 10: Connect the electrocardiograms of all cardiac cycles obtained in step 9 in chronological order to generate the entire electrocardiogram data or electrocardiogram.
[0032] In the present invention, according to the characteristics that each waveform signal of a single cardiac cycle is similar to a sine wave or a sharp wave, a mathematical model of each waveform is designed, and then the specific parameters of each waveform are determined according to the characteristics of the electrocardiogram data to be simulated, and the mathematical model is combined with the specific parameters to obtain a specific graph of each waveform, and the specific images of each waveform are connected to obtain the electrocardiogram of each cardiac cycle, and the entire electrocardiogram data or electrocardiogram can be obtained by connecting the electrocardiograms of all cardiac cycles in sequence; the sine wave is a signal with the simplest frequency component, and any complex signal can be regarded as a composite of many sine waves with different frequencies and sizes. Therefore, the specific parameters of each waveform of the electrocardiogram data to be simulated and the data model can be used to simulate arbitrarily complex electrocardiogram data, which solves the problem of difficulty in obtaining electrocardiogram data, and the electrocardiogram data generated by the data model can be close to reality.
[0033] Furthermore, in step 5, when two or more waveforms with partially overlapping time start points and time end points are used to shape a complex waveform, the time data set and amplitude data set of the overlapping area of the two or more waveforms are reconstructed according to the data set combination law.
[0034] Furthermore, in step 3 or 7, when there is no regularity according to the characteristics of the electrocardiogram data to be simulated or the amplitude height, time width and time starting point of any one or more parameters of a certain waveform, the value range of the parameter is determined according to the characteristics of the waveform corresponding to the parameter, and a random number generated by a random function is assigned to the parameter according to the value range, an electrocardiogram is generated, and then it is checked whether the generated electrocardiogram meets the requirements. If the electrocardiogram is consistent with the electrocardiogram data to be simulated, it is saved; otherwise, the random number regenerated by the random function is assigned to the parameter, and the electrocardiogram is regenerated until the generated electrocardiogram meets the requirements.
[0035] Furthermore, in step 6 or 10, when the entire generated ECG data or ECG differs from the ECG data to be simulated, the amplitude height and time width of a single cardiac cycle or each waveform of each cardiac cycle are fine-tuned to achieve adjustment of the shape of each waveform; the time starting point of a single cardiac cycle or each waveform of each cardiac cycle is fine-tuned to achieve adjustment of the starting position of each waveform.
[0036] Furthermore, if the ECG data of each cardiac cycle is irregular and can be decomposed into multiple groups of regular and identical ECG data, then for each group of regular and identical ECG data, generate the corresponding group of ECG data or ECG according to steps 3 to 6; then superimpose and fuse all groups of ECG data or ECG to generate the entire ECG data or ECG.
[0037] Furthermore, the method also includes the step of adding noise or baseline drift to the entire generated electrocardiogram data or electrocardiogram, and the specific formula is:
[0038] ECG data after processing = ECG data before processing + A s1 *sin(2πf1)+A s2 *sin(2πf2)+L+A sn *sin(2πf n )
[0039] Among them, A s1 , A s2 , …, A sn are noise amplitudes, f1, f2, …, f n are noise frequencies.
[0040] The present invention also provides a system for simulating electrocardiogram data generation, comprising:
[0041] The mathematical model building unit is used to build mathematical models of P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform according to the ECG data characteristics of a single cardiac cycle. The specific expression of the mathematical model is:
[0042] Sine wave type: dx = 0:180 / (D wav *S r ):180
[0043] dy=A wav *sin(dx*π / 180)
[0044] tx=T start :1 / S r :D wav +T start
[0045] Spike type: txq =0:1 / S r :D wav / 2
[0046] dy q =(2*A wav / D wav )*tx q
[0047]
[0048] dy h =(2*A wav / D wav )*abs(D wav -tx h )
[0049] Among them, dx is the angle data set of the sine waveform, dy is the amplitude data set of the sine waveform, tx is the time data set of the sine waveform, D wav is the time width of the sine wave or spike wave, A wav is the amplitude height of the sine wave or sharp wave, T start is the starting time of the sine wave, S r is the sampling rate of the sine wave or spike wave; tx q is the time data set of the front branch of the sharp wave, tx h is the data set of the post-spike time, dy q is the data set of the amplitude of the front branch of the sharp wave, dy h is the data set of the amplitude of the post-spike branch, and abs() is used to find the absolute value;
[0050] A judgment unit, used to determine the characteristics of the electrocardiogram data to be simulated according to the requirements, and judge whether the electrocardiogram data of each cardiac cycle is regular or irregular according to the characteristics of the electrocardiogram data to be simulated, and whether the regularity is the same;
[0051] A parameter input unit, used to input the sampling rate, number of samples, frequency of each waveform, and amplitude height, time width, and time starting point of the P waveform, Q waveform, R waveform, S waveform, T waveform, and u waveform of a single cardiac cycle of the electrocardiogram data;
[0052] A set acquisition unit is used to substitute the amplitude height, time width, time starting point and sampling rate of each waveform into a sine wave mathematical model according to the waveform to be simulated, so as to obtain an angle data set, an amplitude data set and a time data set corresponding to each waveform; or substitute the amplitude height, time width and sampling rate of each waveform into a spike wave mathematical model, so as to obtain a spike wave front branch time data set, a spike wave rear branch time data set, a spike wave front branch amplitude data set and a spike wave rear branch amplitude data set corresponding to each waveform;
[0053] A first graphic generating unit is used to generate a specific graphic of each waveform according to the angle data set, amplitude data set and time data set of the sine wave corresponding to each waveform, and connect the specific graphics of each waveform end to end in a P-QRS-Tu sequence to obtain an electrocardiogram of a single cardiac cycle; or generate a specific graphic of each waveform according to the sharp wave anterior branch time data set, sharp wave posterior branch time data set, sharp wave anterior branch amplitude data set and sharp wave posterior branch amplitude data set corresponding to each waveform, and connect the specific graphics of each waveform end to end in a P-QRS-Tu sequence to obtain an electrocardiogram of a single cardiac cycle;
[0054] The second graphic generating unit is used to determine the number n of cardiac cycles according to the time length of a single cardiac cycle and the total time length when the electrocardiogram data of each cardiac cycle is regular and has the same regularity, copy n electrocardiograms generated by the first graphic generating unit, and connect the n electrocardiograms end to end to generate the entire electrocardiogram data or electrocardiogram; and is used to connect all the electrocardiograms generated by the first graphic generating unit end to end in a sequential order to generate the entire electrocardiogram data or electrocardiogram when the electrocardiogram data of each cardiac cycle is irregular or the electrocardiogram data of each cardiac cycle is regular and has different regularities;
[0055] A storage unit is used to store the generated electrocardiogram data or electrocardiogram.
[0056] Furthermore, the system also includes a superposition and fusion unit, which is used to superimpose and fuse all groups of ECG data or ECGs to generate the entire ECG data or ECG when the ECG data of each cardiac cycle is irregular and can be decomposed into multiple groups of regular and identical ECG data.
[0057] The present invention also provides a device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for generating simulated electrocardiogram data as described above is implemented.
[0058] The present invention also provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the method for generating simulated electrocardiogram data as described above is implemented.
[0059] Beneficial Effects
[0060] Compared with the prior art, the advantages of the present invention are:
[0061] The present invention provides a method, system, device and storage medium for generating simulated electrocardiogram data. According to the characteristics of each waveform signal of a single cardiac cycle being similar to a sine wave or a sharp wave, a mathematical model of each waveform is designed, and then the specific parameters of each waveform are determined according to the characteristics of the electrocardiogram data to be simulated, and the mathematical model is combined with the specific parameters to obtain a specific graph of each waveform, and the specific images of each waveform are connected to obtain the electrocardiogram of each cardiac cycle. The entire electrocardiogram data or electrocardiogram can be obtained by connecting the electrocardiograms of all cardiac cycles in sequence; the sine wave is a signal with the singlest frequency component, and any complex signal can be regarded as a composite of many sine waves with different frequencies and sizes. Therefore, the specific parameters of each waveform of the electrocardiogram data to be simulated and the data model can be used to simulate arbitrarily complex electrocardiogram data, thereby solving the problem of difficulty in obtaining electrocardiogram data, and the electrocardiogram data generated by the data model can be close to reality. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only one embodiment of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0063] Figure 1 The waveform diagrams of the electrocardiogram of a single cardiac cycle in Example 1 of the present invention;
[0064] Figure 2 It is a half-wave sinusoidal diagram in the angular amplitude domain in Embodiment 1 of the present invention;
[0065] FIG3 is a time-amplitude domain sine half-wave diagram and a sharp wave diagram in Example 1 of the present invention; FIG3(a) is a sine half-wave diagram, and FIG3(b) is a sharp wave half-wave diagram;
[0066] Figure 4 It is a time-amplitude domain sine half-wave diagram and a sharp wave diagram starting from a specific position in Example 1 of the present invention;
[0067] Figure 5 is a morphological diagram of each wave of a single cardiac cycle in Example 1 of the present invention;
[0068] Figure 6 It is the time period of connecting each wave in a single cardiac cycle in Embodiment 1 of the present invention;
[0069] Figure 7 is the electrocardiogram having 10 cardiac cycles within 10 seconds in Example 1 of the present invention;
[0070] Figure 8 In Example 1 of the present invention, Figure 7 Perform a noisy electrocardiogram;
[0071] Fig. 9 In Example 1 of the present invention, Figure 7 Electrocardiogram after baseline drift processing;
[0072] Fig.10 The wave in which the ascending branch of the R wave in Example 1 of the present invention overlaps;
[0073] Fig.11 The Rs wave with the pre-excitation wave (d) is generated by overlapping and fusion of the two waves of the ascending branch of the R wave in Example 1 of the present invention;
[0074] Fig.12 The descending branch of the R wave and the ascending branch of the T wave in Example 1 of the present invention are fused (myocardial infarction);
[0075] Fig.13 is the Rsr' wave (right bundle branch block) in Example 1 of the present invention;
[0076] Fig.14 is the electrocardiogram of atrial fibrillation in Example 2 of the present invention;
[0077] Fig.15 It is an electrocardiogram simulated and generated by a random function of the application program interface in Embodiment 2 of the present invention;
[0078] Fig.16 This is the graph without P wave in Example 3 of the present invention (rhythm 60 times / min);
[0079] Fig.17 This is the graph of only the P wave in Example 3 of the present invention (rhythm 140 / min);
[0080] Fig.18 is the embodiment of the present invention 3 Fig.15 and 16 Superimposed ECG;
[0081] Fig.19 is the electrocardiogram data of third degree atrioventricular block obtained by taking the maximum absolute value of two data with the same sequence number in Example 3 of the present invention;
[0082] Fig. 20 is the electrocardiogram of ventricular premature beats in Example 3 of the present invention;
[0083] Fig.21 is the electrocardiogram of atrial premature beats in Example 3 of the present invention;
[0084] Fig. 22 is the atrial flutter electrocardiogram in Example 3 of the present invention;
[0085] Fig.23 It is the electrocardiogram of second degree type I atrioventricular block in Example 3 of the present invention;
[0086] Fig.24 is the electrocardiogram of second degree type II atrioventricular block in Example 3 of the present invention;
[0087] Fig.25 is the ventricular tachycardia electrocardiogram in Example 3 of the present invention;
[0088] Fig.26 It is the application program interface of the system for simulating electrocardiogram data generation in Example 4 of the present invention. DETAILED DESCRIPTION
[0089] The following is a clear and complete description of the technical solutions in the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0090] The technical solution of the present application is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0091] Example 1
[0092] The present embodiment provides a method for generating simulated electrocardiogram data, comprising the following steps:
[0093] Step 1: According to the ECG data characteristics of a single cardiac cycle, mathematical models of the P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform are constructed.
[0094] The entire electrocardiogram data or electrocardiogram is composed of electrocardiograms of multiple cardiac cycles. Under normal circumstances, the electrocardiogram of each cardiac cycle is composed of P wave, QRS wave, T wave and U wave, such as Figure 1As shown, the PR segment between the P wave and the QRS wave, the ST segment between the QRS wave and the T wave, and the TP segment between the T wave and the P wave of the next cycle are also included. That is to say, the ECG data of each cardiac cycle includes the data components of the P waveform, QRS waveform, T waveform, u waveform, and the data components of the PR segment, ST segment, and TP segment. Although the shapes of the waveforms (referring to the P waveform, QRS waveform, T waveform, and u waveform) are different, they are generally similar to the half-wave part of the sine wave or the sharp wave. The P wave, T wave, and U wave are similar to the half-wave of the sine wave in most cases. Their main difference lies in size or polarity. Although the QRS wave looks complex and changeable, in fact, the QRS wave is composed of three parts: the Q wave, the R wave, and the S wave. Some of the Q waves, R waves, and S waves are similar to the half-wave part of the sine wave, and some are similar to the sharp wave. However, the Q wave, R wave, and S wave are thinner than the P wave and the T wave. The shape of the wave can be reshaped by changing the amplitude and width of the wave. Moreover, each wave can be shaped by superimposing and fusing two or more sine waves or spike waves of different amplitudes and widths. Therefore, a single wave can be transformed into various forms as needed.
[0095] The specific graphs of each waveform in a cardiac cycle have different characteristics. In order to obtain the data of each waveform, a corresponding mathematical model is established based on the graphical characteristics of different waveforms, namely, a mathematical model of P wave, Q wave, R wave, S wave, T wave, and U wave is established. The parameters involved include the time width D of the waveform. wav , amplitude height A wav , starting time or relative position T start The parameters of the whole ECG data include the number of samples N, the sampling rate S r As well as the frequency of the P wave (PH) and the frequency of the QRS wave (RH).
[0096] From the sine function dz = sin(dx*π / 180), we know that dx is the angle value. When dx = 90, the sine value dz = 1; using the data set to represent dx is:
[0097] dx=0:dp:180, that is, {x∈dx|0≤x≤180 and x|(180 / dp)} (1)
[0098] dz is the sine value data set of half a sine cycle, where dp is the angle interval increment, and its size is determined by the number of points in the interval from 0 to 180. dp can reflect the roundness of the dz trajectory. For example, when dp = 1, through plot(dx, dz), a sine half wave consisting of 180 points can be obtained (such as Figure 2 As shown). Since the sine value of 90 degrees is 1 (dz = 1), the dz values of 0 to 90 degrees and 90 to 180 degrees are between 0 and 1, it can be obtained that the relationship between the amplitude value dy and dz is dy = f(Awav *dz), and dz = sin(dx*π / 180), from which the angular domain relationship is obtained:
[0099] dy=A wav *sin(dx*π / 180) (2)
[0100] That is: {(dx,dy)|dy=A wav *sin(dx*π / 180)}
[0101] Among them, A wav is the amplitude height of the sine wave, that is, the wave height. It can be seen that when the dx value is 90 degrees, dy = A wav .
[0102] Since the electrocardiogram is essentially a time-amplitude domain graph, it reflects the time-amplitude relationship rather than the angle-amplitude relationship, so the angle-amplitude relationship needs to be converted into the time-amplitude relationship. In order to associate the angle interval increment dp with the time interval increment dj, the corresponding time data set tx is obtained, and the time range of the waveform (0~D wav ) is equal to the number of points ds in the angle range (0 to 180), that is:
[0103] ds=D wav / dj=180 / dp (3)
[0104] Among them, dj is the time interval increment (i.e., point spacing), since dj = 1 / S r , from which we can get: dp = 180 / (D wav *S r ), and then from formula (1) we get:
[0105] dx=0:180 / (D wav *S r ):180, that is: {x∈dx|0≤x≤180, x|(D wav *S r )} (4)
[0106] Or: dx = 0:180*dj / D wav :180 That is: {x∈dx|0≤x≤180, x|(D wav / dj)} (5)
[0107] Through formula (3), the dy(dx) angle domain relationship can be converted into the dy(tx) time domain relationship, that is, the time data set tx:
[0108] tx=0:dj:D wav That is: {x∈tx|0≤x≤D wav ,x|(D wav / dj)} (6)
[0109] For example, to draw a picture with a height A wav 0.5mV, time width D wav is 0.12 seconds, the sampling rate is S r Taking the waveform of 500 as an example, the MATLAB program is expressed as follows:
[0110] dj=1 / 500;%Point spacing dj=0.002
[0111] tx=0:dj:0.12;%Formula (6)
[0112] dx=0:180 / (0.12*500):180% Formula (4) or dx=0:180*0.002 / 0.12:180;
[0113] dy=0.5*sin(dx*pi / 180); %Formula (2), pi represents π in MATLAB
[0114] plot(tx,dy);
[0115] Thus, a sinusoidal half-wave with a time-amplitude domain relationship is obtained, as shown in Figure 3(a).
[0116] The initial value T of tx above start If the waveform is expected to be at a certain time position T start To begin with, we have:
[0117] tx=T start :dj:D wav +T start (7)
[0118] By plot(tx,dy), we can get a start A waveform with a time-amplitude relationship similar to a half-sine wave starting at the time position. For example, change the initial value to T start = 0.1 (seconds), by assigning values to expressions (2), (4), (7), we get a waveform with a time-amplitude relationship similar to a half-sine wave starting from 0.1 seconds, as Figure 4 As shown in the left figure. wav The positive or negative value of the waveform determines the polarity of the waveform.
[0119] Through the position or sequence of each waveform, we can get the PRtx, STtx, and TPtx data sets (i.e., the time data sets of the PR segment, ST segment, and TP segment), where the PR segment is from the end of the P wave to the start of the QRS wave, the ST segment is from the end of the QRS wave to the start of the T wave, and the TP segment is from the end of the T wave to the start of the downward P wave. Since the time period line is the equipotential line of the electrocardiogram, the relationship between the time data set tx of the PR segment, ST segment, and TP segment and the amplitude data set dy is:
[0120] dy(tx)=0 (8)
[0121] If you want to simulate and generate a spike wave, since the front and back branches of the spike wave are both straight lines, the slope of the line is determined by the ratio of the peak to the corresponding time width of the front and back branches. If the slopes of the front and back branches are equal, the time data sets of the front and back branches are respectively:
[0122] tx q =0:1 / S r :D wav / 2 (9)
[0123]
[0124] tx=[tx q ,tx h ] (11)
[0125] In equation (11), tx represents the time data set of the sharp wave, and the slopes of the front branch and the back branch are K = A wav / (D wav / 2), therefore, the amplitude data sets of the front branch and the back branch are:
[0126] dy q =K*tx q =(2*A wav / D wav )*tx q (12)
[0127] dy h =K*abs(D wav -tx h )=(2*A wav / D wav )*abs(D wav -tx h ) (13)
[0128] dy=[dy q ,dy h ] (14)
[0129] In formula (14), dy represents the amplitude data set of the spike wave. By plot(tx,dy), we can get a spike wave with a time-amplitude domain relationship, as shown in Figure 3(b).
[0130] The initial value T of tx above start is 0, if the spike waveform is at a certain time position T start To begin with, we have:
[0131] tx=tx+T start (15)
[0132] For example, the initial value T start = 0.5 (seconds), by plot(tx,dy), we can get a sharp wave starting from the 0.5 second position, such as Figure 4 As shown in the right figure.
[0133] Step 2: Determine the characteristics of the electrocardiogram data to be simulated according to the requirements, and judge whether the electrocardiogram data of each cardiac cycle is regular or irregular, and whether the regularity is the same according to the characteristics of the electrocardiogram data to be simulated.
[0134] The ECG data of each cardiac cycle is regular and the same regularity means that the parameters of the P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform of each cardiac cycle are the same. In this case, it is only necessary to generate an ECG of one cardiac cycle, and then copy the ECGs of multiple cardiac cycles according to the total time length of the ECG data to be simulated and connect them end to end to obtain the entire ECG data to be simulated.
[0135] The irregularity of the ECG data of each cardiac cycle means that the parameters of the P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform of each cardiac cycle are all different. In this case, it is necessary to generate the ECG corresponding to each cardiac cycle according to the parameters of the P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform of each cardiac cycle, and then connect the ECGs of all the cardiac cycles in sequence to obtain the entire ECG data to be simulated.
[0136] The ECG data of each cardiac cycle is irregular, but can be decomposed into two or more groups of regular ECG data. The regular ECG corresponding to each group is first generated separately, and then all groups of regular ECGs are superimposed to obtain the entire ECG data to be simulated.
[0137] A set of electrocardiograms includes several cardiac cycles, and the electrocardiogram data of some cardiac cycles may have the same regularity, the electrocardiogram data of some cardiac cycles may have different regularities, or the electrocardiogram data of all cardiac cycles may have different regularities. For those with different regularities, the electrocardiogram corresponding to the cardiac cycle needs to be generated for the parameters of the P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform of each cardiac cycle respectively, and for those with the same regularity, only one electrocardiogram of the cardiac cycle needs to be generated, and the electrocardiograms of the other cardiac cycles are realized by copying, and then the electrocardiograms of the cardiac cycles with different regularities and the electrocardiograms of the cardiac cycles with the same regularity are connected end to end in sequence to obtain the entire electrocardiogram data to be simulated. For those with completely different regularities of the electrocardiogram data of all cardiac cycles, the electrocardiogram corresponding to the cardiac cycle needs to be generated for the parameters of the P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform of each cardiac cycle respectively, and then the electrocardiograms of all cardiac cycles are connected in sequence to obtain the entire electrocardiogram data to be simulated.
[0138] The following specifically describes how to generate the entire ECG data to be simulated in the case where the ECG data of each cardiac cycle is regular and has the same pattern:
[0139] Step 3: Determine the sampling rate S according to the characteristics of the ECG data to be simulated r , the number of samples and the frequency of each waveform (RH, PH), and then determine the amplitude height A of the P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform of a single cardiac cycle wav , time width D wav , Time starting point T start .
[0140] Step 4: If the electrocardiogram to be simulated is similar to a sine wave, substitute the amplitude height, time width, time starting point and sampling rate of each waveform in step 3 into the mathematical model of step 1 (Formulas (2), (4), (7)) to obtain the angle data set dx, amplitude data set dy and time data set tx corresponding to each waveform.
[0141] If the ECG to be simulated is similar to a sharp wave, the amplitude height, time width, time starting point and sampling rate of each waveform in step 3 are substituted into the mathematical model of step 1 (Equations (9), (10), (12), (13)) to obtain the sharp wave front branch time data set tx corresponding to each waveform q , spike back branch time data set tx h , the peak wave front branch amplitude data set dy q And the sharp wave back branch amplitude data set dy h .
[0142] Step 5: Generate a specific graph of each waveform based on the angle data set dx, amplitude data set dy and time data set tx of the sine wave corresponding to each waveform in step 4, and connect the specific graphs of each waveform end to end in the P-QRS-Tu sequence to obtain an electrocardiogram of a single cardiac cycle.
[0143] Alternatively, according to the spike front branch time data set tx corresponding to each waveform in step 4 q , spike back branch time data set tx h , the peak wave front branch amplitude data set dy q And the sharp wave back branch amplitude data set dy h Generate a specific graph of each waveform, and connect the specific graphs of each waveform end to end in the P-QRS-Tu sequence to obtain an electrocardiogram of a single cardiac cycle.
[0144] Step 6: Determine the number n of cardiac cycles according to the time length of a single cardiac cycle and the total time length, copy n electrocardiograms in step 5, and connect the n electrocardiograms end to end to generate the entire electrocardiogram data or electrocardiogram.
[0145] For example, the duration of a single cardiac cycle is designed to be 0.6 seconds and the sampling rate is S r =500 cardiac cycles, where the amplitude heights of the P, Q, R, S, and T waveforms are A wav They are 0.2, -0.3, 0.9, -0.6, 0.4 (mv); D wav They are 0.03, 0.02, 0.02, 0.02, 0.08 (s) respectively; T start They are 0.2, 0.3, 0.32, 0.34, and 0.4 (s) respectively. Since dj = 1 / S r , the tx and dx data sets of each waveform can be obtained by equation (7), (4) or (5), and then the dy data set of each waveform can be obtained by substituting each dx data set into equation (2) (8). The specific procedure is expressed as follows:
[0146] S r =500;
[0147] dj=1 / S r ;
[0148] Ptx=0.2:dj:0.03+0.2;%P wave form (7)
[0149] Pdx=0:180*dj / 0.03:180;%Formula (5)
[0150] Pdy=0.2*sin(Pdx*pi / 180); % Formula (2) pi represents π in matlab
[0151] PRtx=0.23:dj:0.3;%PRFormula (7)
[0152] PRdy(PRtx)=0;%Formula (8)
[0153] Qtx=0.3:dj:0.02+0.3; %Q wave reference formula is the same as P wave
[0154] Qdx = 0:180*dj / 0.02:180;
[0155] Qdy=-0.3*sin(Qdx*pi / 180);
[0156] Rtx=0.32:dj:0.02+0.32; %R wave reference formula is the same as P wave
[0157] Rdx = 0:180*dj / 0.02:180;
[0158] Rdy=0.9*sin(Rdx*pi / 180);
[0159] Stx=0.34:dj:0.02+0.34; %S wave reference formula is the same as P wave
[0160] Sdx = 0:180*dj / 0.02:180;
[0161] Sdy = -0.6*sin(Sdx*pi / 180);
[0162] STtx=0.36:dj:0.4%ST reference formula is the same as PR segment
[0163] STdy(STtx)=0;
[0164] Ttx=0.4:dj:0.08+0.4; %T wave reference formula is the same as P wave
[0165] Tdx = 0:180*dj / 0.08:180;
[0166] Tdy=0.4*sin(Tdx*pi / 180);
[0167] TPtx=0.48:dj:0.8;%TP reference formula is the same as PR segment
[0168] TPdy(TPtx)=0;
[0169] By plotting the tx and dy data sets of each waveform and line segment respectively, and holding on, we can get the individual waves in the cardiac cycle (such as Figure 5 As shown) and the graphs of each time period (as shown Figure 6 shown).
[0170] For the case where the ECG data of each cardiac cycle are regular and have the same regularity, the data set ecg of any cardiac cycle i A set of waveform data and a set of line segment data are connected according to the positional relationship between the waveforms and the line segments (such as Figure 5 and 6 As shown), that is:
[0171] ecg i =[Pdy,PRdy,Qdy,Rdy,Sdy,STdy,Tdy,TPdy] (9)
[0172] Among them, Pdy, PRdy, Qdy, Rdy, Sdy, STdy, Tdy, and TPdy are the amplitude data sets of P waveform, PR segment, Q waveform, R waveform, S waveform, ST segment, T waveform, and TP segment respectively. When the simulated electrocardiogram data is given the number of samples (N) and the sampling rate, the total time length of the data is T l =N / S r , and after setting the heart rate (HR) value, the length of a cardiac cycle is F l For: F l =60 / HR. Given the total time length T l The number of heartbeat cycles n is: n = T l / F l , from which the total time length electrocardiogram data set ecg can be obtained, namely:
[0173] ecg=[ecg1,ecg2,L,ecg i ,L,ecg n ] (10)
[0174] The parameters of each waveform in each cardiac cycle are consistent, so at T l The electrocardiograms of n cardiac cycles are repeatedly connected in sequence. For example, T l = 10 seconds, HR = 60 beats / min, then the length of a cardiac cycle is F l = 1 (second), then n = 10 (times), ecg = [ecg1, ecg2, L, ecg i ,L,ecg 10 ], which is connected into a set of electrocardiogram trajectory data with 10 cardiac cycles in 10 seconds, such as Figure 7 shown.
[0175] If the entire generated ECG data or ECG is different from the ECG data to be simulated, the amplitude height and time width of a single cardiac cycle or each waveform of each cardiac cycle are fine-tuned to achieve adjustment of the shape of each waveform; the time starting point of a single cardiac cycle or each waveform of each cardiac cycle is fine-tuned to achieve adjustment of the starting position of each waveform.
[0176] Step 7: Data Noise or Baseline Drift Processing
[0177] In order to improve the simulation effect of each ECG data, the ECG data is subjected to noise processing. In this embodiment, one or more high-frequency sine waves are superimposed to simulate high-frequency signals such as power frequency and electromyography to generate noise; one or more low-frequency sine waves are used to simulate baseline drift signals, and the formed interference signal is superimposed on the ECG data to obtain the ECG data after noise or baseline drift processing. The specific expression is:
[0178] ECG data after processing = ECG data before processing + A s1 *sin(2πf1)+A s2 *sin(2πf2)+L+A sn *sin(2πf n ) (11)
[0179] Among them, A s1 , A s2 , …, A sn are noise amplitudes, f1, f2, …, f n are noise frequencies.
[0180] By setting the amplitude and frequency of the noise signal or baseline drift signal, and then using formula (11) to implement noise addition or baseline drift processing on the ECG data, Figure 7 The effect after noise processing is as follows Figure 8 As shown, Figure 7 The effect after baseline drift processing is as follows Fig. 9 shown.
[0181] Sometimes the shape of some waves in ECG data cannot be simulated by adjusting the time width and amplitude height of one wave, such as ST segment elevation or depression caused by QRST fusion or superposition, block wave, QRS pre-excitation wave, etc. In these cases, two or even more waves need to be superimposed and fused to generate the required waveform. The specific method is: according to the required wave shape, design two or more waves with different amplitude heights and time widths or polarities, and adjust the T of these waves. startThe values are placed in an interval that can partially overlap. The amplitude data set dy of the two waveforms that overlap is used to reconstruct the dy and tx data sets in the overlapping area according to the data set union law (only one overlapping element is taken), so that the required waveform can be generated.
[0182] For example, Figure 6 The generation of an RS wave with a pre-excitation wave (d) from a QRS wave can be achieved by the following steps:
[0183] (1) Change the A of the original Q wave wav Changed from -0.3 to 0.2.
[0184] (2) D of Q wave wav The value of 0.02 is changed to 0.03, so that it overlaps with the beginning of the R wave. start The value of Q wave is changed to shift the starting position of Q wave to the right, so that Q wave overlaps with R wave). The time data set Qtx, angle data set Qdx and amplitude data set Qdy of Q wave are calculated according to the change of parameters:
[0185] Qtx=0.3:dj:0.03+0.3;
[0186] Qdx = 0:180*dj / 0.03:180;
[0187] Qdy=0.2*sin(Qdx*π / 180);
[0188] Combining the original Rtx, Rdx and Rdy, two upward overlapping waves can be generated, such as Fig.10 shown.
[0189] (3) Reorganize the overlapping and non-overlapping areas tx and dy.
[0190] [Tx,Qw,Rw]=union(Qtx,Rtx); %Associative law (Qtx∪Rtx)
[0191] QRtx=Tx;%Reorganized time data set
[0192] QRdy=[Qdy(Qw),Rdy(Rw)]; % Trajectory data set reorganized according to the combined position of Qdy and Rdy
[0193] The overlapping and fusion of the waveforms is completed. By plot(QRtx,QRdy), the RS wave with pre-excitation wave (d) can be obtained. Fig.11 As shown in Figure 1. Using the set associative law to reconstruct the time data set and amplitude data set of the overlapping area of adjacent waveforms, various complex waveforms can be designed, such as Fig.12 The fusion wave shown, Fig.13The blocked waves shown, etc.
[0194] Example 2
[0195] This embodiment also provides a method for generating simulated electrocardiogram data. For the case where the electrocardiogram data of each cardiac cycle is irregular or the electrocardiogram data of each cardiac cycle is regular but has different regularities, the method includes the following steps:
[0196] Step 1: Determine the sampling rate, number of samples, and frequency of each waveform (RH, PH) according to the characteristics of the ECG data to be simulated, and then determine the amplitude height, time width, and time starting point of the P waveform, Q waveform, R waveform, S waveform, T waveform, and u waveform of each cardiac cycle.
[0197] Since the ECG data of each cardiac cycle is irregular or has different patterns, the entire ECG data or ECG cannot be constructed by generating an ECG of one cardiac cycle and then copying and connecting n ECGs. Instead, the ECG of each cardiac cycle can only be generated first, and then the ECGs of all the ECG cycles can be connected in sequence to generate the entire ECG data or ECG. Therefore, for each cardiac cycle, the amplitude height, time width, and time starting point of each waveform must be determined.
[0198] If the waveform of each cardiac cycle is chaotic, such as the P waves of atrial fibrillation, the sizes of the P waves are different and the spacing is unequal (such as Fig.14 As shown), in addition to designing each cardiac cycle one by one according to the above method, one or several parameter values can also be set through a random function. For example, if the amplitude height of a certain waveform is variable, first design a random function based on the value range of the amplitude height, so that the random number generated by the random function is within the value range, and then use the random number as the amplitude height of the waveform to generate an electrocardiogram. If the generated electrocardiogram is consistent with the electrocardiogram data to be simulated, then save the electrocardiogram, indicating that the random number generated by the random function as the amplitude height can meet the requirements; if the generated electrocardiogram is inconsistent with the electrocardiogram data to be simulated, then use the random function to regenerate a random number, assign an amplitude height, and regenerate the electrocardiogram until the generated electrocardiogram meets the requirements. As shown in the figure, Fig.15 As shown, A wav For example, the implementation method is:
[0199] L=[-2 -1.5 -1 -0.5 0 0.5 1 1.5 2]; %Set the amplitude range
[0200] L x =paretotails(L,0.1,1);%Pareto segmented distribution
[0201] A wav =random(L x);% Random function generates random amplitude values
[0202] Step 2: If the electrocardiogram to be simulated is similar to a sine wave, the amplitude height, time width, time starting point and sampling rate of each waveform in each cardiac cycle are substituted into the mathematical model of Example 1 (i.e., equations (2), (4) and (7)) to obtain the angle data set, amplitude data set and time data set corresponding to each waveform in the corresponding cardiac cycle.
[0203] If the ECG to be simulated is similar to a sharp wave, the amplitude height, time width, time starting point and sampling rate of each waveform in each cardiac cycle are substituted into the mathematical model of step 1 (Equations (9), (10), (12), (13)) to obtain the sharp wave front branch time data set tx corresponding to each waveform q , spike back branch time data set tx h , the peak wave front branch amplitude data set dy q And the sharp wave back branch amplitude data set dy h .
[0204] Step 3: Generate a specific graph of each waveform of each cardiac cycle according to the angle data set, amplitude data set and time data set of the sine wave corresponding to each waveform of each cardiac cycle in step 2, and connect the specific graphs of each waveform end to end in the P-QRS-Tu sequence to obtain the electrocardiogram of the corresponding cardiac cycle. Alternatively, according to the sharp wave front branch time data set tx corresponding to each waveform of each cardiac cycle in step 2 q , spike back branch time data set tx h , the peak wave front branch amplitude data set dy q And the sharp wave back branch amplitude data set dy h Generate a specific graph of each waveform corresponding to the cardiac cycle, and connect the specific graphs of each waveform end to end in the P-QRS-Tu sequence to obtain an electrocardiogram corresponding to the cardiac cycle.
[0205] If two adjacent waveforms overlap within a cardiac cycle, the T start The values are placed in an interval that can partially overlap. The dy and tx data sets of the overlapping area are reconstructed according to the set associative law for the amplitude data set dy of the two waveforms to generate the required waveform.
[0206] Step 4: Compare the electrocardiogram of each cardiac cycle with the electrocardiogram of the corresponding cardiac cycle in the electrocardiogram data to be simulated. If there is a difference, fine-tune the amplitude height and time width of the waveform corresponding to the cardiac cycle to adjust the waveform shape so that the electrocardiogram of the cardiac cycle is consistent with the electrocardiogram of the corresponding cardiac cycle in the electrocardiogram data to be simulated. Figure 1The time starting point of the waveform corresponding to the cardiac cycle is fine-tuned to adjust the starting position of the waveform so that the electrocardiogram of the cardiac cycle is consistent with the electrocardiogram data corresponding to the cardiac cycle in the simulated electrocardiogram data. Figure 1 To.
[0207] Step 5: Connect the electrocardiograms of all cardiac cycles obtained in step 3 end to end in chronological order to generate the entire electrocardiogram data or electrocardiogram.
[0208] Each cardiac cycle corresponds to an electrocardiogram, and the electrocardiograms of all cardiac cycles are connected according to the sequence or position relationship to obtain the entire electrocardiogram data or electrocardiogram to be simulated.
[0209] Step 6: Perform noise addition or baseline drift processing on the ECG data according to formula (11).
[0210] In view of the situation that the ECG data of each cardiac cycle is regular and part of the regularities are the same and part of the regularities are different, for the cardiac cycles with different partial regularities, the generation method of Example 2 is used to generate the ECG of each cardiac cycle, and for the cardiac cycles with the same partial regularities, the generation method of Example 1 is used to generate the ECG of one of the cardiac cycles, and then the ECGs of multiple cardiac cycles are copied; finally, the ECGs of the cardiac cycles with different partial regularities and the ECGs of the cardiac cycles with the same partial regularities are connected end to end in sequence to obtain the entire ECG data to be simulated.
[0211] In case that the ECG data of all cardiac cycles have completely different rules, the generation method of Example 2 is used to generate the entire ECG data or ECG.
[0212] Example 3
[0213] This embodiment also provides a method for generating simulated electrocardiogram data, wherein the electrocardiogram data of each cardiac cycle is irregular and can be decomposed into two or more groups of regular electrocardiograms with the same regularity, the method comprising:
[0214] Step 1: First determine the sampling rate and the number of samples, and then decompose the ECG data to be simulated into two or more groups of regular ECG data with the same rules.
[0215] Step 2: For each set of electrocardiogram data, the generation method of Example 1 is used to generate a corresponding electrocardiogram.
[0216] Step 3: Superimpose and fuse the electrocardiograms of all groups to obtain the entire electrocardiogram data to be simulated.
[0217] Since the time lengths of the multiple groups of ECG data obtained by decomposition are consistent, they can be calculated according to the vector operation rule (ecg = ecg 1 +ecg 2, ecg 1 For the first set of electrocardiogram data, ecg 2 is the second electrocardiogram data set, ecg is the electrocardiogram data set to be simulated) or the two data sets can be superimposed and fused into the electrocardiogram data set to be simulated by taking the maximum absolute value of the same serial number.
[0218] For example, for third degree atrioventricular block, based on the characteristic that the P wave and QRS wave have no fixed coupling interval, a segment of electrocardiogram data without P wave can be generated according to a rhythm design (e.g. Fig.16 Then, a design is used to generate a segment of electrocardiogram data of another rhythm with only P wave (as shown in FIG. Fig.17 As shown), the above two segments of ECG data are superimposed (as shown Fig.18 As shown in the figure), by taking the maximum absolute value of the two data with the same sequence number, the electrocardiogram data of the third degree atrioventricular block can be fused (as shown in the figure). Fig.19 shown).
[0219] In order to quickly generate common typical ECG data, a common ECG data generation template is customized, including ventricular premature beats (such as Fig. 20 as shown), atrial premature beats (as shown Fig.21 as shown), atrial flutter (as shown Fig. 22 as shown), atrial fibrillation (as shown Fig.14 as shown), second degree type I atrioventricular block (as shown Fig.23 as shown), second degree type II atrioventricular block (as shown Fig.24 ), ventricular tachycardia (as shown Fig.25 as shown), third degree atrioventricular block (as shown Fig.19 ), premature ventricular contractions (such as Fig. 20 Graphical data ( Figure 18-24 ), by selecting the required template, the system random function can automatically generate the time, amplitude, and position parameters of different waveform components, thereby generating ECG data with different performances in the same template. After the ECG data is generated, it can be saved as files of different formats (.txt\.mat\.dat) for subsequent file calls or graphic browsing.
[0220] According to the spectrum theory, the present invention knows that any complex signal can be formed by superposition of sine waves of different frequencies and amplitudes, and the same is true for ECG signals. In combination with the characteristics of the ECG, the half-cycle sine wave is used as the basic data model, and is connected, superimposed and fused as needed to approximate the real ECG. At the same time, the addition of noise can be used to simulate the artifacts caused by the environment or the patient. In theory, ECG data of any graph can be generated, which can approximate the real ECG data. It has a wide range of uses in providing verification data for automatic ECG diagnosis, ECG teaching, scientific research and ECG equipment inspection.
[0221] Example 4
[0222] This embodiment also provides a system for simulating electrocardiogram data generation, and its application interface is as follows: Fig.26 As shown, the system includes:
[0223] A mathematical model building unit is used to build mathematical models of P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform according to the ECG data characteristics of a single cardiac cycle. The specific expressions of the mathematical models are shown in formulas (2), (4) and (7), or in formulas (9), (10), (12) and (13).
[0224] The judgment unit is used to determine the characteristics of the electrocardiogram data to be simulated according to the requirements, and judge whether the electrocardiogram data of each cardiac cycle is regular or irregular, and whether the regularity is the same according to the characteristics of the electrocardiogram data to be simulated.
[0225] The parameter input unit is used to input the sampling rate, number of samples, frequency of the waveform (RH, PH), and the amplitude height, time width, and time starting point of the P waveform, Q waveform, R waveform, S waveform, T waveform, and u waveform of a single cardiac cycle.
[0226] A set acquisition unit is used to substitute the amplitude height, time width, time starting point and sampling rate of each waveform into equations (2), (4) and (7) according to the waveform to be simulated, so as to obtain the angle data set, amplitude data set and time data set of the sine wave corresponding to each waveform; or substitute the amplitude height, time width and sampling rate of each waveform into equations (9), (10), (12) and (13) to obtain the time data set of the front branch of the spike wave, the time data set of the rear branch of the spike wave, the amplitude data set of the front branch of the spike wave and the amplitude data set of the rear branch of the spike wave corresponding to each waveform.
[0227] The first graphic generating unit is used to generate a specific graphic of each waveform according to the angle data set, amplitude data set and time data set of the sine wave corresponding to each waveform, and connect the specific graphics of each waveform end to end in a P-QRS-Tu sequence to obtain an electrocardiogram of a single cardiac cycle; or generate a specific graphic of each waveform according to the spike wave anterior branch time data set, spike wave posterior branch time data set, spike wave anterior branch amplitude data set and spike wave posterior branch amplitude data set corresponding to each waveform, and connect the specific graphics of each waveform end to end in a P-QRS-Tu sequence to obtain an electrocardiogram of a single cardiac cycle.
[0228] The second graphic generating unit is used to determine the number n of cardiac cycles according to the time length of a single cardiac cycle and the total time length when the electrocardiogram data of each cardiac cycle is regular and the regularity is the same, copy n electrocardiograms generated by the first graphic generating unit, and connect the n electrocardiograms end to end to generate the entire electrocardiogram data or electrocardiogram; and to connect all the electrocardiograms generated by the first graphic generating unit in a chronological order to generate the entire electrocardiogram data or electrocardiogram when the electrocardiogram data of each cardiac cycle is irregular, or the electrocardiogram data of each cardiac cycle is regular and the regularity is different.
[0229] A storage unit is used to store the generated electrocardiogram data or electrocardiogram.
[0230] The superposition unit is used to superimpose and fuse all groups of electrocardiogram data or electrocardiograms to generate the entire electrocardiogram data or electrocardiogram when the electrocardiogram data of each cardiac cycle is irregular and can be decomposed into multiple groups of regular and identical electrocardiogram data.
[0231] For example, a time length of 0.6 seconds and a sampling rate of S are designed. r = 500 cardiac cycles, the assignment of each parameter is achieved by selecting data through the application interface (such as Fig.26 As shown). Data for each parameter can be directly entered in the text box, or by clicking the drop-down box with an arrow to select data input. If the ECG data of each cardiac cycle is regular and has the same pattern, you only need to design a set of P-QRS-Tu, and click the "Entire Segment Simulation" button to generate the entire ECG data; if the ECG data of each cardiac cycle is irregular and can be decomposed into multiple sets of regular and identical ECG data, after designing a set of P-QRS-Tu, click the "Overlay Mapping" button to design another set of different P-QRS-Tu. After designing, click the "Overlay Merge" button to merge them into the required ECG. ECG graphics are generated in Fig.25 In the axes box, specific parameters can be browsed through the text box with a scroll bar.
[0232] The working process of the system for generating simulated electrocardiogram data described in this embodiment can refer to the generation methods shown in embodiments 1 to 3, and will not be described in detail in this embodiment.
[0233] This embodiment also proposes a device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for generating simulated electrocardiogram data described above when executing the computer program.
[0234] Exemplarily, the computer program may be divided into one or more modules / units, and the one or more modules / units are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units may be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program in the computer device. For example, the computer program may be divided into a mathematical model building unit, a judgment unit, a parameter input unit, a set acquisition unit, a first graphic generation unit, a second graphic generation unit, a storage unit, etc., and the specific functions of each unit are as described above.
[0235] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art may understand that the system for simulating electrocardiogram data generation is only an example of a computer device and does not constitute a limitation on the device. It may include more or fewer components than the system, or combine certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.
[0236] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0237] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the system for generating simulated electrocardiogram data by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, etc.; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0238] When the computer program is executed by a processor, the steps of the method for generating simulated electrocardiogram data are implemented.
[0239] If the system integrated module / unit for generating simulated electrocardiogram data is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media does not include electrical carrier signals and telecommunication signals.
[0240] What is disclosed above is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or modifications within the technical scope disclosed in the present invention, which should be covered within the protection scope of the present invention.
Claims
1. A method for generating simulated electrocardiogram data, characterized in that: The following steps are involved: Step 1: According to the ECG data characteristics of a single cardiac cycle, a mathematical model of the P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform is constructed. The specific expression of the mathematical model is: Sine wave type: dx = 0:180 / (D wav *S r ):180 dy=A wav *sin(dx*π / 180) tx=T start :1 / S r :D wav +T start Spike type: tx q =0:1 / S r :D wav / 2 of q (2*A wav / D wav )*tx q dy h =(2*A wav / D wav )*abs(D wav -tx h ) Among them, dx is the angle data set of the sine waveform, dy is the amplitude data set of the sine waveform, tx is the time data set of the sine waveform, D wav is the time width of the sine wave or spike wave, A wav is the amplitude height of the sine wave or sharp wave, T start is the starting time of the sine wave, S r is the sampling rate of the sine wave or spike wave; tx q is the spike front branch time data set, tx h is the data set of the post-spike time, dy q is the data set of the amplitude of the front branch of the sharp wave, dy h is the data set of the amplitude of the post-spike branch, and abs() is used to find the absolute value; Step 2: Determine the characteristics of the electrocardiogram data to be simulated according to the requirements, and judge whether the electrocardiogram data of each cardiac cycle is regular or irregular, and whether the regularity is the same according to the characteristics of the electrocardiogram data to be simulated; If the ECG data of each cardiac cycle is regular and has the same pattern, proceed to step 3; if the ECG data of each cardiac cycle is irregular, or the ECG data of each cardiac cycle is regular and has different patterns, proceed to step 7; Step 3: Determine the sampling rate, number of samples and frequency of each waveform according to the characteristics of the electrocardiogram data to be simulated, and then determine the amplitude height, time width and time starting point of the P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform of a single cardiac cycle; Step 4: According to the waveform to be simulated, the amplitude height, time width, time starting point and sampling rate of each waveform in step 3 are substituted into the sine wave mathematical model of step 1 to obtain the angle data set, amplitude data set and time data set corresponding to each waveform; or, the amplitude height, time width and sampling rate of each waveform in step 3 are substituted into the sharp wave mathematical model of step 1 to obtain the sharp wave front branch time data set, sharp wave rear branch time data set, sharp wave front branch amplitude data set and sharp wave rear branch amplitude data set corresponding to each waveform; Step 5: Generate a specific graph of each waveform according to the angle data set, amplitude data set and time data set of the sine wave corresponding to each waveform in step 4, and connect the specific graphs of each waveform end to end in the P-QRS-Tu sequence to obtain an electrocardiogram of a single cardiac cycle; or generate a specific graph of each waveform according to the spike wave anterior branch time data set, spike wave posterior branch time data set, spike wave anterior branch amplitude data set and spike wave posterior branch amplitude data set corresponding to each waveform in step 4, and connect the specific graphs of each waveform end to end in the P-QRS-Tu sequence to obtain an electrocardiogram of a single cardiac cycle; Step 6: Determine the number n of cardiac cycles according to the time length of a single cardiac cycle and the total time length, copy n electrocardiograms in step 5, and connect the n electrocardiograms end to end to generate the entire electrocardiogram data or electrocardiogram; Step 7: Determine the sampling rate, number of samples and frequency of each waveform according to the characteristics of the electrocardiogram data to be simulated, and then determine the amplitude height, time width and time starting point of the P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform of each cardiac cycle; Step 8: According to the waveform to be simulated, the amplitude height, time width, time starting point and sampling rate of each waveform of each cardiac cycle in step 7 are substituted into the sine wave mathematical model of step 1 to obtain the angle data set, amplitude data set and time data set corresponding to each waveform of the cardiac cycle; or, the amplitude height, time width and sampling rate of each waveform in step 3 are substituted into the sharp wave mathematical model of step 1 to obtain the sharp wave front branch time data set, sharp wave rear branch time data set, sharp wave front branch amplitude data set and sharp wave rear branch amplitude data set corresponding to each waveform; Step 9: Generate specific graphs of the corresponding waveforms of each cardiac cycle according to the angle data set, amplitude data set and time data set of the sine wave corresponding to each waveform of each cardiac cycle in step 8, and connect the specific graphs of each waveform end to end in the P-QRS-Tu sequence to obtain the electrocardiogram of the corresponding cardiac cycle; or generate specific graphs of each waveform according to the sharp wave anterior branch time data set, sharp wave posterior branch time data set, sharp wave anterior branch amplitude data set and sharp wave posterior branch amplitude data set corresponding to each waveform in step 8, and connect the specific graphs of each waveform end to end in the P-QRS-Tu sequence to obtain the electrocardiogram of a single cardiac cycle; Step 10: Connect the electrocardiograms of all cardiac cycles obtained in step 9 in chronological order to generate the entire electrocardiogram data or electrocardiogram.
2. The method for generating simulated electrocardiogram data according to claim 1, characterized in that: In step 5, when two or more waveforms with partially overlapping time start points and time end points are used to shape a complex waveform, the time data set and amplitude data set of the overlapping area of the two or more waveforms are reconstructed according to the data set combination law.
3. The method for generating simulated electrocardiogram data according to claim 1, characterized in that: In step 3 or 7, when there is no regularity according to the characteristics of the electrocardiogram data to be simulated or any one or more parameters of the amplitude height, time width and time starting point of a certain waveform, the value range of the parameter is determined according to the characteristics of the waveform corresponding to the parameter, and a random number generated by a random function is assigned to the parameter according to the value range, an electrocardiogram is generated, and then it is checked whether the generated electrocardiogram meets the requirements. If the electrocardiogram is consistent with the electrocardiogram data to be simulated, it is saved; otherwise, the random number regenerated by the random function is assigned to the parameter, and the electrocardiogram is regenerated until the generated electrocardiogram meets the requirements.
4. The method for generating simulated electrocardiogram data according to claim 1, characterized in that: In step 6 or 10, when the entire generated electrocardiogram data or electrocardiogram is different from the electrocardiogram data to be simulated, the amplitude height and time width of a single cardiac cycle or each waveform of each cardiac cycle are fine-tuned to achieve adjustment of the shape of each waveform; the time starting point of a single cardiac cycle or each waveform of each cardiac cycle is fine-tuned to achieve adjustment of the starting position of each waveform.
5. The method for generating simulated electrocardiogram data according to claim 1, characterized in that: If the ECG data of each cardiac cycle is irregular and can be decomposed into multiple groups of regular and uniform ECG data, then for each group of regular and uniform ECG data, generate the corresponding group of ECG data or ECG according to steps 3 to 6; then superimpose and fuse all groups of ECG data or ECG to generate the entire ECG data or ECG.
6. The method for generating simulated electrocardiogram data according to any one of claims 1 to 5, characterized in that: The step of adding noise or baseline drift to the entire generated electrocardiogram data or electrocardiogram is also included, and the specific formula is: ECG data after processing = ECG data before processing + A s1 *sin(2πf1)+A s2 *sin(2πf2)+...+A sn *sin(2πf n )in, A s1 , A s2 , …, A sn are noise amplitudes, f1, f2, …, f n are noise frequencies.
7. A system for simulating electrocardiogram data generation, characterized in that: include: The mathematical model building unit is used to build mathematical models of P waveform, Q waveform, R waveform, S waveform, T waveform and u waveform according to the ECG data characteristics of a single cardiac cycle. The specific expression of the mathematical model is: Sine wave type: dx = 0:180 / (D wav *S r ):180 dy=A wav *sin(dx*π / 180) tx=T start :1 / S r :D wav +T start Spike type: tx q =0:1 / S r :D wav / 2 of q (2*A wav / D wav )*tx q dy h =(2*A wav / D wav )*abs(D wav -tx h ) Among them, dx is the angle data set of the sine waveform, dy is the amplitude data set of the sine waveform, tx is the time data set of the sine waveform, D wav is the time width of the sine wave or spike wave, A wav is the amplitude height of the sine wave or sharp wave, T start is the starting time of the sine wave, S r is the sampling rate of the sine wave or spike wave; tx q is the spike front branch time data set, tx h is the data set of the post-spike time, dy q is the data set of the amplitude of the front branch of the sharp wave, dy h is the data set of the amplitude of the post-spike branch, and abs() is used to find the absolute value; A judgment unit, used to determine the characteristics of the electrocardiogram data to be simulated according to the requirements, and judge whether the electrocardiogram data of each cardiac cycle is regular or irregular according to the characteristics of the electrocardiogram data to be simulated, and whether the regularity is the same; A parameter input unit, used to input the sampling rate, number of samples, frequency of each waveform, and amplitude height, time width, and time starting point of the P waveform, Q waveform, R waveform, S waveform, T waveform, and u waveform of a single cardiac cycle of the electrocardiogram data; A set acquisition unit is used to substitute the amplitude height, time width, time starting point and sampling rate of each waveform into a sine wave mathematical model according to the waveform to be simulated, so as to obtain an angle data set, an amplitude data set and a time data set corresponding to each waveform; or substitute the amplitude height, time width and sampling rate of each waveform into a spike wave mathematical model, so as to obtain a spike wave front branch time data set, a spike wave rear branch time data set, a spike wave front branch amplitude data set and a spike wave rear branch amplitude data set corresponding to each waveform; A first graphic generating unit is used to generate a specific graphic of each waveform according to the angle data set, amplitude data set and time data set of the sine wave corresponding to each waveform, and connect the specific graphics of each waveform end to end in a P-QRS-Tu sequence to obtain an electrocardiogram of a single cardiac cycle; or generate a specific graphic of each waveform according to the sharp wave anterior branch time data set, sharp wave posterior branch time data set, sharp wave anterior branch amplitude data set and sharp wave posterior branch amplitude data set corresponding to each waveform, and connect the specific graphics of each waveform end to end in a P-QRS-Tu sequence to obtain an electrocardiogram of a single cardiac cycle; The second graphic generating unit is used to determine the number n of cardiac cycles according to the time length of a single cardiac cycle and the total time length when the electrocardiogram data of each cardiac cycle is regular and has the same regularity, copy n electrocardiograms generated by the first graphic generating unit, and connect the n electrocardiograms end to end to generate the entire electrocardiogram data or electrocardiogram; and is used to connect all the electrocardiograms generated by the first graphic generating unit end to end in a sequential order to generate the entire electrocardiogram data or electrocardiogram when the electrocardiogram data of each cardiac cycle is irregular or the electrocardiogram data of each cardiac cycle is regular and has different regularities; A storage unit is used to store the generated electrocardiogram data or electrocardiogram.
8. The system for generating simulated electrocardiogram data according to claim 7, characterized in that: It also includes a superposition and fusion unit, which is used to superimpose and fuse all groups of electrocardiogram data or electrocardiograms to generate the entire electrocardiogram data or electrocardiogram when the electrocardiogram data of each cardiac cycle is irregular and can be decomposed into multiple groups of regular and identical electrocardiogram data.
9. A device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method for generating simulated electrocardiogram data according to any one of claims 1 to 6 is implemented.
10. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for generating simulated electrocardiogram data as claimed in any one of claims 1 to 6 is implemented.