[lecture notes in electrical engineering] recent advances in computer science and information...

6

Click here to load reader

Upload: huamin

Post on 14-Dec-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: [Lecture Notes in Electrical Engineering] Recent Advances in Computer Science and Information Engineering Volume 125 || An ECG Signal Processing System Based on MATLAB and MIT-BIH

An ECG Signal Processing System Basedon MATLAB and MIT-BIH

Tao Lin and Shuang Tian

Abstract. Massachusetts Institute of Technology created MIT-BIH ArrhythmiaDatabase in 1980. In this database, the ECG signal is stored and transported in MIT-BIT format, which has been an important universal format standard. The databasecontains abundant typical cases with detailed annotations, thus enjoys internationalimpact. To save storages space, MIT-BIH database adopt a specific-defined format,storing each ECG signal data in a sealed file respectively, therefore unable to con-duct large scale based on content. In order to query the MIT-BIH ECG data andimages, this paper mainly concerns this problem. We propose to use MATLAB toread MIT-BIH ECG signals, then store them in SQL database, again, apply the MAT-LAB software to access the information stored in the SQL . providing a novel andconvenient method for other software to access, use and revise the MIT-BIT ECGsignal. The proposed method can ensure the convenient communication and alsofacilitate the task of data mining for the ECG signals.

1 Introduction

Electrocardiography (ECG) is a kind of transthoracic data recording the electricalactivity of the heart, which is detected by electrodes attached on the skin. ECG isan objective measurement for the activation, transportation and recovery of heartactivities.[1] Since ECG demonstrates the activity of heart, it is a very importantreference to diagnose cardiovascular diseases.

MIT-BIH Arrhythmia Database, recently created by Massachusetts Institute ofTechnology, is widely used to study Arrhythmia. Due to the representative casesand abundant annotations, MIT-BIH database has become the benchmark database

Tao Lin · Shuang TianHebei University of Technology, Tianjine-mail: [email protected],[email protected]

Z. Qian et al. (Eds.): Recent Advances in CSIE 2011, LNEE 125, pp. 787–792.springerlink.com c© Springer-Verlag Berlin Heidelberg 2012

Page 2: [Lecture Notes in Electrical Engineering] Recent Advances in Computer Science and Information Engineering Volume 125 || An ECG Signal Processing System Based on MATLAB and MIT-BIH

788 T. Lin and S. Tian

in the research community.[2] Currently, how to make use of the ECG signals is avery critical issue for the diagnosis and medical information. The aim of this paper isto read and store MIT-BIH format ECG signals to facilitate the further informationprocessing and transformation.

2 Read and Store the Header File of MIT-BIH ECG Signals

Each MIT-BIH format signals are comprised of several files instead of a single file,including a header file (extension format: .hea), a data file (extension format: .dat)and several annotation files (.atr).[3, 4] The header file and the data file are twobasic files to store the signal data. We will discuss these two files in detail in thefollowing. In this chapter, we will discuss how to read data from these two filesusing MATLAB.

There has been much research work on how to build ECG database. In the pa-per, Establishment of 12 - lead Synchronous ECG Database Based on Virtual In-strumentone novel method is proposed.[5] Some researchers have focused on build-ing ECG databases using MIT-BIH database. Qiong Wang and Zhengguo Zhangtranslate the MIT-BIH format to a new format of ECG data which is consistent withHL7-aECG standard, which can be used for retrieve. However, their work ignoreshow to display ECG data.[6]

2.1 Header File

Each header file in MIT-BIH is composed of one or multiple row of ASCII charac-ters, the maximum number of characters are 255. The first row contains four fieldsfor some basic information as overall description for an EEG data. The followingrows are the presentation of leads information and the annotations for the patient.[7]

The following example is 100.hea:

100 2 360 650000

Four fields starting from left side are file name, lead number, sample frequency andthe number of sampling points.

100. dat 212 200 11 1024 995-22131 0 MLII

From left to right are file name, storage format, gain, AD resolution, ADC zerovalue, the first sample value, verification number, block size and the number oflead.;

100.dat 212 200 11 1024 1011 20052 0 V5

The format is the same as the above row.

Page 3: [Lecture Notes in Electrical Engineering] Recent Advances in Computer Science and Information Engineering Volume 125 || An ECG Signal Processing System Based on MATLAB and MIT-BIH

An ECG Signal Processing System Based on MATLAB and MIT-BIH 789

# 69 M 1085 1629 x1# AldometInderal

Rows starting with ”#” are comments for some basic information of the patient suchas age, gender and previous prescription.

2.2 Reading and Saving Header Files

In the previous chapter, we have analyzed the data structure of header files. In thischapter we will discuss how to save the header file into SQL.

In database, table is the main storage form for various kind of information. Firstwe define a table named HEADFILE. Then we can import the data into this table.The implementation of this step is easy. We use fget1 function here. This function isused to process pure text file usually, how-ever, it is also appropriate for the headerfile of MIT-BIH. Then we store the data into a matrix.Then we correspond eachelement with a single field in the database for storing.

nextcombining matrix values with the Field of SQLis suitable for storage.Each field, from left to right, are:’filename’, ’num’, ’freq’, ’nsamp’, ’dformat’,

’gain’, ’bitres’, ’zerovalue’, ’firstvalue’, ’chec’, ’ofsize’, ’lead’, ’age’ and ’sex’, rep-resenting file name, the numbers of lead, sampling frequency, number of samplingpoints, file format, gain, resolution, ADC zero value, the first value of the lead,verification number, block size, lead number, age and gender respectively. After im-porting the header files of the whole MIT-BIH dataset into the database, it is easierand faster to store, update and manipulate data.

