Bundle branch block detection based on QRS analysis of digital ECG signal

In this study a new method of bundle branch block detection based on simple mathematical analysis is proposed. During our research we have done analysis of digital ECG signal and formulated a new algorithm of detection, which uses the most common mathematical methods of maximum and minimum search and calculating the mean value. All pieces of evidence of bundle branch block, which is used in this study, connected with QRS-complex and it properties. Besides part of QRS-complex detection, this method does not use any of signal transformation. QRS-detection algorithm does not effect on next stages and can be changed if it necessary. Final algorithm has been studied by 39 test samples. As a result of it 73% sensitivity has been reached.


Introduction
Diseases of the cardiovascular system are on the first place in the death rate in modern world [1].
Consequently, question about how early diagnosis and detection diseases on first stage can be implemented arises nowadays.030401-2 Algorithm of medical data analysis must be as accurate as it possible and have necessary calculation complexity to be able to give result of diagnosis in short time and with high specificity and sensitivity.Also it should not be too complicated and consume too much resources of calculating machine.Today most of the people have their own calculating machines are known as smartphones, or tablet PCs or smart bracelets or watches.And in the information age all people want to take care of their own health by using their pocket devices [2].But not each of popular gadgets has enough performance to calculate and process millions of numbers, to do it quickly and to give accurate result.
Among the numerous methods of cardiovascular system research, the main place belongs to electrocardiography or ECG [3][4][5].The analysis of ECG-signal can help doctors to make a conclusion about state of patient.In this signal, special attention focused on several peaks, which repeat in certain period and marked with letters P, Q, R, S, T and U [6].Also time of each peak and interval is detected on ECG that allows determining the length of every process in the heart.The simplest to detect is complex that consists of three peaks: Q, R and S. Based on this data, computer can calculate cardiac rhythm of patient [7].Length and form of QRS complex in a different leads of ECG can show presence or absence of anomalies and pathologies that indicate various heart diseases, for example, bundle branch block.[8].Allocation of QRS-complex may be done by several methods that can be applied to different type of signal raw or filtered, e.g., slope vector waveform algorithm, novel approach or discrete wavelet transformation [9][10][11][12].Method that uses in this study based on other R-peak detection method and has some improvements to detect Q and S peaks [13].

QRS detection method
QRS detection starts from algorithm, based on Hilbert transform and band pass filtration.This basic algorithm allows detecting R-peak in ECG signal (see Fig. 1).R peak is a most visible peak throughout ECG signal.Proceeding from its location -Q and S peaks become easy to find.
In used method several steps are performed [13]: -frequency filtering of raw input ECG-signal; -Hilbert transform from filtered signal; -calculating amplitude of analytic signal to get envelope curve; -squaring amplitude of analytic signal to increase high-amplitude components.In this algorithm, for frequency filtration band-pass filter is used.Bandwidth of filter is interval for 8 Hz to 20 Hz.It is caused by empiric research, because in that interval noise from muscles and other electrodes is erased.Then filtered signal is subject to Hilbert Transformation.This step prevents from phase delay and time delay.The point of adaptive algorithm is to in formation of sliding window where algorithm is searching for maximum values that exceed the threshold.Threshold is determined a following formula: where threshold; value of standard deviation of signal amplitude in limits of current sliding window; maximum amplitude of signal in limits of current sliding window.After detection of R peak, it possible to find two minimums from left and right side in certain interval.To define this interval, we must know location of two neighboring R peaks that is called RR-interval.Then left RR interval and right RR interval divided into two subintervals, where necessary minimum is.To the left of the R peak subinterval includes Q peak and to the right of the R peak subinterval includes S peak (see Fig. 2).Also, to decrease computing, it is possible to divide both RR intervals into lesser subintervals.However, it is not such necessary, because quantity of information between two R peaks depends on sampling frequency and often does not exceed this limit.Fig. 2 The result of the algorithm of QRS detection.

Broadening detection method
The first evidence of bundle branch block is broadening of QRS complex in the second standard lead.Bundle of His is a part of electrical conduction system in heart, 030401-3 and when it is blocked by some reason, passing time of electric impulse increases.The normal duration of QRS complex in the second standard lead is 80-120 milliseconds.But when it is blocked, length of complex becomes more then 120 milliseconds.
To define length of QRS complex in the second lead of ECG complex, we need to calculate the average value of QRS complex in ECG signal.Summarize length of each QRS complex and divide it into their amount in signal, we simply get the answer.Duration of each QRS complex is calculated by subtracting time coordinates of S peak and Q peak.Also, amount of QRS complexes is a number of R peaks that has been detected in the previous step.It can be described by following formula: , where  − mean length of QRS-complex in signal;  − amount of QRS-complexes in ECG-signal; (), ()coordinates of S and Q peaks of QRS complex.

