Depression Analysis using ECG Signal

ECG is a bio-medical signal which records the electrical activity of the heart versus time. They are important for diagnostic and research purposes of the human heart. In this paper we discuss a method of feature extraction which is an inevitable step in most approaches in diagnosing abnormalities in the heart. A web application is developed which extracts features of ECG signal like ST segment, QRS wave, etc. and use these features for identifying whether a person suffers from any of the four levels of stress, that is, Hyper Acute stress (Myocardial Infarction), Acute stress (Type A), Hyper Chronic stress (Ischemia) or Chronic Stress (Type B). The application is built using a decision support system formed by extensive learning of behavior of the signals of various persons.


INTRODUCTION
In today's world, stress is an unavoidable ogre. In every field, stress is related to human work in one way or the other. Signs of stress include being easily irritated by things over which you have no control, such as feeling frustrated or helpless because of not being able to keep up with the pace of life. Scientists consider human brain as the main source of stress. And therefore, brain signal, EEG, is captured in order to detect stress and analyze it. There are two major types of stress, Acute and Chronic. Acute stress is the most common of the types of stress. It comes on quickly and is usually short-lived. It is the most intense stress. Chronic stress is the type of stress that arises out of long-lasting events and circumstances beyond your control. The hardest part of chronic stress is that people just get used to it. Electrocardiogram (ECG) signal can be used in order to detect whether the person is stressed. Electrocardiography is a method used in measuring the electrical activity of the heart. The ECG records the electrical activity that results when the heart muscle cells in the atria and ventricles contract. The standard 12-lead ECG that is used throughout the world was introduced in 1942. It is called a 12-lead ECG because it examines the electrical activity of the heart from 12 points of view [1].
The ECG signal and its important morphological features are shown in Fig. 1. Each feature has significance and depicts the health of heart [2]. Hence, it is important to extract these features very accurately for further analysis. P wave: During normal atrial depolarization, the main electrical vector is directed from the sino-atrial (SA) node towards the atrio-ventricular (AV) node and spreads from the right atrium to the left atrium. This turns into the P wave on the ECG. PR interval: The PR interval starts with the onset of P wave and ends at the onset of Q wave. It represents the duration of the conduction through the ventricles.
QRS complex: The QRS complex corresponds to the period of ventricular contraction or depolarization.
ST Segment: The ST segment represents the duration of the ventricular depolarization and the repolarization.
T wave: The T wave results from the repolarization of the ventricles and is of longer duration than QRS complex because the ventricular repolarization happens more slowly than ventricular depolarization.

Fig 1: Human ECG Signal Over One Cardiac Cycle
The QT interval: The QT interval begins with the onset of Q interval and ends at the endpoint of T wave, representing the duration of ventricular depolarization/ repolarization cycle.
The steps used in the web application for stress analysis using ECG signal are as shown in Fig. 2.
The validity of using ECG and GSR measurements in mental stress monitoring has been demonstrated in both psychophysiology and bio-engineering. HRV analysis based on ECG measurement is commonly used as a quantitative marker describing the activity of the autonomic nervous system during stress. For example, Sloten and others conclude that the mean RR is significantly lower (i.e., the heart rate is higher) with a mental task than in the control condition while pNN50 is significantly higher in the control condition than with a mental task [6]. Salahuddin and others noted that HR and RR-intervals within 10 sec, RMSSD and pNN50 within 30 sec, high frequency band (0.15 to 0.4 Hz) within 40 sec, N o v 1 0 , 2 0 1 3 normalized low frequency band (0.04 to 0.15 Hz), and normalized high frequency band within 50 sec can be reliably used for monitoring mental stress in mobile settings [7].
In the following sections, the paper gives an insight of the workflow of the application.

SIGNAL ACQUISITION
A galvanometer and electrodes with six limb leads and six chest leads are used. It gives a graphic recording of the electric forces generated by the heart during depolarization and repolarization. The electrocardiogram is recorded on graph paper with divisions. Horizontal axis represents time. Large blocks are 0.2 seconds in duration, while small blocks are 0.04 seconds in duration. Vertical axis represents voltage. Large blocks are 5mm, while small blocks represent 1mm. For this web application, ECG signals in .csv format have been used. Data from the MIT-BIH database can be acquired PREPROCESSING Signal pre-processing and filtering can be defined as the manipulation of signal for the purpose of extracting desired information from the acquired signal. The main purpose of signal pre-processing is: ii. To extract information from the acquired signal.
Adaptive filtering techniques are an efficient method of cancelling most interference polluting the ECG signal. An adaptive self-tuning filter can cancel noise to a great extent. This filter uses the least mean square (LMS) algorithm.
A second method is Band pass filtering. It is a combination of high pass and low pass filter. Another technique is using median filter. The advantage of this method is it neatly removes outliers while adding no phase distortions [3]. Stress detection is based on physiological signals and which is suitable for real time applications [4]. Mental stress assessment using heart rate variability. The activity of the autonomic nervous system (ANS) is studied by means of frequency analysis of the Electrocardiogram (ECG) signal. The wavelet decomposition and reconstruction techniques are used for removing noise and to extract some important features of ECG. The spectral features are identified with the application of fuzzy clustering techniques [5].