After importing data into ”HEADFILE” table SQL database using MATLAB, wehave following table as shown in fig 1.

Fig. 1 Part of the screenshot of table HEADFILE in SQL

Page 4: [Lecture Notes in Electrical Engineering] Recent Advances in Computer Science and Information Engineering Volume 125 || An ECG Signal Processing System Based on MATLAB and MIT-BIH

790 T. Lin and S. Tian

3 Reading and Saving the MIT-BIH EEG File

Introduction: data file is also called waveform file. In MIT-BIH dataset, there are8 types including Format8, Format16, Format80, Format212, Format310 and so on.In this paper, we mainly discuss Format212 data format. Acutely, in each header fileof MIT-BIH EEG file, there are detail descriptions for this data. Please refer to lastchapter.

3.1 Data File

MIT-BIH ECG database is a kind of arrhythmia database”212” format stores twodatasets each three bytes.

Take 100.dat as example. According to ’212’ format, read 3 bytes first”E3 33F3”then the two values are: 0x3E3 and 0x3F3, after translating to decimal, 995 and1011. These two values are the first sample point of the two signals, multiplying hiscorresponding gain; the amplitudes are 4.975mv and 5.055m. The remaining dataare saved in the same format.[8]

3.2 Saving and Reading Data File

We can read sample points using unit8 format and store into matrix M with SAM-PLE rows and 3 columns. Each column is one byte. Each row use 3 bytes to repre-sent two numbers m1 and m2. Each number has 12bits This is so called 212 format.The lower 8 digit of m1 are saved in M(:,1) while the lower 8 digit of m2 saving inM(:,2), the higher 4 digits of m1 saved in M(:,1) and the higher 4 digits of m2 savedin M(:,2).

We can extract decimal dual channel signal data using a serial of procedure likedisplacement and AND. Then they can be transformed into EEG signal value whichcan be used in practical. According to the values of ECG Signals we can calculatetrue value, also we can use these EEG data to calculate the real EEG data and drawthe waveform, as shown in figure 2.

The image can be viewed as the ensemble of many coordinates. The horizontalaxis is time and the vertical axis is the voltage value of EEG signal. In this way wecan transform the image file into coordinates of points. First we define some timepoints saving in matrix T. Then we save the corresponding image file into matrix M.After importing matrix M and time matrix T into database, the EEG image is savedinto the SQL. Figure 3 shows the table called DATAFILE after imported into SQL.

As we know, SQL don’t require users to use any specific storing methods fordata. The system will determine the fastest method for a particular type of data. ithas excellent transportability universal property ,and it’s easy to carry out relationaldata manipulation with the help of data inquiry function. So we can use C, C++and C# to access to the EEG data. What’s more, we can access to the database in

Page 5: [Lecture Notes in Electrical Engineering] Recent Advances in Computer Science and Information Engineering Volume 125 || An ECG Signal Processing System Based on MATLAB and MIT-BIH

An ECG Signal Processing System Based on MATLAB and MIT-BIH 791

Fig. 2 The image display ofthe data file in MATLAB

Fig. 3 the coordinates of the data file after importing into SQL

different OS. So we can access to the database as indirect access, which make theaccess easier. And the data files are easier to access. Based on this, we can conductfurther research for EEG signal, which is meaningful for medical development.

3.3 Read EEG Data from SQL Using MATLAB

We can use different tools to read the EEG information we have stored in thedatabase for other processing. Then we will use MATLAB as an example, to readthe EEG data from SQL.

According to M1, M2 and T from database, we get figure 4 and figure 5. Figure4 is the waveform of MLlead while Figure 5 is the waveform of V5 lead.

From the experiment results, we can still do various processing after importingdata into SQL. Although we have only used MATLAB to process data in this paper,we can choose proper tools to access to SQL according to the practical requirementsand situations.

Page 6: [Lecture Notes in Electrical Engineering] Recent Advances in Computer Science and Information Engineering Volume 125 || An ECG Signal Processing System Based on MATLAB and MIT-BIH

792 T. Lin and S. Tian

Fig. 4 The ECG of leadML2

Fig. 5 The ECG of lead V5

4 Conclusions

Utilizing Matlab to read MIT-BIH Arrhythmia dataset indirectly, we have reducedthe work for accessing to the data, which make it easier to process data. EEG re-searchers can process MIT-BIH data flexibly or conduct further development.

References

1. http://baike.baidu.com/view/20611.html2. Geddes, K.O., Czapor, S.R., Labahn, G.: Algorithms for Computer Algebra. Kluwer,

Boston (1992)3. Moody, C.B., Mark, R.G.: The Impact of the MIT-BIH Arrhythmia Database. IEEE Eng.

Med. Biol.Mag. 120(3), 40–60 (2001)4. Moody, G.B.: WFDB Applications Guide, 10th edn., Havard-MIT Division of Health Sci-

ences and Technology (May 5, 2010)5. Liu, S.-M., Pan, Y., Li, Q., Meng, Y., Sun, W.-H., Zhang, Y.-H., Li, X., Qi, Y.,

Zhu, X.-L.: Establishment of 12 - lead Synchronous ECG Database Based on VirtualInstrument. Journal of Biomedical Engineering Research 27, 400–404 (2008)

6. Wang, Q., Zhang, Z.-G.: Installation of Electrocardiogram Database with HL7. ChineseJournal of Biomedical Engineering 27(3) (June 2008)

7. Xinlin: The Design and Implementation of 12-Lead ECG Database Generating System.ShanDong Ocean University of China (2007)

8. Song, X.-G., Deng, Q.-K.: On the Format of MIT-BIH Arrhythmia Database. ChineseJournal of Medical Physics 21(4) (July 2004)