Analysis of V1 and V2 leads
However, ECG can be damaged and standard leads may be lost.In this situation, we can check chest ECG leads.First of them are V1 and V2 leads.In case of blocking left or right branch, there are different pieces of evidence that can be found in these leads.

Left branch block
In the case of left branch block, QRS complex has some changes connected with S peak and R peak.In this situation, amplitude of S peak much bigger, then amplitude of R peak that vice versa, lose its height.To detect this pathology, we need to calculate isoline of QRS This line may be found by averaging signal values from the interval between Q peak and left neighboring peak S and S peak and right neighboring peak Q (see Fig. 3).It can be described by following formula: , where  ̅̅̅̅̅̅mean value for QRS-complex;  1amount of counts between Si-1 peak and Qi peak; ()count from interval between Si-1 peak and Qi peak;  2amount of counts between Qi peak and Si+1 peak; ()count from interval between Qi peak and Si+1 peak.
After that, concerning this line, we can calculate amplitude of R and S peaks.The normal amplitude ratio is 4 or more, so R peak must be more than four times higher than S peak.Fig. 3 The isoline and R and S peaks in V1 lead.

Right branch block
In the case of right branch block, form of QRS complex strongly changes.After QRS complex appears additional peak that might be called R1.It has quite similar amplitude with R peak and goes immediately after S peak.QRS complex changes its form to letter "M".
This anomaly can be detected by searching maximum after S peak in 50 millisecond interval (see Fig. 4).Then amplitude of R1 peak might be checked and compared with amplitude of S peak.
Both amplitudes can be calculated by isoline and then be compared.Usually, after S peak goes T peak that has lesser amplitude than amplitude of S peak.Comparison of these two values allows making conclusion about patient's state.

Analysis of V5 and V6 leads
If the first two chest leads are missing, we can use V5 and V6 leads instead.In different type of blocks, there are different pieces of evidence.

Left branch block
QRS complex in V5 and V6 chest leads has the same form and parameters as normal, except one feature.On ascending or descending side of QRS complex we can see a little notch.It can be describe as pair of local minimum and maximum using mathematical terms (see Fig. 5).030401-4 This pathological feature can be found by one of the one dimensional search algorithms.If algorithm has found at least one local minimum or maximum, it will confirm the presence of the disease.

Right branch block
When the patient has right bundle branch block, in chest leads V5 and V6 we can see broadening of all QRS complex and especially broadening of S peak.The normal length of S peak is 20 milliseconds (see Fig. 6).Fig. 6 Broadening of S peak.
To detect this anomaly we should take maximum value in 10 milliseconds to the right of detected S peak and value in 10 milliseconds to the left of S peak.In normal state, S peak has left value bigger than right value.If it is not, it is detected as anomaly.

Result and discussion
Based on the formulated algorithm, we created program modules that implement early described methods.All modules were realized in MATLAB with help of WFDB Toolbox from Massachusetts Institute of Technology.
During all experiments we used 39 samples.Each of them has all 12  From the experimental results (Table 1), we can see that with reducing of amount of input data, accuracy of algorithm expectedly decreases.It is connected with the loss of data, because most of algorithms formulated before are based on calculation of average.However, value of sensitivity and specificity is quite stable.The mean value of sensitivity and specificity is 0,66 and 0,74 with standard deviation 0,057 and 0,019.
At figure 7 you can see how sensitivity and specificity are changing during tests from 100000 counts to 3125.On the fifth experiment algorithm showed abruptly drop in sensitivity (see Fig. 7).It might be connected with loss of information about QRS complexes that had the greatest broadening and had maximum weight in calculation of average.

Conclusions
To summarize all results, it is necessary to notice that this algorithm does not give enough sensitivity and specificity because of its low resource consumption.It is based on information that it can get from parameters of QRS complex, but there are some others pieces of evidence that were not used.
This algorithm may be finalized by following ways: -using properties of other peaks, such as P, T and U; -replacing operations that depends on amount if input data, such us calculation of average; -using more test samples with different sample frequency and large quantity of counts; -using different method of QRS detection; -using not only simple algorithm, such as searching of maximum and minimum.However, this study can show that simplification of detection method cannot give good results even if it is based on easy to understand operation that doctors do every day.
Also, it is necessary to remember that not each of modern gadgets has enough performance to calculate several transformations of signal form different leads in a short time.So this algorithm might be improved by step that described above, but it may cost a lot time of calculation.

Fig. 1
Fig. 1 Result of algorithm's work.Red points are R peaks.

Fig. 4
Fig. 4 Additional peak and its location

Table 1
leads and diagnosis that had been made by specialist.30 signals have sampling frequency 1 KHz and 9 signals have sampling frequency 257 Hz.Sensitivity and specificity of final algorithm.