Electrocardiogram Chapter 7 Electrocardiogram 7.1. Introduction in ECG: 7.1.1. What is an ECG? It is a graphic produced by an electrocardiogram record the body surface potentials generated by the electrical activity of the heart, this electrical activity can be measured by an array of electrodes placed on the body surface, and it is an important aspect of the clinical evaluation of an individual’s cardiac status and overall health. Its name is made of different parts: electro, because it is related to electronics, cardio, Greek for heart, gram, a Greek roots meaning "to write" . It is used to detect and locate the source of heart problem. An ECG gives two kinds of information: First: Time intervals of the ECG. Second: The amount of electrical activity passing through the heart. 7.1.2 ECG graph paper: Figure 7.1 ECG graph paper. A typical electrocardiograph runs at a paper speed of 25 mm/s, although faster paper speeds are occasionally used. Each small block of ECG paper is 1 mm². At a paper speed of 25 mm/s, one small block of ECG paper translates into 40 ms). Five small blocks make up 1 large block, which translates into 0.20 s (or 200 ms). Hence, 1 Electrocardiogram there are 5 large blocks per second. A diagnostic quality 12 lead ECG is calibrated at 10 mm/mV, so 1 mm translates into 0.1 mV. A "Calibration" signal should be included with every record. A standard signal of 1mV must move the stylus vertically 1 cm, which are two large squares on ECG paper. 7.1.3 What does the ECG record? Three major waves of electric signals appear on the ECG Figure 7.2 ECG Signal 1) The P wave: The P wave is the electrical signature of the current that causes atrial contractions. Both the left and right atrial contract simultaneously. Its relationship to QRS complexes determines the presence of a heart block. Figure 7.3 The formation of P wave 2) The QRS wave: The QRS complex corresponds to the current that causes contraction of the ventricles, which is much more forceful than of the atria. It involves more muscle mass, which results in greater ECG deflection. The duration of the QRS complex is normally less than or equal to 0.1 second. 2 Electrocardiogram Figure 7.4 The formation of QRS wave 3) The T wave: The T wave represents the repolarization of the ventricles. It records the heart's return to the resting state. Figure 7.5 The formation of T wave Doctors study the shape and size of the waves, the time between waves and the rate and regularity of beating. This tells a lot about the heart and its rhythm. The letters "Q", "R" and "S" are used to describe the QRS complex: Q: the first negative deflection after the p-wave. If the first deflection is not negative, the Q is absent. R: the positive deflection S: the negative deflection after the R-wave small print letters (q, r, s) are used to describe deflections of small amplitude. For example: qRS = small q, tall R, deep S. R`: is used to describe a second R-wave (as in a right bundle branch block) Parameter P-R interval Q-T interval P wave QRS wave Duration 0.12-0.20ms 0.30-0.40ms 0.08-0.10ms 0.06-0.10ms Table 7.1 Duration of Waves and intervals in a normal human heart 3 Electrocardiogram 7.1.4. What can you expect during an ECG? An electrocardiogram is obtained by measuring electrical potential between various points of the body. Leads: *The word lead has two meanings in electrocardiography: it refers to either the wire that connects an electrode to the electrocardiograph, or (more commonly) to a combination of electrodes that form an imaginary line in the body along which the electrical signals are measured. Thus, the term loose lead artifact uses the former meaning, while the term 12 lead ECG uses the latter. In fact, a 12 lead electrocardiograph usually only uses 10 wires/electrodes. The latter definition of lead is the one used here. *An electrocardiogram is obtained by measuring electrical potential between various points of the body using a biomedical instrumentation amplifier. A lead records the electrical signals of the heart from a particular combination of recording electrodes which are placed at specific points on the patient's body. *When a depolarization wave front (or mean electrical vector) moves toward a positive electrode, it creates a positive deflection on the ECG in the corresponding lead. * When a depolarization wave front (or mean electrical vector) moves away from a positive electrode, it creates a negative deflection on the ECG in the corresponding lead. * When a depolarization wave front (or mean electrical vector) moves perpendicular to a positive electrode, it creates an equiphasic (or isoelectric) complex on the ECG. It will be positive as the depolarization wave front (or mean electrical vector) approaches (A), and then become negative as it passes by (B). Figure 7.6 Effect of electrode movement in the ECG signal. Limb: Leads I, II and III are the so-called limb leads because at one time, the subjects of electrocardiography had to literally place their arms and legs in buckets of salt water in order to obtain signals for Einthoven’s string galvanometer. They form the basis of what is known as Einthoven's triangle. Eventually, electrodes were invented that could be placed directly on the patient's skin. Even though the buckets of salt water are no longer necessary, the electrodes are still placed on the patient's arms and legs to approximate the signals obtained with the buckets of salt water. They remain the first three leads of the modern 12 lead ECG. * Lead I is a dipole with the negative (white) electrode on the right arm and the positive (black) electrode on the left arm. * Lead II is a dipole with the negative (white) electrode on the right arm and the positive (red) electrode on the left leg. 4 Electrocardiogram * Lead III is a dipole with the negative (black) electrode on the left arm and the positive (red) electrode on the left leg. Figure 7.7 Proper placement of the limb leads. Augmented limb: Leads AVR, AVL, and AVF are augmented limb leads. They are derived from the same three electrodes as leads I, II, and III. However, they view the heart from different angles (or vectors) because the negative electrode for these leads is a modification of Wilson's central terminal, which is derived by adding leads I, II, and III together and plugging them into the negative terminal of the EKG machine. This zeroes out the negative electrode and allows the positive electrode to become the "exploring electrode" or a unipolar lead. This is possible because Einthoven's Law states that I + (-II) + III = 0. The equation can also be written I + III = II. It is written this way (instead of I +II + III = 0) because Einthoven reversed the polarity of lead II in Einthoven's triangle, possibly because he liked to view upright QRS complexes. Wilson's central terminal paved the way for the development of the augmented limb leads AVR, AVL, AVF and the pericardial leads V1, V2, V3, V4, V5, and V6. * Lead AVR or "augmented vector right" has the positive electrode (white) on the right arm. The negative electrode is a combination of the left arm (black) electrode and the left leg (red) electrode, which "augments" the signal strength of the positive electrode on the right arm. * Lead AVL or "augmented vector left" has the positive (black) electrode on the left arm. The negative electrode is a combination of the right arm (white) electrode and the left leg (red) electrode, which "augments" the signal strength of the positive electrode on the left arm. * Lead AVF or "augmented vector foot" has the positive (red) electrode on the left leg. The negative electrode is a combination of the right arm (white) electrode and the left arm (black) electrode, which "augments" the signal of the positive electrode on the left leg. 5 Electrocardiogram The augmented limb leads AVR, AVL, and AVF are amplified in this way because the signal is too small to be useful when the negative electrode is Wilson's central terminal. Together with leads I, II, and III, augmented limb leads AVR, AVL, and AVF form the basis of the hex axial reference system, which is used to calculate the heart's electrical axis in the frontal plane. Figure 7.8 Proper placement of the augmented limb. Pericardial: The precordial leads V1, V2, V3, V4, V5, and V6 are placed directly on the chest. Because of their close proximity to the heart, they do not require augmentation. Wilson's central terminal is used for the negative electrode, and these leads are considered to be unipolar. The precordial leads view the heart's electrical activity in the so-called horizontal plane. The heart's electrical axis in the horizontal plane is referred to as the Z axis.Leads V1, V2, and V3 are referred to as the right precordial leads and V4, V5, and V6 are referred to as the left precordial leads. The QRS complex should be negative in lead V1 and positive in lead V6. The QRS complex should show a gradual transition from negative to positive between leads V2 and V4. The equiphasic lead is referred to as the transition lead. When the transition occurs earlier than lead V3, it is referred to as an early transition. When it occurs later than lead V3, it is referred to as a late transition. There should also be a gradual increase in the amplitude of the R wave between leads V1 and V4. This is known as R wave progression. Poor R wave progression is a nonspecific finding. It can be caused by conduction abnormalities, myocardial infarction, cardiomyopathy, and other pathological conditions. Lead V1 is placed in the fourth intercostals space to the right of the sternum. Lead V2 is placed in the fourth intercostals space to the left of the sternum. Lead V3 is placed directly between leads V2 and V4. Lead V4 is placed in the fifth intercostals space in the midclavicular line (even if the apex beat is displaced). Lead V5 is placed horizontally with V4 in the anterior axillary line Lead V6 is placed horizontally with V4 and V5 in the mid axillaries Line 6 Electrocardiogram Figure 7.9 proper placements of the pericardial leads Ground: An additional electrode (usually green) is present in modern four-lead and twelve-lead ECGs. This is the ground lead and is placed on the right leg by convention, although in theory it can be placed anywhere on the body. With a three-lead ECG, when one dipole is viewed, the remaining lead becomes the ground lead by default. Standard Leads Bipolar Lead Lead I Lead II Lead III LimbLeads Unipolar Leads AVR AVL AVF Table 7.2 ECG leads system 7 Chest Leads Unipolar Leads V1 V2 V3 V4 V5 V6 Electrocardiogram 7.2. Noise in ECG Signal In recent years the trend towards automated analysis of electrocardiograms has gained momentum. Many systems have been implemented in order to perform such tasks as 12lead offline electrocardiogram analysis, Holter tape analysis in real-time patient monitoring. This requires accurate detection of various parameters of interest even in the presence of noise. For accurate detection however steps have to be taken to filter out or discard the noise. Filtering can alter the signal and may require substantial computational overhead. The goal of denoising is to remove the noise while retaining as much as possible the important signal features. Traditionally, this is achieved by linear processing. Most of these methods are very useful and efficient in denoising of narrowband noise where spectral of signal and noise is not conflicting. Electrocardiographic signals (ECG) may be corrupted by various kinds of noise. Typical examples are: 1. Power line interference 2. Electrode contact noise. 3. Motion artifacts. 4. Muscle contraction. 5. Base line drift. 6. Instrumentation noise generated by electronic devices. 7. Electrosurgical noise. 7.2.1. Power line interference: It consists of 50-60Hz pickup and harmonics, which can be modeled as sinusoids. Characteristics, which might need to be varied in a model of power line noise, of 60Hz component (as most of the signals of study were digitized in USA) include the amplitude and frequency content of the signal. The amplitude varies up to 50 percent of the peak to peak ECG amplitude. It is shown in the figure where power signal is effecting the signal between 1000 to 3000 units of time.2 Figure 7.10 Power line interference 8 Electrocardiogram 7.2.2 Electrode contact noise It is a transient interference caused by loss of contact between the electrode and the skin that effectively disconnects the measurement system from the subject. The loss of contact can be permanent, or can be intermittent as would be the case when a loose electrode is brought in and out of contact with the skin as a result of movements and vibration. This switching action at the measurement system input can result in large artifacts since the ECG signal is usually capacitive couple to the system. It can be modeled as randomly occurring rapid base line transition, which decays exponentially to the base line value and has a superimposed 60Hz component. Typically the values of amplitude may vary to the maximum recorder output. 7.2.3 Motion Artifacts: Motion artifacts are transient base line changes caused by changes in the electrode skin impedance with electrode motion. As this impedance changes, the ECG amplifier sees a different source impedance which forms a voltage divider with the amplifier input impedance therefore the amplifier input voltage depends upon the source impedance which changes as the electrode position changes. The usual cause of motion artifacts will be assumed to be vibrations or movements of the subjects. The peak amplitude and duration of the artifact are variable, as illustrated in the figure this type of interference represents an abrupt shift in base line due to movement of the patient while the ECG is being recorded. It is simulated by adding a dc bias for a given segment of ECG. Figure 7.11 Motion Artifacts 7.2.4 Muscle contraction: Muscle contractions cause artifactual millivolt level potentials to be generated. The base line electromyogram is usually in the microvolt range and therefore is usually insignificant. It is simulated by adding random noise to the ECG signal. The maximum noise level is formed by adding random single precision numbers of 50% of the ECG maximum amplitude to the uncorrupted ECG. A plot of the ECG corrupted by electromyographic noise is given in the Figure. 9 Electrocardiogram Figure 7.12 Muscle contraction 7.2.5 Base Line Drift with Respiration: The drift of the base line with respiration can be represented by a sinusoidal component at the frequency of respiration added to the ECG signal. The amplitude and the frequency of the sinusoidal component should be variables. The variations could be reproduced by amplitude modulation of the ECG by the sinusoidal component added to the base line. Shown the Figure Figure 7.13 Base Line Drift with Respiration 7.2.6 Noise generated by electronic devices: The parameter detection algorithms cannot correct artifacts generated by electronic devices. The input amplifier saturates and no information about the ECG reaches the detector. In this case manual preventive and corrective action needs to be undertaken. 7.2.7 Electrosurgical noise: It completely destroys the ECG and can be represented by a large amplitude sinusoid with frequencies approximately between 100kHz to 1MHz. Since the sampling rate of an ECG signals 250 to 1000Hz an aliased version of the signal. 10 Electrocardiogram 7.3. Filtering in ECG: Signal processing, in general, has a rich history, and its importance is evident in such a diverse fields as biomedical engineering, acoustics, Sonar, radar, Seismology, speech communication, data communication, nuclear science, and many others. In many applications, as, for example, in EEG and ECG analysis or in systems foe speech transmission and speech recognition it can be used to extract some characteristic parameters. Alternatively, for to remove interference, such as noise, from the signal or to modify the signal to present it in a form which is more easily interpreted by an expert. Recent trends in the processing of the biomedical signals have been towards quantitative or the objective analysis of physiological systems and phenomena via signal analysis. The field of biomedical signal analysis or processing has advanced to the stage of practical application of signal processing and pattern analysis techniques foe efficient and improved noninvasive diagnosis, online monitoring of critical ill patients, and rehabilitation and sensory aids for the handicapped. Techniques developed by engineers are gaining wider acceptance by practicing clinicians, and the role of engineering in diagnosis and treatment is gaining much–observed respect. The filters have a very important function in ECG which removes unwanted parts of the signal extract useful parts of the signal Figure 7.14 Function of the filters 7.3.1 How select type of filter? To know type of filter must be use must be know the characteristics of signal that we want filtered it, Characteristics like frequency & amplitude and another characteristic. Example If we want filter noise at 0.1 HZ This noise low freq and cut off freq at 0.1 so we use low freq filter (HPF) If we want filter noise at 50 /60HZ This noise high freq filter and cut off freq at 50 so we use high freq filter (LPF) 11 Electrocardiogram 7.3.2 Types of filters. In signal processing, the function of a filter is to remove unwanted parts of the signal, such as random noise, or to extract useful parts of the signal, such as the components lying within a certain frequency range. there are two main kinds of filter, analog and digital. they are quite different in their physical makeup and in how they work. Analog filter : An analog filter uses analog electronic circuits made up from components such as resistors, capacitors and opamps to produce the required filtering effect. Such filter circuits are widely used in such applications as noise reduction, video signal enhancement, graphic equalizers in hi-fi systems, and many other areas. There are well-established standard techniques for designing an analog filter circuit for a given requirement. At all stages, the signal being filtered is an electrical voltage or current which is the direct analogue of the physical quantity (e.g. a sound or video signal or transducer output) involved. Advantages: Simple and consolidated methodologies of plan. Fast and simple realization. Disadvantages: Little stable and sensitive to temperature variations. Expensive to realize in large amounts. Digital filter A digital filter uses a digital processor to perform numerical calculations on sampled values of the signal. the processor may be a general-purpose computer such as a PC, or a specialized DSP (Digital Signal Processor)chip. The analog input signal must first be sampled and digitized using an ADC (analog to digital converter). The resulting binary numbers, representing successive sampled values of the input signal, are transferred to the processor, which carries out numerical calculations on them. These calculations typically involve multiplying the input values by constants and adding the products together. If necessary, the results of these calculations,which now represent sampled values of the filtered signal, are output through a DAC (digital to analog converter) to convert the signal back to analog form. Note that in a digital filter, the signal is represented by a sequence of numbers, rather than a voltage or current. Figure 7.15 Basic setup of System 12 Electrocardiogram Operation of digital filters: In this section, we will develop the basic theory of the operation of digital filters. This is essential to an understanding of how digital filters are designed and used. Suppose the "raw" signal which is to be digitally filtered is in the form of a voltage waveform described by the function V = x(t) where t is time. This signal is sampled at time intervals h (the sampling interval). The sampled value at time t = i h is xi= x( ih) Thus the digital values transferred from the ADC to the processor can be represented by the sequence x , x , x , x , ... 0 1 2 3 corresponding to the values of the signal waveform at t = 0, h, 2h, 3h, ... and t = 0 is the instant at which sampling begins. At time t = nh (where n is some positive integer), the values available to the processor, stored in memory, are x , x , x , x , ... x 0 1 2 3 n Note that the sampled values xn+1, xn+2 etc. are not available, as they haven't happened yet! The digital output from the processor to the DAC consists of the sequence of values y , y , y , y , ... y 0 1 2 3 n In general, the value of yn is calculated from the values x0, x1, x2, x3, ... , xn. The way in which the y's are calculated from the x's determines the filtering action of the digital filter The following list gives some of the main advantages of digital over analog filters: A digital filter is programmable, i.e. its operation is determined by a program stored in the processor's memory .This means the digital filter can easily be changed without affecting the circuitry (hardware).An analog filter can only be changed by redesigning the filter circuit. Digital filters are easily designed, tested and implemented on a general-purpose computer or workstation. The characteristics of analog filter circuits (particularly those containing active components) are subject to drift and are dependent on temperature. Digital filters do not suffer from these problems,and so are extremely stable with respect both to time and temperature. Unlike their analog counterparts, digital filters can handle low frequency signals accurately. As the speed of DSP technology continues to increase, digital filters are being applied to high frequency signals in the RF (radio frequency) domain, which in the past was the exclusive preserve of analog technology. Digital filters are very much more versatile in their ability to process signals in a variety of ways; this includes the ability of some types of digital filter to adapt to changes in the characteristics of the signal. Fast DSP processors can handle complex combinations of filters in parallel or cascade (series), making the hardware requirements relatively simple and compact in comparison with the equivalent analog circuitry Due to advantages of digital filter so will use it to remove noises and there are many types of digital filters will be know which any one proper in our case : 13 Electrocardiogram Finite impulsive response (FIR): FIR filters usually require no feedback (non-recursive). Advantages (1) may be realised by non-recursive structures which are simpler and more convenient for programming especially on devices specifically designed for DSP. (2) FIR structures are always stable. (3) Because there is no recursion, round-off and overflow errors are easily controlled. (4) An FIR filter can be exactly linear phase. Disadvantage (1) Large number of filter (2) Expensive (3) There are delay. Infinite impulsive response (IIR): The Infinite Impulse Response (IIR) filter has the impulse response of infinite duration. The general difference equation for an IIR digital: Where ak is the k-th feedback tap depending on previous outputs. If ak=0 then the filter is a FIR. N is the number of feedback taps in the IIR filter & M is the number of feed forward taps. Note that, unlike the FIR filter, the output of an IIR filter depends on both the previous M inputs and the previous N outputs. This feedback mechanism is inherent in any IIR structure. It is responsible for the infinite duration of the impulse response. There are many standard for IIR filter as shown in the following figure Low pass filter high pass filter 14 Electrocardiogram band pass filter stop band filter Figure 7.16 Standards of IIR Transfer function of digital IIR filter p p1 z 1 p2 z 2 pM z M H ( z) 0 d 0 d1 z 1 d 2 z 2 d N z N H(z) must be a stable function, N must be of lowest order. To design IIR filter must be this approach Design analog lowpass filter Apply Freq. band transformation s-->s Apply filter transformation s-->z Desired IIR filter Figure 7.17 Desired IIR filter Convert the digital filter specifications into analog low pass prototype filter specifications Determine the analog low pass filter transfer function to meet these specifications Then transform it into the desired digital filter transfer function and we used this approach for the following reasons: Analog approximation techniques are highly advanced Usually yield closed-form solutions Extensive tables are available for analog filter design. Many applications require the digital simulation of analog filters. Figure 7.18 The magnitude response 15 Electrocardiogram Equations: In pass band 1 p G ( e j ) 1 p , G ( e j ) s , In stop band for p for s Where δp and δs are peak ripple values, ωp are pass band edge frequency and ωs are stop band edge frequency The pass band and stop band edge frequencies, in most applications are specified in Hz p s p FT 2Fp FT 2FpT s 2Fs 2FsT FT FT Where FT denote the sampling frequency in Hz, Fp and Fs denote, respectively, the pass band and stop band edge frequencies in Hz Discrimination parameter: d 1 2 p 2 s 1 1 or A2 1 Number of filter: 1 1 p [(1 p ) 2 1] 2 N c s [( s ) 2 1] 2 N Types of IIR filter Chebyshev Butterworth Elliptic Butterworth filter: This filter is characterized by the property that its magnitude response is flat in both passband and stop band. Magnitude response The order of filter H a ( j ) 2 N 1 1 c 2N p with c 16 1 log10 A2 1 2 log10 d 2 log10 s p log10 k N Electrocardiogram 1.2 1 N=100 N=2 0.8 N=1 N=200 0.6 0.4 0.2 0 0 10 20 30 40 50 60 70 80 90 100 Figure 7.19 Effect the # of order on magnitude response Advantages for IIR filter: Economical in use of delays, multipliers and adders So IIR filters are useful for high-speed designs because they typically require a lower number of multiplies compared to FIR filters. IIR filters can be designed to have a frequency response that isdiscrete version of the frequency response of an analog filter 7.3.3 Application The application on IIR(BUTTERWORTH FILTER) Use to remove Power line interference from ECG signal By using lowpass butterworth filter and Baseline wander from ECG signal By using highpass butterworth filter Figure 7.19 Power line interference Figure7.20 Baseline drift 17 Electrocardiogram In lab Figure 7.21 Measurment of three channel Measure three channel channel_1(lead I) the amp = .95mv channel_2(lead II) the amp =1.09mv channel _3(lead III) the amp =1mv Choose the greatest channel and apply filtering on it (lead II) 18 Electrocardiogram Figure 7.22 The flow chart of first code 19 Electrocardiogram Figure 7.23 Flow chart of second code 20 Electrocardiogram Results Step 1: Load data of three channel and display F i g Figure 7.24 Channel 2 has the largest amplitude 21 Electrocardiogram Step 2: Calculate the average of three channel and calculate the noisy signal Figure 7.25 Noisy signal and its FFT 22 Electrocardiogram Step 3: Zoom to discover the noisy. Figure 7.26 Zooming of Noisy signal and its FFT 23 Electrocardiogram Step 4 : Remove the noise at 50 HZ Figure 7.27 ECG signal without 50 HZ component and its FFT 24 Electrocardiogram Step 5: Zoom version to see ECG without 50 HZ. Figure 7.28 FFT of zooming ECG signal without 50HZ component 25 Electrocardiogram Step 6: Remove 0.5HZ using Butterworth highpass filter cut off .5 hz Figure 7.29 ECG signal without 0.5HZ component and it’s FFT 26 Electrocardiogram 7.4. ECG diagnosis: Usually, doctors can tell whether a person has a heart or blood vessel disorder on the basis of the medical history and the physical examination. Diagnostic procedures are used to confirm the diagnosis, determine the extent and severity of the disease, and help in planning treatment. Medical History and Physical Examination. A doctor first asks about symptoms. Chest pain, shortness of breath, palpitations, and swelling in the legs, ankles, and feet or abdomen suggest a heart disorder. Other, more general symptoms, such as fever, weakness, fatigue, lack of appetite, and a general feeling of illness or discomfort (malaise), may suggest a heart disorder. Pain, numbness, or muscle cramps in a leg may suggest peripheral arterial disease, which affects the arteries of the arms, legs, and trunk (except those supplying the heart). Next, the doctor asks about past infections; previous exposure to chemicals; use of drugs, alcohol, and tobacco; home and work environments; and recreational activity. The doctor also asks whether family members have had a heart disorder or any other disorders that may affect the heart or blood vessels. During the physical examination, the doctor notes the person's weight and overall appearance and looks for paleness (pallor), sweating, or drowsiness, which may be subtle indicators of heart disorders. The person's general mood and feeling of well-being, which also may be affected by heart disorders, are noted. Assessing skin color is important because pallor or a bluish or purplish coloration (cyanosis) may indicate anemia or inadequate blood flow. These findings may indicate that the skin is not receiving enough oxygen from the blood because of a lung disorder, heart failure, or various circulatory problems. The doctor feels the pulse in arteries in the neck, beneath the arms, at the elbows and wrists, in the abdomen, in the groin, at the knees, and in the ankles and feet to assess whether blood flow is adequate and equal on both sides of the body. The blood pressure and body temperature are also checked. An abnormality may suggest a heart or blood vessel disorder. The doctor inspects the veins in the neck while the person is lying down with the upper part of the body elevated at a 45° angle. These veins are inspected because they are directly connected to the right atrium (the upper chamber of the heart that receives oxygen-depleted blood from the body) and thus give an indication of the volume and pressure of blood entering the right side of the heart. The doctor presses the skin over the ankles and legs and sometimes over the lower back to check for fluid accumulation (edema) in the tissues beneath the skin. 27 Electrocardiogram 7.4.1 The 10 rules of normal heart beat: Rule 1 PR interval should be 120 to 200 milliseconds or 3 to 5 little squares. Figure 7. 30 (a) Rule 2 The width of the QRS complex should not exceed 110 ms, less than 3 little squares. Figure 7. 30 (b) 28 Electrocardiogram Rule 3 The QRS complex should be dominantly upright in leads I and II. Figure 7. 30 (c) Rule 4 QRS and T waves tend to have the same general direction in the limb leads. Figure 7. 30 (d) 29 Electrocardiogram Rule 5 All waves are negative in lead aVR . Figure 7. 30 (e) Rule 6 The R wave in the precordial leads must grow from V1 to at least. Figure 7. 30 (f) 30 Electrocardiogram Rule 7 The ST segment should start isoelectric except in V1 and V2 where it may be elevated. Figure 7. 30 (g) Rule 8 The P waves should be upright in I, II, and V2 to V6. Figure 7. 30 (h) 31 Electrocardiogram Rule 9 There should be no Q wave or only a small q less than 0.04 seconds in width in I, II, V2 to V6. Figure 7. 30 (i) Rule 10 The T wave must be upright in I, II, V2 to V6. Figure 7. 30 (j) Figure 7. 30 (a)-(j) Rules of normal heart 32 Electrocardiogram 7.4.2 The abnormal cases heart beats: Myocardial Infarction (Heart Attack): Myocardial infarction (MI) means that part of the heart muscle suddenly loses its blood supply. Without prompt treatment, this can lead to damage to the affected part of the heart. An MI is sometimes called a heart attack or a coronary thrombosis. An MI is part of a range or disorders called 'acute coronary syndromes'. There is a brief explanation of the term 'acute coronary syndrome' at the end of this leaflet. Characteristic changes in AMI ST segment elevation over area of damage. ST depression in leads opposite infarction. Pathological Q waves. Reduced R waves. Inverted T waves. Figure 7. 31 Sequence of changes in AM Accelerated Junctional Rhyth Atrial Fibrillation With Moderate Ventricular Response Atrial Flutter With Variable AV Block Atrial Flutter With Variable AV Block Electronic Atrial Pacing Sinus Bradycardia with 2:1 AV Block Electronic Ventricular Pacemaker Rhythm 33 Electrocardiogram Normal Sinus Rhythm Pacemaker Failure to Pace Pacemaker Failure To Sense Pacemaker Fusion Beat Rate-Dependant LBBB right bundle branch block First Degree block Second degree block Third degree block Ventricular Pacing in Atrial Fibrillation WPW and Pseudo-inferior MI WPW Type Preexcitation. ------------------------------ 34 Electrocardiogram Our Design In our project we detect different heart diseases by using the following 20 abnormal ECG image. Figure 6.32 Atrial Fibrillation With Moderate Ventricular Response Figure 6.33 Atrial Flutter With Variable AV Block Figure 34 Atrial Flutter With Variable AV Block 35 Electrocardiogram Figure 6.35 Sinus Bradycardia with 2:1 AV Block Figure 6.36 Electronic Ventricular Pacemaker Rhythm Figure 6.37 First Degree block copy Figure 6.38 Electronic Atrial Pacing 36 Electrocardiogram Figure 6.39 Normal Sinus Rhythm Figure 6.40 Pacemaker Failure to Pace Figure 6.41 Pacemaker Failure To Sense Figure 6.42 Pacemaker Fusion Beat 37 Electrocardiogram Figure 6.43 right bundle branch block Figure 6.44 second degree block Figure 6.45 third degree block Figure 6.46 Ventricular Pacing in Atrial Fibrillation 38 Electrocardiogram Figure 6.47 WPW and Pseudo-inferior MI Figure 6.48 WPW Type Preexcitation Figure 6.49 Accelerated Junctional Rhythm 39 Electrocardiogram Using the following design of ANN Figure 6.50 Our design ANN The ANN is consist of 5 input layer , 5 hidden layer and only one output and we will use 4 ANN to detect 20 different heart diseases as shown later. 40 Electrocardiogram Sequence of operations Identification Training 1-Training: Figure 6.51 Flowchart of training program 41 Electrocardiogram 1- Initiate and construct the Artificial Neural Networks which have many parameters: Number of hidden layers. Number of Neurons. Acceptable sum squared error (error goal). Activation functions. Maximum number of epochs. Weight. Bias. Output layer. 2- Starting training of ANN with the specified parameters to get the optimum values of weight and bias of the network. Illustration of some points in the program: *The operation of neural networks is Non-linear, that is due to the activation functions used. *Histogram is a vector of gray scale levels, length=2n where n=intensity. Figure 6.52 Histogram example *Mean-variance is a vector of Mean-variance of each column of image matrix, the length of the vector is the number of columns. *Edge is the abrupt change of intensity. *The hidden layer, the output layer, activation functions and number of neurons all are constant. 42 Electrocardiogram *Only the input is variable. *When the sum squared error decreases, the learning rate increases And here, the neural network knows whether the direction of training network is the right direction or not. Result 1st network: 2nd network 43 Electrocardiogram 3rd network 4th network *Target error is 0.0001. *Learning cycle (Epoch) for reaching this target error: 1st network 154 Epoch. 2nd network 162 Epoch. 3rd network 178 Epoch. 4rd network 174 Epoch. 44 Electrocardiogram Recalling: By entering the simulated case we get the image of heart disease and the name of disease hence, we get the required objective of software. Figure 6.53 Flowchart of Recalling program 45 Electrocardiogram Result 46 Electrocardiogram ------------------------------------------------- 47