FEATURE EXTRACTION
The investigation of the ECG has been extensively used for detecting acute or chronic stress. The ECG is a realistic record of the direction and magnitude of the electrical commotion that is generated by depolarization and repolarization of the atria and ventricles. One cardiac cycle in an ECG signal consists of the P-QRS-T waves [8]. The majority of the clinically useful information in the ECG is originated in the intervals and amplitudes defined by its features (characteristic wave peaks and time durations). The improvement of precise and rapid methods for automatic ECG feature extraction is of chief importance, particularly for the examination of long recordings. The ECG feature extraction system provides fundamental features (amplitudes and intervals) to be used in subsequent automatic analysis. In recent times, a number of techniques have been proposed to detect these features [9]. N o v 1 0 , 2 0 1 3 The following method has been used to extract the features: R peak is the highest point in ECG signal. This point [R peak] can be used as a reference to calculate the other features [Q, S, and T] of the signal. After taking input as .csv file of ECG signal we find the highest points i.e. R peaks. Then features Q and S can be found by taking a specific window and obtaining the lowest points in that specific window. For Q feature we consider a window of points before R peak whereas for S feature we consider a window of points after R peak. T feature can be detected as it is the highest point in the signal after S feature. There are different methods for extracting the features of ECG signal using various algorithms.Principal component analysis [10][11] is used when you have obtained measures on a number of observed variables and wish to develop a smaller number of artificial variables (called principal components) that will account for most of the variance in the observed variables. The principal components may then be used as predictor or criterion variables in subsequent analyses. The mathematical technique used in PCA is called Eigen analysis. Kernel principal component analysis is a method of non-linear feature extraction. The non-linearity is introduced via a mapping of the data from the input Space I to a feature space F. Linear principal component analysis is then performed in the feature space; this can be expressed solely in terms of dot products in the feature space. Hence, the non-linear mapping need not be explicitly constructed, but can be specified by defining the form of the dot products in terms of a Mercer Kernel function K on I x I [12].

SIGNAL CLASSIFICATION
Signal classification is just comparing the extracted values with the expert rules. So, the extracted features from the acquired signal are compared with standard rules in order to identify if the person is in stressed mode or controlled mode [13]. Signal classification is done by comparing the extracted values with the expert rules. So, the extracted features from the acquired signal are compared with standard rules in order to identify if the person is in stressed mode or controlled mode. The four different levels of stress considered in this application are as follows:

TECHNOLOGICAL OVERVIEW
The platform on which this system can be implemented is Windows XP and higher versions. The technology which is used to deploy the application is C# and .Net framework. All these re stages performed on mobile platform using object oriented languages which a phone uses.
The C# is a multi-paradigm programming language encompassing the procedural, functional, object oriented [class based] programming disciplines. It was developed by Microsoft within its .Net framework. The language is intended to be simple and modern, general purpose programming language. The language is intended for use in developing software suitable for in distributed development environment.
.NET is a server side web application framework designed for web development to produce dynamic web pages. It was developed by Microsoft. It allows programmers to build dynamic websites, web applications and web services.

RESULT
The input signals are taken from MITBIH database. Snapshots of results of wave detection and classification to indicate the level of stress are shown in the Fig. 3. The application will also provide remedies for the kind of stress the person is suffering from based upon the person's age, weight and medical history. N o v 1 0 , 2 0 1 3

CONCLUSION
The proposed and developed system performs analysis of various ECG signals and evaluates the person's stress level.
The system is developed in such a way so as to handle normal as well as abnormal cardiac conditions. The extracted features are compared with the expert rules which help in determining the risk of stress level of the patient. The person as well as the doctor will be at ease as the device is portable and handy. Future developments of the developed system will transfer the data to the remote PC or remote server. The results of ECG as well as EEG signal of same person can be combined in order to decide the levels of stress. Also different types of depression in a person like Major Depression, Atypical Depression, Psychotic Depression, Dysthymia and Manic Depression can be determined in the future. The system may be applied to different fields for welfare of the community.