目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · web...

161
中国矿业大学毕业设计说明书 目录 第一章 绪论…………………………………………3 1 . 1 心电的传导和心电图的产生…………………3 1 . 2 ???国内研究现状…………………………………10 1 . 3 设计说明………………………………………11 1 . 4 软件开发使用的工具简介……………………11 1 . 5 论文的整体结构安排……………………………………12 第二章 心电信号的波形分析……………………………13 2 . 1 最新心电分析方法简介……………………………13 2 . 2 QRS 波群的检测及意义………………………23 2 . 3 P 波的检测及意义……………………………30 2 . 4 T 波的检测及意义……………………………35 2 . 5 U 波的检测及意义…………………………………36 2 . 6 本章小结……………………………………………37 - 1 -

Upload: buihuong

Post on 01-May-2018

223 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书目录

第一章 绪论…………………………………………3

1 . 1 心电的传导和心电图的产生…………………3

1 . 2 ???国内研究现状…………………………………10

1 . 3 设计说明………………………………………11

1 . 4 软件开发使用的工具简介………………………11

1 . 5 论文的整体结构安排……………………………………12

第二章 心电信号的波形分析……………………………13

2 . 1 最新心电分析方法简介……………………………13

2 . 2 QRS波群的检测及意义………………………23

2 . 3 P波的检测及意义……………………………30

2 . 4 T波的检测及意义……………………………35

2 . 5 U波的检测及意义…………………………………36

2 . 6 本章小结……………………………………………37

- 1 -

Page 2: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书第三章 方案确定…………………………38

3 . 1 软件的功能确定设计…………………………………38

3 . 2 主要功能模块流程图……………………………41

3 . 3 数据的存储方式确定………………………………………41

3 . 4 本章小结………………………………………………42

第四章 软件的详细设计…………………………43

4 . 1 新患者模块……………………………………43

4 . 2 病历库模块……………………………………46

4 . 3 系统参数模块……………………………………48

4 . 4 数据分析模块………………………………………49

4 . 5 授权用户模块………………………………………52

4 . 6 报表打印模块………………………………………57

4 . 7 文件管理模块………………………………………57

4 . 8 关于和帮助…………………………………………59

2

Page 3: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 4 . 9 本章小结…………………………………………………61

第五章 计算机与单片机通讯过程的实现…………62

5 . 1 8051单片机串行通讯方式的简介…………………62

5 . 2 串口工作方式的选择…………………………………62

5 . 3 RS-232 串口的简介………………………………64

5 . 4 通讯软件接口的设计…………………………………66

5 . 5 本章小结………………………………………………68

结论………………………………………69

致谢…………………………………………………………71

附录 1 翻译……………………………………73

附录 2数据处理程序…………………………………94

附录 3动态心电图形显示程序……………………………101

参考文献……………………………………………………103

3

Page 4: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

第一章 绪论1 . 1 心电的传导和心电图的产生

1 . 1 .1 概述

1957年美国物理学博士,实验物理学家 Nor-man J·Holter发明

了动态心电图(Aiululatory ECG),故动态心电图简称Holter。近

半世纪以来,随着动态监护领域的进一步拓展,如动态血压、动

态脑电、动态睡眠呼吸监测等技术在医学临床及科研中的广泛应

用,现今,广义的 Holter已不再局限专指动态心电图,Holter的

全新诠释应包括:动态心电/动态血压/动态睡眠呼吸/动态脑电/动

态肺功能/动态上消化道 PH值等多种参数。

4

Page 5: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 心电图机是把人体心脏搏动程中产生的微弱电信号提取出来,且

放大后描记下来的一种装置。它描记的图形叫心电图。心电图机若

正确记录心电信号必须具有如下构:输入装置—导联线;放大器;记

器;同时还需具备相应的电源系统。一:动态心电监测(AECG) 动态心电图(AECG)是心电信息学的重要组成部分,它不同

于常规的心电图及 CCU或 ICU监护心电图等心电检查方法,是

以心血管疾病诊断领域中实用、高效、无创、安全、准确、可重复性

强的重要监测手段,广泛应用于临床诊断及科研。1 定义:AECG监护系统是用一种随身携带的记录仪,连续监测

人体 24~72小时的心电变化,经信息理分析及打印记录的心电图。2特点:

5

Page 6: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书1)心电记录仪随身佩带,不受检测距离影响,不受体位变

化及活动的限制。2)心电信息量远远大于常规 ECG,尤其对短暂性心律失常

的捕捉及一过性心肌缺血的检出有独到之处。3)选择导联必须不影响日常生活的活动和防止由这种活动

所产生的伪差和干扰,一般都选择模拟胸导V1、V3、V5作三通道

同步记录。4)分析系统不仅可分析显示监测期内心搏总数、最高心率、

最低心率、平均心率和每小时平均心率,并能自动分析和测量每

小时室上性、室性期前收缩,室上性和室性心动过速的次数、程度

和形态以及持续时间,房室传导阻滞、心脏停搏的情况及 P-R间

期、QRS波群、ST-T变化的轨迹图、趋势图及全览图等,其结果可

用不同方式输出,为临床提供有价值的资料。6

Page 7: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书3 记录仪现状目前市场上动态心电图主要分为简易动态心电图仪、磁带存

储式动态心电图仪、闪光存储式动态心电图仪。(1)简易动态心电图仪(RTDA)

采用实时分析技术,只能间断记录或定时记录心电信息,存储量

小,达不到 24小时全信息记录的要求,且误判率较高,不便于修

改,国外已不开发,在我国基层医疗单位仍有一定使用量。a) 磁带式记录仪记录仪经磁带记录心电图资料,由于磁带的运转速度缓慢

可记录至少 24小时的心电信息,但由于易受干扰,信号失真大,

仪器机械故障率高,已处于淘汰阶段。b) 闪光卡式记录仪(内、外置)插拔卡式(外置式)记录仪是开放式的,做完 24小时记录

7

Page 8: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书后需插到专用回放器中与电脑相连接收信息,由于反复插拔易造

成接触不良,病人佩带时易产生干扰或系统接收不正常,已逐步

退出使用。内置式是把闪光卡固定在记录仪内,用一根通讯电缆与计算

机联接,用于回放数据,回放一个病人的全天数据仅需要数分钟,

这样对闪光卡几乎无损伤,从而延长记录仪的使用寿命,且功耗

低,体积小,目前市场占有率最大,产品比较成熟,也是最受医

院欢迎的类型。c)其它。90 年代中期,曾有公司尝试开发小硬盘式

Holter,其优点是存储量大,数字化采集、存储,弱点是功耗大,

抗震性能差,故障率高,随着 Flash卡技术的发展,存储容量已

足够容纳 24~72小时全信息的心电图记录,故小硬盘式 Holter仅

8

Page 9: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书仅作为一种尝试就已退出市场。另外,心脏 BP机由病人携带记录

仪,结果可随时通过电话线与医院主机联系,及时掌握患者即时

心率及 ST段的改变,但由于结果过于简单,未能形成足够的市

场。(2) 评价与展望

AECG作为心电图的一个重要发展和检测手段,为诊断和治

疗提供了重要的有价值的信息,由于其对心律失常的检测率高,

且能进行定量分析,对一过性的心肌缺血特别是生活中无症状性

心肌缺血的定量分析,对起搏器的功能评价等诸多特点,目前已

成为重要的无创伤性心血管检测技术之一。随着电子技术和计算

机科学的迅速发展及医学临床科研对动态监测技术的日益增长的

需要,Holter的性能及应用领域也在不断提高和拓展。a) Holter 在单纯动态心电领域,记录仪体积越来越小,功

9

Page 10: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书耗进一步降低,尤其 Flash技术以其容量大,数字化采集心电信

号,重量轻,功耗低,寿命长等特点成为近年的主导产品。另一

方面,动态心电图导联数目也从起初的单导、双导到目前使用最

多的三导,最近数家公司推出了十二导联动态心电图记录仪,虽

然对心肌缺血的定位可进一步准确,但在临床上其实际价值有多

大尚有待考证。b)随着医学临床及科研的需求,动态监测的领域亦从单纯

的动态心电监测的范围拓展到动态血压、动态脑电、动态睡眠呼吸

动态上消化道 PH值等多项参数,并在临床科研及治疗中得以广

泛应用。二:标准的正常心电图波形标准的正常心电图如图1所示,典型的

心电图波形是由 P、Q、R、S、T、U波及 P—R间期、S—T段、Q—T

10

Page 11: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书间期等组成。

P波 P波为心电图曲线上第一个波 ,它代表心房激动过程中的

电位变化 ,称为心房激动波。正常的 P波形态应程两腰对称形,波

顶圆润,有的波顶可呈双峰状 ,但峰距应小于 0.04s。波宽不超过

0.11s,波幅在肢体导联中不超过 0.25mV ,胸导联中小于 0.15m

V。 P-R间期它是指从 P波开始处到 QRS波群的起点相隔的时间 。

P-R间期随着年龄的增大而有加长的趋势 ,成人约为 0.12s~

0.20s之间。

11

Page 12: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 QRS波群它是心电图上最尖最大的波群。特点是上升、下降沿都

比较陡、连续、不间断。QRS波群中第一个向下的波称为Q波 ;Q波

之后是一个狭窄高耸的尖脉冲波形称为 R波 ;与R波相衔接的又

是一个向下的波称为 S波。正常Q波的时间应小于 0.04s,整个波

群的宽度称为 QRS时限 ,代表全部心室激动过程所需要的时间 ,正

常人最长不超过 0.10s,最大振幅不超过 5mV。 S-T段它指的是QRS波群的终点到T波开始的一段。正常的 S

-T段一般光滑而自然地与T波前枝融合,而且是接近基线的,间距

一般不超过 0.05mV。 T波 T波是继 S-T段之后一个波幅较小 ,而延续的时间较长的

波 ,它代表心室激动后复原时所产生的电位影响 ,即称心室肌的复

极波。它的形状较钝而宽且两腰不对称 ,其方向应与QRS波群的主

12

Page 13: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书波方向一致。在以 R波为主的导联上 ,T波不应低于 R波的 1/10。 Q—T间期 它是从 QRS波群开始到T波终端的时间 ,代表心室

肌除极和复极的全部过程。这段时间随心率而改变 ,心率快则 Q—

T时间短 ,心率慢则Q—T时间长。正常范围为 0.36s~0.40s。 U波 紧接 T波后还有一个很小的波动 ,它代表激动的心室到静

止期的过程。一般认为它是心肌激动的后电位影响。正常人体的U

波很小 ,一般不超过 0.05mV。1 . 1 .2 心电图的产生 心电信号的采集,是通过导联把心脏的电压信号采集到单片机

内,但是,在心脏的不同的部位心脏起搏的电压是不同的,为了

更加全面的了解心脏的活动状况,一般都是采用不导联的形式来

采集心脏不同部位的电压信号,在不同的部位,它的电压信号是

对相对应的波段体现的比较精确,人体心电波形并不是单一频率

13

Page 14: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书的 ,而是可以分解成不同频率 ,不同比例的正弦波成分。也就是说 ,

心电信号含有丰富的高次谐波。表1给出的是正常心电波形的频

谱 ,从表中可以看出 ,频谱范围一般在 0.5 Hz~20Hz内。其中T波

频率最低约 1.3Hz,QRS波群的频率通常在 15Hz左右 ,S-T段与

基线距离<0.5mm。当Q RS波中出现小切迹线或挫折时 ,频率范

围可达(40~70)Hz,偶尔可达 200Hz,而 S-T段几乎平直 ,从频

谱分析可知 ,大约在 0.14 Hz~0.8Hz之间。若心电图机对不同频率

的信号具有相同的增益,则描记出来的波形就不会失真。但是放大

器对不同频率的信号的放大能力并不是完全一样的,放大器的信号

电压放大倍数的模和频率的关系,称为“幅频特性”。

14

Page 15: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

表1正常心电波的频谱 针对与不同的波段,把心电信号采集到之后,由于心电信号是

比较微弱的,所以要对其进行放大。同时,它还包含着噪声、工频

等多方面的干扰信号,所以要队其进行滤波和整流。这样就可以

得到我们所要的心电信号了。1 .1 .3 心电信号的重要性 当今,动态心电图以被认为是诊断心肌缺血的标准之一,当心

肌供血不足而病人无症状时,即称为无痛性心肌缺血。目前已普

遍认为无痛心肌缺血对心脏的损伤与心绞痛有相同的意义,它可

以增加心肌梗塞的几率,产生心率失常或猝死的危险。虽然心肌

15

Page 16: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书缺血可由常规心电图、运动试验的心电图等方法作出诊断,但这

方法或阳性率不高,或者需要特殊的仪器,而动态心电图则是阳

性率最高的心电图变化为:ST段水平或下斜持续 1分钟,两次间

隔 1分钟以上,无心绞痛症状。由于体位的变化、电极接触不良等

因素也可能导致 ST段偏移,长时间得到大量数据才能最具有说

服力。 同时,对心率变异(HRV)分析有重要的意义,心血管的功能

受到大脑中枢自主神经以体内激素的控制。自主神经系统按日常

生理活动条件心率昼夜不停的变化,其中交感神经系统使心率缓

慢变化,心率有明显的改变需要 20分钟或更长的时间。副交感神

经系统使心率快速变化,心率加快或减慢再一至数个心搏种完成,

而肾脏-血管紧张及其它体液按新陈代谢的需要调节心血管功能,

16

Page 17: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书使心率的变化呈更长时间的规律性,总之心率变异的生理机理是

神经体液对心血管系统精细调节的结果,反映了神经因素与窦房

结的平衡关系。当这种内在调节机制失去平衡就会引起 HRV异常,

在生理学上 HRV是用来心血管内在调节机制的工具,而临床上

HRV分析主要用于评估 ANS的功能,辅助预测心源性猝死,对

心肌梗塞病人作危险分级。目前HRV分析有时域分析、频域分析、

非线性分析等方法,这些都需要对大量数据进行统计分析才能得

出可信的结果。动态心电图长达 24小时得到的病人日常生活中的

心率变化记录,无疑是HRV分析的最佳的分析信息来源。1 . 2 国内研究现状利用电子计算机技术自动分析诊断心电图以有 20余年的历史,

最早的诊断程序是美国心脏联合会主席 Pepberger领导的一个小组

17

Page 18: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书在 1955年提出的,以后各国学者的实验研究,逐步进入临床实用

阶段。前不久我国绝大多数的医院都使用不带自动功能的心电图

机,此类仪器存在以下不足:1.不能进行自动采样、自动分析、自

动诊断、自动打印报告,人工测量的精度较低,人工出报告的时

间较长,效率较低。2.由于没有实现自动化,在基层卫生部门、边

远地区的小医院、各医院非心血管专科部门、急诊等缺乏心电图专

业医师的地方,常常难以及时对患者进行治疗。随着社会的发展,

逐步出现心电图机自动分析。心电图机分析研究始于 20世纪 50年

代末,目前国际上应用最广泛的是 12导联同步心电图自动检测,

我国现在正在推广 12导联同步心电图自动检测技术。心电图的研

究技术早已经引起国内外科研和医疗单位的重视,虽然起步很晚,

但是发展的速度很快,但是在心电图形的分析方面,还不是十分

18

Page 19: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书的完整。研究的手段和方法还比较单一。特别是在心电图特征提取

的方法的研究上,多采用带仪的时域分析或者是单一的频域分析

方法来研究心电信号。显然这两种方法都不能同时具备时域和频

域分辨能力,依次在分心信号的时候,受到了很大的限制。随着

小波理论的建立和发展,人民开始将基于时—频分析的小波变换

运用到了心电信号的分析中,并取得了很好的效果。 当前绝大部分的心电信号检测方法主要分为两步:首先对心电

信号进行滤波,滤除信号中的主要噪声(基漂、工频电、肌电、器

械移位等),对 QRS波群进行加强;然后采取一定的准则确定阈

值,检出所需的信息。前半部分多在硬件上处理,所以,软件上

的就是处理那些经滤波整流好的信号。就是在这些处理的方法中,

目前的手段多是应用小波变换,在时域上结合频域上对心电信号

19

Page 20: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书进行分析处理。目前所用的小波中,多采用两种小波:molter小波

和 duattler小波,目前还是在molter小波分析上还是比较成熟一点

的。 现在对心电信号分析上,在QRS 波的检测方面,还算是比较

成熟,对 QRS波的定位,R峰值的确定上,都已经有了很好的发

展,同时在 P波、T波的分析也有了很大的进展。但是,对U波的

分析,和 S—T段上的分析也还是很茫然。所以,在以后的发展方

向上,很可能就是国内外的研究趋势。1 . 3 设计说明 本软件系统的名称是“心电信号分析管理系统”。该项目是由中

国矿业大学机电工程与材料学院黄民老师提出的课题,在以前的

各届同学中,还没有做过有关于医疗器械方面的设计,所以,我

们也是试探性的来搞这个课题,在设计的中,未免有很多不足的20

Page 21: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书地方,还希望以后的同学继续完善、再开发这套系统,以使其可

以应用与实际中。 软件系统不同于一般的程序,它的一个显著的特点是规模庞大,

个人开发阶段性的成果只是系统最终不断完善的一个组成部分,

软件完成以后还需要不段的对其维护、补充、再开发。所以为避免

以后的 人能够顺利的对以前人的工作了解掌握,避免再软件使用

维护、对软件的二次开发的过程中不必要的重复工作,编写系统

说明是一项很有效的工作。1 . 4 软件使用的开发工具 开发本软件系统有必要选择一种简易用的开发工具,来节省开

发过程中的人力资源和将来的用于维护、二次开发的人力,经济

资源。Visual Basic 软件开发抬举基于对象特征需求,采用面向对象技术

21

Page 22: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书oop进行编程,提供了集成的环境 IDE工具,使开发 windows 下

的永远程序不再烦琐。VB的图形特性几乎含有了windows下的绝

大部分GUI元素,能组成真正的windows 图形。总而言之,VB 是

一种简单易操作的与呀,它设计的界面友好,语言通俗易懂,程

序易于维护。过开发成本低廉。本系统将采用VB 来进行开发。1 . 5 论文的结构安排本文第一章对国内外有关方面的研究做了回顾、分析和总结。第二

章是信号在识别上、分析上的原理。第三章是把系统总的框架定下

来,作概括性的介绍。第四章把系统的软件详细的介绍。第五章对

单片机和微机的接口部分作出分析。最后全文总结,得出研究的

结论。

22

Page 23: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

第二章信号分析原理2 . 1 最新分析方法简介 心电信号的计算机分析,已经有近 30年的历史,但是,其基

本的方法没有改变,即根据心电图的各个病理指标,来综合诊断

心脏病。这种法国法主要在于利用计算机来帮助医生完成综合判

断和决策任务,而不是用计算机来解析心电图的各个指标本身。

从理论上看,如果计算机只是用来分析心电图的波形,并且按照

23

Page 24: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书医生的临床目测来分析的指标进行诊断。那么,如果想让计算机

在这方面的能力比医生目测的要强的话,那就必须建立一种很好

的分析方法。  对于这种非平稳信号存在于许多科学研究领域中,为了有效地

对这些信号进行分析与处理,促使人们寻求有效的数学分析工具 。

Gabor于 1946年提出了窗口傅里叶变换 [1](WFT:Window Fourier

Transform)或称为短时傅里叶变换。虽然WFT弥补了传统傅里叶

变换的某些不足,但它也存在有本质缺陷,不能满足人们对非平稳信

号进行有效分析的要求。近几年来,借助于已有的相关数学研究成

果,迅速发展起了一种新的信号时频分析理论——小波变换理论。

小波变换是一种线性运算,它对信号进行不同尺度的分解,可有效地

应用于如信噪分离,提高时频两域的分辨率等.讨论小波变换用于心

24

Page 25: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书电 QRS波形高频成份特征提取的方法.实验结果表明高频截止频

率 Fh和W值,对于心肌缺血(冠心病)者其值普遍高于无心肌缺血

(冠心病)者.并且揭示了急性心肌缺血时心电信息的高频成份动态

变化的本质。对于采样的心电信号,经选择合适的小波,在以这

种小波为母波的基础上,对采样的信号进行小波变化,经小波变

化后的信号,在不同的小波变换尺度上,就是针对于心电信号的

不同波段的信号的加强分析,然后,在不同的尺度上,根据一定

的域值来对心电信号作出一定的判断。2 . 1 . 1 小波变换的简介 小波,从字面上理解就是一种小的、短的函数波形,也就是说:

小波=小+波形,凡是一切积分等于零的函数均可以作为小波函数。

过去我们分析信号是用傅里叶方法,将信号用正弦和余弦函数展

25

Page 26: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书开,这种方法适合变化平稳的信号,而对于非平稳变化信号(如

天气预报、地震预测、洪水预防、股市分析、图像识别等等)效果十

分不理想,也就是说傅里叶方法没有局部化能力。而小波分析方

法却能精确检测奇异信号。小波变换的概念是由法国从事石油信

号处理的工程师 J.Morlet在 1974年首先提出的,通过物理的直观

和信号处理的实际需要经验的建立了反演公式,当时未能得到数

学家的认可。小波分析作为一门学科始于 1990年前后,它是傅立

叶分析发展史上里程碑式的进展,是傅立叶分析理论发表 170多

年来最辉煌的继承、总结和发展,对分析工具起着承前启后、继往

开来的重要作用,并取得了许多传统分析方法难以实现的显著应

用效果,这种分析技术是一种高新技术,是高科技的重要内容,

它已经把信息工业和信息技术推向了一个新时代,是当今国际学

26

Page 27: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书术研究和产业发展的热点内容之一。是当前数学中一个迅速发展

的新领域,它同时具有理论深刻和应用十分广泛的双重意义。它与 Fourier变换、窗口 Fourier变换(Gabor变换)相

比,这是一个时间和频率的局域变换,因而能有效的从信号中提

取信息,通过伸缩和平移等运算功能对函数或信号进行多尺度细

化分析(Multiscale Analysis),解决了 Fourier变换不能解决的许

多困难问题,从而小波变化被誉为“数学显微镜”,它是调和分

析发展史上里程碑式的进展。小波分析的应用是与小波分析的理

论研究紧密地结合在一起地。现在,它已经在科技信息产业领域

取得了令人瞩目的成就。 电子信息技术是六大高新技术中重要的

一个领域,它的重要方面是图像和信号处理。现今,信号处理已

经成为当代科学技术工作的重要部分,信号处理的目的就是:准

27

Page 28: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书确的分析、诊断、编码压缩和量化、快速传递或存储、精确地重构

(或恢复)。从数学地角度来看,信号与图象处理可以统一看作

是信号处理(图像可以看作是二维信号),在小波分析地许多分

析的许多应用中,都可以归结为信号处理问题。现在,对于其性

质随着实践是稳定不变的信号,处理的理想工具仍然是傅立叶分

析。但是在实际应用中的绝大多数信号是非稳定的,而特别适用

于非稳定信号的工具就是小波分析。2 . 1 . 2 小波变换在心电信号上的应用

1 心电信号的基线漂移及传统解决方法 心电信号的基线漂移的表现形式为在 ECG信号上形成一个缓

慢的变化量,如图 2所示,这一典型分量有时可使 ECG信号的波形

发生较大的变化,因而是心电图噪声干扰的主要来源之一,往往对于

心电信号的识别和分析造成一定的影响。常规的心图机采用 RC滤28

Page 29: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书波的方法来消除基线漂移,即让病人保持不动,等基线稳定以后再进

行描述,显然这种方法用于计算机对病人进行长期监护是不适宜的。

用数字滤波的方法可以补偿基线漂移,但如截止频率太低,则无法很

好地消除基线漂移,而截止频率选的太高,会使 S-T段定义波形发生

畸变;目前常采用的矫正基线的方法为基线拟合方法,即通过多点采样,去掉某

些突变点 ,拟合出基线的波形 ,并与输入信号相减,以得到稳定的

ECG波形,这种方法的缺点是处理的时间较长;此外,在此原理基础

上,人们还研究出了相应的简化补偿方法,即以心拍稳定条件周期,

将漂移折线化处理,然后在输入的信号中消除基漂。

图 2 心电信号的基线漂移现象29

Page 30: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书基线漂移的消除在心电信号的预处理中十分重要,但又是比较

麻烦的。由于基线漂移的特点为非周期直流分量,利用小波变换的

带通滤波特性和尺度函数的低通滤波特性,可以将显现于小波分解

大尺度上的基线漂移直接去除,并由重构算法恢复去除基线漂移后

的心电信号。2 小波变换去除基线漂移的方法小波或小波基函数就是满足可容许性条件的具有特殊性质的函

数,所谓小波变换就是选择适当的基本小波或母小波,通过对基本小

波平移、伸缩而形成一系列的小波,然后将欲分析的信号投影到由

平移、伸缩小波构成的信号空间中。式(1)为小波变换表达式,其中

平移参数 b的变化决定时窗的位置,而尺度参数 a的变化不但改变

连续小波变换的频谱结构,同时也改变了窗口的大小和形状。

30

Page 31: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

(1)

小波变换是可逆的,信号 f可由下式恢复:

(2)

当小波变换的平移因子和尺度因子为离散情况时称为离散小

波变换,特别当尺度为二时,称为离散二进小波变换。用离散二进小

波变换处理信号时带宽以二的指数幂减小,由于工程实际中采集到

的信号多为离散形式的数字信号,因此在数字信号处理技术中常采

用离散二进小波变换的方法,离散二进小波分解及合成的基本原理

如下:

(3)

31

Page 32: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书式中Ψ(x)为二进小波,φ(x)和Ψ(x)分别为二进小波尺度函数及其对

偶。离散二进小波变换的逆变换形式如下:

(4)

通常由于实际信号的分解是有限的,由有限离散二进小波变换重构

数字信号的算法为:

(5)

  在利用小波变换方法对信号进行处理的过程中,小波基函数的

选择十分重要,利用不同小波基函数对信号进行分解,可以突出不同

特点的信号特征。在小波基函数的选择中 Daubechies小波是紧支

正交基,满足精确重建条件,但由于紧支小波不具有对称性,因而其

32

Page 33: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书边界效应会随尺度的增加而扩大,引起分解及重建误差。样条小波

是一种非紧支正交的对称小波,具有较高的光滑性,频率特性好,分

频能力强,频带相干小,且具有线性相位特性,由于对称性原因,只要

采取合理的延拓方法,其边界效应引起的误差可忽略不计。因此在

本文心电信号的分解及合成中选择了样条小波作为小波基函数。

虽然非紧支小波会形成无限长滤波器,截断误差的产生是不可避免

的,只要根据信号的特点及计算的复杂程度选择合适的滤波器长度,

即可满足不同信号处理的要求。通常样条小波阶数越低,时域内衰

减越快,但频域内截止性较差,阶数高,结果则相反。在本文中选择三

次 B样条小波作为小波基函数,心电信号小波分解细节及逼近谱如

图 3所示。

33

Page 34: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

图 3 心电图小波谱(a)心电信号小波变换细节 (b)心电信号小波变换逼近由于信号的小波变换相当于小波分解在不同尺度的带通滤波信

号,而小波分解逼近谱为各尺度下的低通滤波信号,由图 3(b)在尺度

8上的分解波形可以看出,信号中的直流分量及趋势项明显地显现

在该尺度上,由于漂移信号主要为超低频信号分量,只要在小波变换

重构的过程中,将该尺度下的分量置零,就可以得到去除了直流及缓

变趋势分量的合成信号。在信号的采样频率不变的情况下,由于对

应于某一确定的小波变换,其不同尺度下的频窗中心和窗宽是确定34

Page 35: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书的,由此可确定相应去处基线漂移的最大分解尺度。在本研究中心

电信号的采样频率为 360Hz,三次样条小波分解在尺度 8下逼近信

号的频率和功率极低,因此,原始心电信号的低频信号的主要成分在

经过基线矫正后不受影响。基于小波变换心电信号基线矫正方法的研究结果说明,基线漂

移在小波变换中直接去除的方法简单易行,由于小波变换信号处理

方法对于信号形式及变化不敏感,是处理非平稳及非线性信号的有

力工具。此外它可将不同频带的信号显现在小波分解各个尺度上,

而且具有高频信号分辨率高,低频信号分辨率逐渐下降的特点,所以

它不仅利于信号处理,而且还是信号分析的有效手段。2 . 1 . 3 小波变换在心电信号波形识别上的应用 在心电信号上识别患者是否有病,或者是有什么病的话,那就

要看出心电信号的异常点。以前都是有医生通过目测来判断心电35

Page 36: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书信号是否存在异常,这种做法效率低,而且不能针对大数据量的

心电信号。所以,只要让计算机自己来识别心电信号上的异常点,

这样就要求对心电信号的数学上的处理上的功能了。 经历了 Gabor 变换到 STFT (短时傅立叶变换)再到小波变换

的发展过程,小波概念于 1984年才真正建立起来。再此之前无论

时傅立叶变换还是 δ函数分析法都是无法像小波分析那样能兼具

时域和频域分辨能力。 由于心电信号比较微弱,仅为毫伏(mv)级,信噪比较低,

所以极易受到环境的影响。由体表电极检测到的 ECG信号含有七

种不同类型的干扰,即工频干扰、基线漂移、电极接触噪音、电极

极化噪音、肌电干扰、放大电路内部噪声和运动干扰,其中 50hz

及其倍频附近的工频干扰和 0.7hz以下的基线漂移是两个重要的

36

Page 37: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书干扰源。一般正常的心电信号在 0.01-100hz频率范围之内,而

90%的 ECG信号频率能量又集中在 0.25hz-40hz之间。为了

总强心电信号重的有效成分,抑制噪声和伪迹,提高波形检测准

确率,除了对心电记录仪器的硬件抗干扰能力有较高的要求外,

心电信号的A/D转换后的数字滤波也至为重要。 针对心电信号的数字滤波算法有很多,诸如平滑处理、带通数

字滤波算法、FFT变换、相关性分析和自适应滤波、B-样条函数拟

和等。针对种种状况的存在,我们把处理的步骤定为以下:

心电信号特征参数处理QRS波处理 P波处理 T波处理

十二导联平均波形处理 表 1:软件处理模块层次结构 本软件将小波变换应用于心电信号的波形特征点的检测上,由于

37

Page 38: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书心电信号是由 P波、QTS波、T波和静息期组成,P波、QRS波和 T

波具有不同的频率分布特性,对于不同的人来说,QRS波频率谱

稍有不同,但是对每个人来说,QRS波中心频率总是较 P波和 T

波的高。小波变换方法实际上是一种时-频局部化的分析方法,

也可以看作带通滤波,由于它具有多分辨率的特点,在信号频率

高的区域上,小波变换的时间特别有用,运用Mallet算法,选择

合适的小波变换尺度,可以将心电信号 QRS波、P波和 T波频率

段分离开来,在每个频率段各个波的信号是最强的、干扰最弱,

因此检测的准确性就大大的提高了。如图 4所示,在小波变换的不

同尺度是上的特征显现,第二尺度上的就是 QRS波最显著,在小

波变换的第五尺度 P波和 T波最显著。

38

Page 39: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

图 4 运动心电信号在j=1、2、3、4、5尺度上的小波变换,分别对

应于图 2(b)(c)(d)(e)(f),(a)为运动试验阳性病例的原始运动

心电信号。

在分离出来的信号上根据信号奇异点与小波变换系数正的极

大值-极小值的对应关系,可以较为准确的识别波形的峰值点。

而信号的奇异点就是和小波变换中的李氏指数有密切关系的。李39

Page 40: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书氏指数是数学上表征局部特征的一种度量,其定义是,设函数

X(t)在 t。附近具有下述特征:

∣X( t。+h)-Pn( t。+h)∣≤A∣h∣ª

n< a< n+1

则称X(t)在 t。处的李氏(lipschitz)指数为 a,式中 h式一个

充分小的量,Pn(t)式过X(t。)点的 n次多项式。

一般来说,a越大,信号在该点就越光滑;a越小,则信号

在该点奇异性就越大。而且对应信号奇异点的小波变换模极大值

随分解尺度的变化有如下的规律:当 a>0时,小波变换的极大值

随尺度的增大而增大,当 a<0时,小波变换的极大值随尺度的增

大而减小。

在小波变换的中,若两个相临尺度(j和 j+1)下的模极大值

40

Page 41: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书属于尺度-时间平面上的同一条极大值线,我们可以认为下一尺度

上的模极大值是由上尺度上的模极大值传递下来的。因此,通过

观察某一尺度上的极值点的位置和取值,可估计出任何极值点在

下一尺度上的对应极值点。估计的方法是:若在迟到 j上有一个具

有较大幅值的模极大值,并且它的位置接近于 j+1尺度上的具有

相同符号的模极大值的位置,我们就可以判断这两个极值点是对

应于同一个突变点的。

因此,我们就可以利用小波变换来实现图形峰值的点的查找

了,具体的R峰点的流程图如图 5所示:

41

原始心电信号

Mallat算法分解得 W2( j)f{j=1,2,3,4,5}

检测 W2(2)的一系列正极大值---负极小值对

Page 42: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

图 5:检测 R峰值的程序流程图

分析确定 R峰值点,是我们以后研究其它波段的基础。在此

基础上,我们可针对 P波、QRS波群、T波、U 波等作具体的分析

了。

2 . 2 QRS波群的检测及意义2 . 2 . 1 QRS波群的医学认识及意义

QRS波群 它是心电图上最尖最大的波群。特点是上升、下

42

正的极大值---负的极小值点左右开窗求出窗口内极大值得到 R峰值

正极大值 >阈值 s1,负极小阈值 s2

Yes

No丢弃

Page 43: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书降沿都比较陡、连续、不间断。QRs波群中第一个向下的波称为Q

波;Q波之后是个狭窄高耸的尖脉冲波形,称为 R波;与 R枝祁

衔接的又是一个向下的波,称为 s波。QRS波群:代表两心室除极

和最早期复极过程的电位和时间变化。

①QRS波群时间:正常成人为 0.06~0.10 秒,儿童为 0.04~

0.08 秒。V1、V2导联的室壁激动时间小于 0.03 秒,V5、V6的室壁

激动时间小于 0.05 秒。QRS波群时间或室壁激动时间延长常见于

心室肥大或心室内传导阻滞等。

②QRS波群振幅:加压单极肢体导联 aVL导联 R波不超过 1.2

毫伏,aVF导联 R波不超过 2.0 毫伏。如超过此值,可能为左室肥

大。aVR导联 R波不应超过 0 .5 毫伏,超过此值,可能为右室肥

大。如果六个肢体导联每个 QRS波群电压(R+S或Q+R的算术和)

43

Page 44: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书均小于 0.5 毫伏或每个心前导联 QRS电压的算术和均不超过 0.8

毫伏称为低电压,见于肺气肿、心包积液、全身浮肿、粘液水肿、心

肌损害,但亦见于极少数的正常人等。个别导联 QRS波群振幅很

小,并无意义。心电信号的参数提取和波形识别是 ECG 分析诊断的关键,

其准确性于可靠性决定诊断于治疗心脏病患者的效果,乃至挽救

病人生命的成败。其中 QRS波的检测是 ECG检测中的首要问题 。

QRS波检测不仅是诊断心率失常的最重要的根据,而且只有在

QRS波确定后才能分析 ECG的其他细节信息。2 . 2 . 2 QRS波群的检测 1 小波变换原理和小波的选择 数字信号f(n)的小波变换(Wavelet Trans Forms)可利用Mallat

算法来计算,公式如下

44

Page 45: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书  

(6)

(7)

其中 为平滑算子且 f(n)=dn·dn为文中用于分析的数

字心电信号。 f(n)为数字信号f(n)的小波变换。{ ∣k∈

Z}和{ ∣k∈Z}分别为低通滤波器H(w)和高通滤波器G(w)

的系数,即

(8)

为了得到 ECG信号特征点的准确位置,算法所用的小波变换必须

保证变换后得到的信号与原始信号之间有良好的对应关系。为此,

本算法采用了支持紧支集并具有一阶消失矩的二次样条小波。它

45

Page 46: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书是一个平滑函数的一阶导数。Ψ(x)的 Fourier变换为

(9) 符号^

表示离散 Fourier变换

2 R波检测

通过(6)和(7)计算心电信号的小波变换,然后用检测标准进行检测。

检测过程如下:

(1)选择特征尺度:小尺度上的 f(n)反映信号的高频分量,

在大尺度上它反映的是信号的低频分量。QRS波的能量主要集中

在尺度 和尺度 上,且在尺度 上的能量最大。以尺度 为中心

无论尺度变大或变小, QRS波的能量都将逐渐减小。实验中我们还

46

Page 47: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书发现,高频分量较多的 QRS波尺度 上的能量大于尺度 上的能

量,而低频分量较多的QRS波在尺度 上的能量大于尺度 上

的能量。在更大的尺度 (j≥5)上,QRS波的能量衰减变大,而干

扰的能量却变得很大。而且,尺度愈大运算量愈大。因此,本算法仅

选用了从 到 四个尺度。

(2)确定R波的模极大值列:R波在每个特征尺度上均能产生一

对模极大值点,从而形成两条模极大值列。对于高频噪声,它往往只

在小尺度上产生模极大值,而在大尺度上产生的模极大值很小或不

存在;对于低频的高 P波或高 T波来说,它们则往往只在大尺度上产

生模极大值点,而在小尺度上产生的模极大值很小或不存在。也就

是说,高频噪声和低频的高 P波、高T波或噪声常常不能在特征尺

度上产生模极大值列。因此,通过检测特征尺度上的模极大值列可

47

Page 48: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书以减小这些因素对 R波检测造成的影响。

(3)计算奇异点的奇异度:令 ( )=| f( )|并且假设 α

为 Lipschitz指数的上限。α被称作正则指数。

  在特征尺度 到 上,我们可以求出奇异点的 、 和 。R波峰

点总是对应于 >0,且多数情况下 >0。尽管,少数 R波因高频分量

较多而使大尺度上的模极大值衰减较快,导致 ≤0,但 + 仍大于

零。大多数R波在尺度 上的能量较尺度 上大,且| f( )|从尺

度 到尺度 衰减很快,不仅使 <0而且使 + + ≤0。对于高频噪

声和干扰的剧变的奇异点, 常用 ≤0、 ≤0、 ≤0,从而 + +

48

Page 49: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书≤0。因此,仅从 α1+ + 的值不能分辨 R波、高频噪声和干扰。所

以,检测时仅选用了 、 ,并令 。对大多数 R波来说α′>0,心律失常的变异 R波往往会使 α′稍微增大。因此,若 α′突然减

小,甚至变为负值,对应的奇异点一定是噪声或干扰,相应的模极大

值列应从集合中删除。

(4)去除孤立的和多余的模极大值列:通常运动伪迹和肌电噪声

的频带与QRS波的频带存在重叠。在前面所得到的模极大值列

集合中,可能会包含有由伪迹或肌电噪声引入的模极大值列,删除这

些模极大值列就可以大大减小伪迹和肌电噪声等的影响。

首先,去除孤立的模极大值列。在每个特征尺度上R波对应于一

对模极大值,即一个正极大值 负极小值对,且在尺度 上这两个模极

大值点的间距比 R波的宽度要小。设 为尺度 上 f(n)的一

49

Page 50: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书个正极大值点(或负极小值点), (k=1∧n1,k≠i)为同一尺度上

f(n)的负极小值点(或正极大值点),若 与 (k≠i)的间

距大于给定的间距阈值,则 被称作孤立极大值(或极小值)点,相应

的模极大值列称作孤立模极大值列,并将从模极大值列集合中删除。

本文中所用间距阈值根据经验选用 120ms。

其次,去除多余的模极大值列。通常 R波只产生两条模极大值列。

但对一些双 R波或带噪声的 R波,在一条模极大值列的邻域(120m

s)内,常有两条或更多的模极大值列,而其中仅有一条是有用的,其

他都是多余的。多余的模极大值列可以通过下面的准则予以去除。

因为QRS波的能量主要集中在尺度 上,故选择该尺度上的模极

大值来判别。设两个极小值点分别为Min1和Min2,其幅值分别为

A1和A2,而它们与该正极大值点的距离分别为 L1和 L2。判断多余

50

Page 51: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书模极大值列的准则下:

准则 1:若A1∕L1>1.2A2∕L2,Min2为多余点;

准则 2:若A2∕L2>1.2A1∕L1,Min1为多余点;

准则 3:否则,若Min1、Min2在该正极大值的同侧,那么离该正极

大值远的为多余点;若Min1、Min2在该正极大值点的两侧,那么该

正极大值点后的那一点为多余点。其它情况与上述类似。

(5) R波峰点检测:R波峰点对应于尺度 上的正极大值负极小

值对的过零点。在我们从模极大值列集合中删除孤立的、多余的模

极大值列之后,得到的集合 (k=1,2∧, )中只有尺度 上的正极

大值 负极小值对的位置信息。于是,找到这些正极大值 负极小值对

的过零点,即找到了 R波峰点的位置。

3 QRS波的起点和终点的检测51

Page 52: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 QRS波的起点是指Q波(当Q波不存在时为 R波)的起点;QRS波

的终点是指 S波(当 S波不存在时为 R波)的终点。

Q波和 S波通常是高频低幅波,它们的能量主要集中在小波变换

的小尺度上。因此 ,我们在尺度 上检测 QRS波的起点和终点 。

QRS波的起点对应于R波生成的模极大值对之前的第一个模极大

值,QRS波的终点对应于由 R波产生的模极大值对之后面的第一个

模极大值。在尺度 上,我们从 R波的模极大值对出发,在其前或其

后的一段时间窗口内寻找一个模极大值点,进而找出该点所在波的

起点或终点(过零点或趋零点),它们分别就是 QRS波的起点或终点。

若在该时间窗口内找不到一个模极大值点(如 Q波或 S波不存在),

则 R波生成的模极大值对的起点或终点就是QRS波的起点或终点。

我们之所以在尺度 上而不在原始信号上检测 QRS波的起点或终

52

Page 53: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书点,主要是为了避免基线漂移的影响。上面所用到的时间窗口是根

据以前所检测到的 QRS波的起点或终点与其R峰点的间距(分别

为 τ1和 τ2)确定的。若是因为高频噪声的影响在一个时间窗口内有

几个模极大值,则选择模极大值的起点(或终点)与 R峰点的间隔和

τ1(或 τ2)最接近者。

2 . 3 P波的检测及意义

2 . 3 . 1 P波的医学认识及意义

P波:呈钝圆形,可有轻微切迹。P波宽度不超过 0.11 秒,振

幅不超过 0.25 毫伏。P波的振幅和宽度超过上述范围即为异常,常

表示心房肥大。代表左右心房除极的电位变化。心脏激动的起源为

窦房结,最先传导至心房,所以在心电图的中首先出现的是 P波。

形态可以为单向(正向和负向)、双向。双向 P波是指波的描迹线

53

Page 54: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书在参考水平线两侧各有一个转折点,起始转折在水平线以上称正

负(+ -)双向,起始转折在参考水平线以下称负正(- +)双向。

如果正向 P波终末部在参考水平线以下,但无转折,仍应称正向

P波;同样,如果负向 P波终末部在参考水平线以上,但无转折,

仍应称负向 P波。

PR段是继 P波之后,心脏沿心房肌(结间束)、经房室交界

区下传至心室,产生 PR段。由于激动经过这段传导组织时所产生

的电位影响影响极为微弱,在体表心电图上表现为一段平直的线。

2 . 3 . 2 P波的检测

P波的检测,是在 QRS波检测的基础上分析的。原始信号滤波

后进行小波变换,系统采用Morlet小波将信号进行 5个尺度上的

分解,QRS波主要集中在第 2、第 3层频率段上,因此在第 2层小

54

Page 55: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书波系数上结合能量发,检测 R波,并应用移动窗口平均发检测

QRS波的起点和终点。QRS波检测之后,结合第五层小波系数在

QRS波器起点前一定时间窗内检测 P波,在QRS波终点后一段时

间窗内检测导 T波。根据模极大值对得到所有的 P波,其中,可

能混有由噪声和基线漂移引起的 P波,称之为非 P波。为删除非 P

波,先求出所有 P波的起点和终点,之后,可求得 P波的弧度值

及 P波与折线 P波段相关系数值,根据这两个值对 P波进行筛选,

筛选剩下的 P波就就是真正的 P波了。整个过程如图 6所示:

55

ECG信号预处理ECG信号小波变换

求出每个周期的 R波位置

根据变换系数的模极大值对确定所有 P波

求得每个 P波的起点和终点

得到真正的 P波

Page 56: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

图 6 P波检测总流程图

一:P波起点和终点的检测

如能求出 P波的起点和终点,则可以给出 P波形态方面的信息,

对 P波 见到具有很大的作用。有人用小波变换的方法求 P波的起

点和终点,单该方法求出的 P波宽度往往过大,所有不够精确。

用斜率法求 P波起始点,则容易受噪声的干扰。所有,现在,试

探着用一种新的方法去求取 P波起点和终点。以求起点为例:

(1) 确定一个在 P波一点左边,但是靠近起点的点。由前述所

知,每一个 P波顶点对用于一模极大值对,而该模极大值对一般

56

根据 P波弧度筛选 P波根据 P波与折线 P波的相关系数筛选 P波

Page 57: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书对应了 P波的两个腰点。如图 7中顶点 P对应了模极大值 1、2,而

点 1、2的位置处于 P波的两个腰上。根据 P波宽度的经验值,在点

2左边 50ms范围内一点 C,则一般能保证点 C在 P波左边,且靠

近起点。

(2)连接点 C和 P波顶点 P,得到直线 CP。

(3)求出 ECG信号上 C-1曲线段上的各点到直线 CP的距

离。其中距离最大的那个点就是 P波的起点,图 7中点 A为所求

得的 P波起点。

用同样的方法,可求出 P波终点,图 7中 B点为所求得的 P波

终点。该方法克服了噪声或基线漂移的干扰,且算法简单,便于

实现。

57

Page 58: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

图 7 求 P波起点和终点示意图

二:根据 P波弧度进行筛选

58

Page 59: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 低频噪声和基线漂移产生的 P波,较之真正的 P波,其弧度一

般较小,故可以根据弧度对 P波进行筛选。P波弧度的计算步骤如

下:

(1)如图 8所示,连接 P波起点A和终点 B,得到直线AB。

(2)求出 P波顶点 P到直线 AB的距离 L和线段 AB的长度

∣AB∣。

(3) 距离除以线段AB的长度∣AB∣的结果就是 P波的弧度。

设一弧度临界值 D,若求得的弧度值小于 D,则认为是非 P波;

反之,就是 P波。

59

Page 60: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

图 8 折线 P波生成示意图

三:根据相关系数筛选 P波

P波形态变化复杂,有时 P波波形不规则或者伴有很强的噪声。

本文根据 P波顶点、起点和终点构造出一个折线 P波,通过计算 P

波与折线 P波的相关系数进行筛选,更具有灵活性和适应性。折

线 P波的构造步骤如下:

(1)连接 P波起点A和顶点 P,,得到直线AP。

60

Page 61: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 (2)求出 P波AP曲线段上到直线 AP距离最大的点,该点就是

折线的交点,如图 8中点 E。

(3)同样的方法得到曲线 BP的折线交点 F。

(4)连接AE、EP、PF、FB,就是折线 P波。

计算 P波与折线 P波的相关系数,设一相关系数临界值D。,如计

算出的相关系数小于 D。,则认为是非 P波;反之,就是 P波。该

方法在检测噪声产生的非 P波时由很好的效果。如图 9所示,非 P

波具有明显的模极大值对和较高的幅度和弧度,单和折线 P波的

相关系系数却很小,故可以很准确的排除。而用神经网络方法则

比较容易误检。

61

Page 62: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

图 9

噪声产生的非 P波示意图

2 .4 T波的检测及意义

T波:T波钝圆,占时较长,从基线开始缓慢上升,然后较快

下降,形成前肢较长、后肢较短的波形。T波方向常和QRS波群的

主波方向一致。在Ⅰ、Ⅱ、V4-6导联直立,aVR导联倒置。其他导

联可直立、双向或倒置。如果V1直立,V3不能倒置。在以R波为

主导联中,T波的振幅不应低于同导联 R波的 1/10,心前导联的

62

Page 63: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书T波可高达 1.2~1.5 毫伏。在QRS波群主波向上的导联中,T波低

平或倒置,常见于心肌缺血、低血钾等。

和 T波相关的心电信号还有 Q-T间期部分,它是一个代表心

室肌除极的和复极的全部过程,Q-T间期同心率有密切关系。心率

越快,Q-T间期越短;反之,则越长。一般心率 70次/分左右时,

Q-T间期约为 0.40 秒。一般可查表。凡 Q-T间期超过正常最高值

0.03 秒以上者称显著延长,不到 0.03 秒者称轻度延长。Q-T间期

延长见于心动过缓、心肌损害、心脏肥大、心力衰竭、低血钙、低血

钾、冠心病、Q-T间期延长综合征、药物作用等。Q-T间期缩短见于

高血钙、洋地黄作用、应用肾上腺素等。

同时,还有 S-T段,自 QRS波群的终点至 T波起点的一段水

平线称为 S-T段。正常任一导联 S-T向下偏移都不应超过 0.05 毫

63

Page 64: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书伏。超过正常范围的 S-T段下移常见于心肌缺血或劳损。正常 S-T

段向上偏移,在肢体导联及心前导联 V4—6不应超过 0.1 毫伏,

心前导联V1—3不超过 0.3 毫伏,S-T 上移超过正常范围多见于急

性心肌梗塞、急性心包炎等。

T波的检测:在Morlet小波分析的基础上,在第四尺度上对

T波进行检测,同 P波的检测方法一样,在次就不在累述。

2 .5 U波的检测及意义

U波位于 T波之后,比较低小,其发生机理未完全明确。一般认

为是心肌激动的“激后电位”。代表激动的心室到静止期的过程,

是心肌激动后的电位影响,正常人的 U波很小,不超过 0.05mv。

振幅很小,在心前导联特别是 V3较清楚,可高达 0.2~0.3 毫伏 。

U波明显增高常见于血钾过低、服用奎尼丁等。U波倒置见于冠心

64

Page 65: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书病或运动测验时;U波增大时常伴有心室肌应激性增高,易诱发

室性心律失常。所以到目前为止,在 U波的检测上,还没有好的

方法。

2 . 6 本章小结

本章详细的介绍了对心电信号的分析方法,就是利用先进

的小波变换的方法,对心电信号各个波段进行对应的小波变

换的尺度上的特征进行提取和判断,在此基础上,在对心电

信号进行医学上的分析。

65

Page 66: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

第三章:总的方案的确定

3 . 1 软件的功能确定

根据一般系统软件的设计要求,初步拟定本系统的软件功能分

为:文件管理、数据处理和软件授权部分。

一:文件的管理

66

Page 67: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 其中包括:新患者信息的基本情况的记录、患者的心电信号的数

据记录、处理数据的记录、病例库的信息记录、患者诊断总报表。

1.新患者基本情况的记录

在一份病人的记录中,首先要记录下病人的基本情况,以备

存档记录。所以,拟定在新患者基本情况的记录中要包括:患者

的记录编号、心电信号记录的日期、开始记录的时间、患者姓名、患

者的地址、联系方式、患者的性别、年龄、身高、体重、有无病例和诊

断医师姓名。有了这些记录,我们就能够对病人有了一定的了解

了,在此基础上,诊断医师也可以很好的去针对患者的本质情况,

去适当的去分析心电信号的特定原因。同时,记录下诊断医师的

姓名也是对患者负责的一种体现,这样可以提高医师的责任心,

如若有一定的差错的话,就可以直接调查此记录,追究诊断医师

67

Page 68: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书的责任。

2.患者心电信号的记录

在读入患者心电信号的同时,以“Dat”的文件类型来记录下患

者的心电信号的数据。把这些数据记录下来,就可以对心电信号

进行一定的分析,同时对这些数据要跟病人的记录一起存档备案

的。

3.处理数据的记录

把原始心电信号接入系统后,经小波分析等一系列处理后,记

录下处理的结果,同样,也要把出了结果的记录同患者基本情况、

原始心电信号记录一同保存下来,存档备案。

4.病例库记录

其实,病例库记录就是在病人的基本情况、心电原始信号和68

Page 69: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书经分析后的处理结果的记录同时的综合体现。在此,以备病人复

诊或者其它突发情况的查询。因此,它只是一个中转机构,并没

有真正的又重新记录了一些东西。

5.患者诊断报表

这就像病例库记录一样,也是一个综合的体现。把病人的一

些必要的信息,综合在一起,然后以文本的形式体现出来,以备

打印出这些信息。

二:数据处理

在数据处理中,依靠第二章中所说的方法,把原始心电信号在

Morlet小波的基础上,采用Mallter算法,经五个尺度分析,分别

在第二尺度、第三尺度和第五尺度上,提取信号分析。但是,由于

本课题是比较新,本人对小波分析也不是很明白,同时在目前的

69

Page 70: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书研究水平内,还几乎没有开发出类似在 Vb中加入小波分析的例

子。因此征得指导老师的同意,在数据处理的时候,我就是采取

在心电信号经小波分析之后,在其第二尺度、第三尺度和第五尺

度上进行分析的。(但是,我也可以解决这一现象,就是先把原

始的心电信号先通过Matlab分析之后,在把分析之后的第二尺度、

第三尺度和第五尺度的信号再接入本系统即可处理。)按照设计

的要求,要把心电信号中的每一次的心跳查找到,找到 QRS波,

R波峰值,每一次心跳之间的间隔,来片断出患者是否是存在着

早搏现象,再此基础上,检测出 P波,来进一步的判断出出现的

早搏是房性早搏还是室性早搏,统计出心率的总的情况,画出总

的分析趋势图,检测到最大心率和最小心率,统计出早搏的总体

的情况,画出总的趋势分析图。然后再把这些处理出来的结果,

70

Page 71: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书一一记录下来,提供给诊断医师。

三:授权用户

这部分是对软件的使用权限的授予和限制的,再开始运行本

程序的时候,就必须有是经授权后,拥有一定的权限才能够登

陆的。用户的权限分为管理员和一般的用户,管理员的权限不

仅可以登陆到应用程序中,同时,他还拥有对其他用户授权的

权限。而一般的用户,只有登陆到这个应用程序的权限,没有

对用户授权和对系统文件删除等维护的权限。

3 . 2 主要功能实现流程图

71

新患者 复诊患者患者基本情况的录入 病例库中查询患者信息

Page 72: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

图 10主要功能实现流程图

3 . 3 数据的存储

在数据的存储上,我是以一种简单的方式来把这些信息存储

下来的,我避开了应用数据库,因为,在系统中并没有大量格式

变化的数据量,大多是形式相同的数据类型,这样,采用文件的

形式来存储,就显得很灵活,而且操作起来也是非常方便的。

72

患者的原始心电信号的录入对心电信号的处理

列出分析结果

心 率 情况查询

室 性 节律查询

房 性 节律查询

S-T 段 分析查询

心 动 过缓查询

医 生 诊断录入

患者综合信息打印

Page 73: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书对这些数据的记录上,如患者信息的记录、原始心电信号的

记录、心电信号处理的记录、系统中用户信息的记录等,都是采用

一个随即文件的方式,在一个随即文件中,定义了以个变体的数

据类型,即应用这个变体的数据类型来把患者的各项信息存储下

来。关于如何定义这些变体的数据类型,等到第四章中在作详细

的介绍。

3 . 4 本章小结

本章从总体上对设计提出了一个大的框架,基本确定了软件设

计要实现各个功能,基本确定了软件中的各个模块,并且给出了

大致的功能流程图,这样就可以为以后的设计定下了一个明确的

方向。在下一章中,就对软件的各个模块进行详细的分析。

73

Page 74: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

第四章:软件的详细设计

4 . 1 新患者模块

一:界面的设计

在新患者的界面中,要包括患者的一些基本信息,如下图所示:

74

Page 75: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

界面中,带有“*”的是必须填写的内容,文件在记录开始之前,

要对这些信息进行检查,如果存在没有填写的带“*”选项,系统

就提出警告,然后清除所填写的信息,提示操作员重新填写。其

中的患者编号,不是要求输入的,是系统自动提供的。

二:程序的流程图75

Page 76: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书其具体的程序流程图如下所示:

三:文件中数据类型的确定

为了记录下新患者的基本信息,我根据记录内容的需要,定义

了一个“xinhuanzhe”的数据类型,具体的类型如下:

76

系统提供患者编号

要求操作人员输入患者的基本情况

检 查 是 否 有 带“*”选项漏填

有 清除输入的信息

是否想保存信息 否

是重置

建立新患者信息,存入文件

Page 77: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书Public type xinhuanzhe

开始日期 As String * 20

时间 As String * 10

患者姓名 As String * 20

地址 As String * 20

联系电话 As String * 15

年龄 As String * 5

有无病历 As String * 1

医师 As String * 20

编号 As Integer

性别 As String * 1

体重 As String * 10

身高 As String * 10

End Type

77

Page 78: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书然后再在“新患者”这个控件加载的时候,定义了“xhzh” 的数

据类型是“xinhuanzhe”的数据类型,其语句如下:

Dim xhzh as xinhuanzhe

这样,就可以把新患者的信息以我们定义的“xinhuanzhe”的数据

类型格式记录下来了。

4 . 2 病例库模块

一:界面的设计

78

Page 79: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

在病例库中,是要求操作人员能够很容易的查找到以往患者的

信息,这样就要求能够很全面的显示患者的全部信息,同时,如

果是患者来复诊的话,那就还要求能够继续读入这位患者的心电

信号,因为心电信号的数据量非常的大,所以,我们只是一次性

的记录患者的心电信号的原始数据,在病人复诊的时候,读入的

79

Page 80: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书心电信号数据将覆盖上次的心电信号数据。但是在病例库中,还

容然保存着患者的上次的诊断情况,因此,医师还可以根据上次

的诊断,来继续给患者诊断病情。其界面设计如下图所示:

二:程序的流程图

80

输入要查找患者姓名 重置确定

显示患者的基本情况和诊断情况

读入心电信号数据

进行心电信号处理 诊断补充输入 重置

复诊追 加 记 录 下诊断补充

Page 81: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

4 . 3 系统参数模块

一:界面的设计

在此模块中,向系统提供一些必要的参数设置,如果你不加设

置的话,系统就会使用系统的默认设置。其界面的设计如下:

81

Page 82: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

二:程序流程图

4 . 4 数据分析模块

这个模块就是这个分析系统的核心,其分析的方法就像第二章82

系统默认参数设置重新设置系统参数

确定系统接受设置的参数

Page 83: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书中的详细的介绍一样,是采样小波变换,把原始的心电信号的数

据在五个尺度进行分析,然后再再各个对应的尺度上进行具体的

分析,在此就不再累述。这里,我要说一下这个模块的软件上

(不是数学上的纯算法问题)的有关介绍。

一:数据分析的界面设计

在数据分析的界面中,首先是对统计的心率和早搏的总的趋势

的分析,这里是应用 Vb中的Mschart控件来实现的,应用直方图

的形式来分析早搏和心率的总的趋势,显的非常的直观。在直方

图中,蓝色的方条代表的是早搏的次数,红色的方条代表的是心

率的次数,从开始记录的时间算起,每隔一个小时统计一次,在

Mschart控件的下面就是显示了记录开始的时间。

在接下来的表格中,就是具体的分析结果的报告。在此,为了

83

Page 84: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书让诊断的医生很清楚的了解到出现问题的心电信号的具体信息,

以进一步的确诊,所以,在每个分析的表格中都对应着一个“查

看图形”的按钮,它们各自链接着一个具体的窗体,能够画出出

现问题的心电信号的心电图形,这样就可以让诊断医生更清楚的

了解到出错的原因,来诊断出造成这种毛病的原因是什么,可能

是由那些心脏上的疾病所引起的。

84

Page 85: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

在医生仔细查看心电信号的分析结果之后,就可以依据自

己对心电信号的熟识来诊断出患者的病情了。因此,在接下

来的就是病人的诊断输入。

85

Page 86: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

二:程序的流程图

三:文件中数据类型的确定

86

原始的心电信号数据小波变换分五个尺度

在第二尺度上找到 R峰值点

检 测QRS波

统 计 出心率

判 断 心跳周期

统 计 房性事件

检 测P波

检 测T波

统 计 室性事件

检 测U波

S- T 段分析

统计最大最小心率

心 动 过缓分析

查看图形 查看图形 查看图形 查看图形 查看图形

医师下诊断

Page 87: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 为了记录患者的处理信息,我们定义了一个记录处理信息

的数据类型“chulijilu”。其具体的定义格式如下:

Public Type chulij ilu

心跳数 As Single 早搏个数 As Single

心跳过缓 As Single 室缓数 As Single

房缓数 As Single 早搏点(0 To 100) As Integer

过缓点(0 To 100) As Integer 室早点(0 To 100) As Integer

房早点(0 To 100) As Integer 房缓点(0 To 100) As Integer

室缓点(0 To 100) As Integer 房早个数 As Integer

室早个数 As Integer 最大心率 As Integer

最大心率点 As Integer 最小心率点 As Integer

最小心率 As Integer 平均心率 As Integer

诊断 As String * 200

End Type

87

Page 88: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书然后在用到这个数据类型的时候就直接调用就行了。

4 . 5 授权用户模块

在授权认证的模块中,首先检查你是否为管理员用户级别,如

果不是,那么你就没有权限给其它用户授权的。认证通过之后,

你就可以给你所想授权的用户名输入,并为其设置密码。同时,

在此时你也可以对其它用户进行删除的。但是,你不可以对系统

默认设置的用户进行删除的,即便是删除了,在系统加载的时候,

同样会再次加载此用户的。

在授权用户模块中授权之后的用户信息,在此系统中的用途有

三处。一:在开始运行本系统的时候,首先系统提示输入用户名

和密码。此时,就是用户认证的一次应用,想运行本系统,不管

是管理员级别还是一般用户的权限,都可以应用本系统的。二:

88

Page 89: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书就是在本模块中,在你想给别的用户授权或者你想对某个用户进

行删除的时候,系统就必须首先认证你的权限,看你是否是管理

员的权限,否则,你就没有资格去进行对用户授权和删除的操作。

三:就是在系统文件管理的时候,如果你想对系统文件进行删除

的操作的话,首先也必须通过系统对你的权限认证,在本系统中,

你只有拥有管理员的权限,才能执行此项操作的,如果你的权限

不够的话,系统会自动停止你的操作,并发出“警告”框,来警

告用户,你的权限不够,不能对系统文件进行操作。赶紧退出

“文件管理”。

一:界面的设计

刚开始的认证界面,就是一个用户名和密码的权限认证 ,其界

面如下图:

89

Page 90: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

如果你输入的用户权限不够,或者根本就不存在此用户的话,

系统会停止你的授权操作,并发出警告“用户名和密码不符!”;

当用户名和密码认证通过的时候,界面就会自动的转换到下面的

授权设置界面:

90

Page 91: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

在此分为添加用户和删除用户两个框图。即可以授权给某个用

户,同时,也可以删除某个用户。在添加用户中,可以给用户授

权成一般用户,同时,也可以把用户授权成一个高级的管理员用

户权限。点击添加之后,系统会自动在系统文件中加入用户的信

息。在删除框图中,只要输入你想删除的用户名,点击“确定”,

为谨慎起见,此时系统弹出一个警告框来,再次询问是否真的想

删除此用户,如果此时点击“否”的话。你删除的操作就会取消。

91

Page 92: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书如果你继续点击确定的话。那么,系统就会在系统文件中删除你

想删除的用户的信息。系统并弹出报告的框图来,报告“删除成

功!”。

二:模块的程序流程图

三:文件中数据类型的确定

92

输入用户名和密码

检 测 用户权限

进入授权用户和删除界面

输入要授权的用户名和密码

判 断 用 户 是否以存在?

记录用户信息

重置

Y没 有权限

警 告退出

输 入 要 删 除的用户名

要记录用户信息?

警告,并退出记录

警告:确实要删除?

删除用户信息 退出删除Yes

Page 93: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书为记录用户的信息,即拥有名、用户密码和用户权限。我们在

模块的控件中同样定义了一个 yonghus的数据类型。在此数据类型

中,就包括着用户的这三个要素,都是以字符串的格式存储的。

具体的定义如下: Public Type yonghus

用户名 As String * 20 密码 As String * 20

属性 As String * 1 End Type

在系统加载的时候,就自动的创建了一个高级管理员权限的用户,就是以这种数据类型存储下来的。同是,在设计删除用户信息的程序种,我采用的方法是:首先在用户信息文件种查找你所输入的要删除的用户名,如果此用户不存在的话,就弹出以个“警告”的对话框,提示在系统种不存在此用户,并退出删除操作。如果存在,就在文件种记下此用户的记录号,同时把它的下一项复制上了,覆盖它的信息,一直循环到最后,这样,文件的最后两项的信息是相同的。在此,就创建了一个名为“ linshi.txt”

临时的文件,把“yonghu.txt”文件种的信息一一复制到临时文件

93

Page 94: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书中去,一直到最后的倒数第二项。这样就达到了删除用户的目的了。接着,把原来的“ yonghu.txt”文件删除了,同时,再把“linshi.txt”文件重新命名为“yonghu.txt”即可。

其流程图如下:

4 . 6 报表打印模块

94

在文件中查找此用户

存在?是

确 实 要删除?是

从此用户开始复制下一个信息覆盖上一信息创建一临时文件,并把开始到最后第二个用户信息复制到临时文件中删除原来的用户信息文件并把临时文件改名为原来的用户信息文件

退出删除操作

Page 95: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 在此模块中,只是为了让医师更好的了解和以文本的形式记录

下病人的信息。因此,在报表中一定要体现除患者的一些必要的

信息。其具体的界面设计如下:

4 . 7 文件管理模块

在本系统中,包括患者的基本信息,患者的心电信号的数

95

Page 96: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书据记录和数据处理信息。因此,一定要对这些信息进行定期

的维护。对过期的就是没有超过一定的时限的文件就要对其

进行删除。在此模块中,就是来实现此种功能的。

要想对患者信息进行管理,你必须是管理员权限的用户,

否则你就不可以对这些信息进行删除。这是对信息的一种保

护方法。登陆的界面如同授权认证的界面相同,它和授权认

证的要求权限也是相同的。所以,在此就不再显示登陆界面

了。

登陆到界面之后,你就可以对患者信息进行删除的操作了,

在此有两种删除的方式:1:是删除全部信息。执行此操作后

系统中的患者信息、患者的心电信号及数据处理的信息统统

的被删除掉了。因此,在执行此操作的时候,务必谨慎!2:

96

Page 97: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书是选择性删除。选择此菜单后,系统自动的把所有的患者都

显示在桌面上,你可以选中想删除的患者,然后单击删除即

可。其界面如下:

其具体的操作流程如下:

97

权限认证

进入删除操作通过

没通过

Page 98: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

在选择性删除里面,首先是打开文件”xinhzh.dat”,找到

对应的患者信息,然后按照患者的姓名,找到它对应的数据

信息文件”“患者名” .dat”文件,把它删除了,再找到数据

处理的文件“患者名” chl.dat 文件把它也删除了,最后把

xinhzh.dat 文件中的患者信息删除了,所采用的方法如同

yonghu.dat 文件中删除用户信息的方法是相同的。在此就不

再累述。

4 . 8 关于和帮助

98

全部删除 选择性删除删除所有文件 选择想删除的患者

删除患者信息

Page 99: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 这是对本系统的介绍和一些基本的操作指南。关于的界面

如下:

“关于”窗体

在“关于”中,设置了 API 函数,报告了软件运行的计

算机的一些系统的信息和本软件的一些相关信息。

99

Page 100: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书同时,我还为本系统提供了帮助文件,在你操作系统的

时候,只要有什么地方有疑问的时候,可以随时按“ F1”得

到系统的帮助,或者,你可以直接到菜单项中,点帮助的连

接,就可以同样得到系统的帮助了。

在系统的帮助中,加入了菜单的操作方法,以及菜单的

连接内容的介绍;系统的各个模块的功能和具体的操作方法。

帮助的具体界面如下:

100

Page 101: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

4 . 9 本章小结

在本章中,把本软件中的各个模块进行了详细的介绍,包

括里面的程序流程图,文件的格式等,各模块之间的联系。

101

Page 102: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书以及系统的“关于”和“帮助”的窗体。

第五章计算机与单片机通讯过程的实现

本设计是采用 MCS51系列的单片机,他们要实现与计算

机之间的通信,采用 8051的串行口于计算机 RS-232的串口

进行连接。5 . 1 8051单片机串行通讯方式的简介

8051 单片机串行口具有四种通信方式,三种异步方式,

一种同步方式。当工作于一步方式的时候,可以进行全双工

操作,即能够同时接受和发送。由于串行口中的接收器采用

了双缓冲结构,因而在第一个收到的字节从接收寄存器

(SBUF_TX)读走之前,就可以开始接受第二个字节。

102

Page 103: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 串行口的发送 寄存器( SUBF_TX)和接受寄存器

(SBRF_RX)在物理上分开的,但可以通过同一个串行口缓冲

寄存器 SBUF(位于 99H 地址单元)去访问它们。但发送缓

冲器只能写入,不能读出,接收缓冲器只能读出,不能写入。 8051 单片机串行口是可编程接口,对它初始化编程只用

两个控制字分别写入特殊功能寄存器 SCON(98H)和电源控

制寄存器 PCON(87H)中即可。5 . 2 串口工作方式的选择

方式 0 :是一个同步方式或称作移位寄存器方式,在此

方式中,8051单片机用 RXD 引脚作为串行数据发送 /接受端,

另外 TXD用于输出位移时钟,作为外接部件的同步信号。无

论发送 8位还是接收 8位数据,都是最低有效位在前。发送过

程中,当执行一条将数据写入发送缓冲器的指令时,串行口

103

Page 104: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书把 SBUF 中 8 位数据以 fosc/12 的波特率从 RXD(P3.0)端输

出,发送完毕置中断 T1=1。写 SBUF指令的时候在 S6P1处

产生一个正脉冲,在下一个机器周期的 S6P2 处数据的最低

位输出到 RXD(P3.0)脚上,再在下一个机器周期的 S3,S4,S5

输出移位时钟位低电平,而 S6 及下一个机器周期的 S1,S2

为高电平,就这样将 8位数据由低位至高位一位一位顺序通

过 RXD线输出,并在 TXD 脚上输出 fosc/12的位移时钟。接

受时,用软件置 REN=1(同时 R1=0) ,即开始接收。 方式 1:真正拥有串行发送或接受,为 10 位通用异步接

口。TXD分别用于发送与接受数据。收发一条数据的格式为 1

位起始位、8位数据位(低位在前)、1位停止位。共 10位。在

接收时,停止位进入 SCON的 RB8,此方式的传送波特率可

104

Page 105: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书调。值得注意的是,在整个接受和发送过程中,保证 REN=

1是一个先决条件。只有当 REN=1时,才能对 REN进行检

测。 方式 2 和方式 3:其均为每帧 11 位异步通信格式,由

TXD 和 RXD 发送与接收(两种方式操作时完全一样的,所

不同的只是波特率)。每帧 11位,即 1位起始位,8位数据

位(低位在前),1位可编程的第 9数据位和 1位停止位。其

发送和接收的时的操作与方式 1类似。 考虑到数据的传送的方式和经济的要求,本设计采用的时

异步通信方式实现单片机与计算机的主从式连接。

5 . 3 RS-232 串口的简介EIA RS-232是目前最常用的串行接口标准,拥有实现计

105

Page 106: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书算机与计算机之间、计算机与外设之间的数据通信。该标准的

目的是定义数据终端设备(DTE)之间的电气特性。一般的串行

通信系统是指个人计算机和调制解调器(Moden)。调制解

调器叫数据调路终端设备(简称 DCE)。RS-232C 提供了单片

机与单片机、单片机与 PC机之间的串行数据通信的标准接口

通信距离可达 15m。RS-232C 接口的具体规定如下:(1) 范围

RS-232C 标准适用于 DCE 和 DTE 间的串行二进制通

信,最高的数据速率为 19.2kb/s。如果不增加其它设备的话,

RS-232C 标准的电缆长度最长为 15m。RS-232C 不适应与接口两边设备间要求绝缘的情况。(2) RS-232C 的信号特征

106

Page 107: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书为了保证二进制数据能够正确传送,设备控制准确完

成,有必要使用的信号电平保持一致。为满足此要求,RS-

232C 标准规定了数据和控制信号的电压范围。由于 RS-232C

是在 TTL 集成电路之前研制的,所有它的电平不是+15v 和

地,而是采用负 逻 辑,规定+ 3v~+15v 之间的人员电压表

示逻 辑 0 电平,-3v~-15v 之间的任意电压表示逻 辑 1 电

平。 (3)部分 RS-232C接口信号及引脚说明 表 5-1 给出了 RS-232C 串行标准接口信号的定义以及

信号分类。 表 5-1 部分 RS-232C接口标准引脚 名 功能说明 方向

DTE DCE

107

Page 108: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书1* GND 保护地 ×

2* TXD 发送数据 出 入3* RXD 接收数据 入 出4* RTS 请求发送 出 入5* CTS 允许发送 入 出6* DSR 数据设备准备就绪 入 出7* SGND 信号地 × ×

8* DCD 接收线路信号检测 入 出17* 接收信号码元定时

20* DTR 数据终端-DTE准备就绪 出 入21* 信号质量检测22* 振铃指示23* 数据信号速率选择24* 发送元定时(DTE为源)

108

Page 109: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书在使用 RS-232C 标准接口应注意的问题 : (1)RS-232C 可用于 DTE 和 DCE 之间的连接,也可以

用于两个 DTE之间的连接。因此,在两个数据处理设备通过

RS-232C 接口互联的时候,应该注意信号线对设备的输入 /

输出方向以及它们之间的对应关系。(2)RS-232C 虽然定义了 20 根信号线,但在实际应

用中,使用其中多少信号并无约束。也就是说,对于 RS-

232C标准接口的使用是非常灵活的。对于微机系统,通常有

其中适用方式。

RS-232 信

号线

只 发

只 接

半 双

全 双

特 殊

应用1 GND - - - - 0

7 SGND √ √ √ √ √

109

Page 110: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书2 TXD √ √ √ 0

3 RXD √ √ 0

4 RTS √ 0

5 CTS √ √ √ 0

6 DSR √ √ √ √ 0

20 DTR × × × × 0

22 振铃指示 × × × × 0

8 DCD √ √ 0

注:√表示必须配备, ×表示使用公共电话网时配备,

0表示设计者决定,-表示需要决定。

5 . 4 通讯在软件的设计VB 中有一通信控件为 MSComm,属于 ActiveX 控件,

对应的文件时 MSCOMM32.COX,它的主要属性有:Commport 属性:该属性设置并返回通道端口号Setting 属性:该属性以字符串的形式设置并返回波特

率、奇偶校验、数据位、停止位。110

Page 111: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书Portopen 属性:该属性设置并返回端口的状态,也可

以打开或关闭端口。Input 属性:当属性从接受缓冲区返回和删除字符。Output 属性:该属性向传输缓冲区写一个字符串。Rehreshold 属性:当 Rehreshold=0 时 ,接收到的数

据不产生 Oncomm 事件,应该通讯软件必须定时主动查询接

收数据缓冲区以检测是否有新数据到来;当 Rehreshold>0

时,例如 Rehrehold=1 ,则接收到字符等于或多于 1 个时就

产生 Oncomm 事件,通讯软件可以响应该事件。SThreshold 属性:当 SThreshold =0时,发送数据时

不产生 Oncomm 事件,因此通讯软件必须定时主动查询接收

发送缓冲区以检测是否需要检测新数据;当 Sthreshold >0

时,例如 SThreshold =0 ,则发送缓冲区的字符小于 1个就

111

Page 112: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书产生 OnComm 事件,通讯软件可以响应该事件以及时写入

新字符来继续发送。在程序初始化的时候,我们对通讯作了如下的约定:双方传送的波特率设置为 9600,因为心电信号的输送

是有三路信号,所以,我们设定,在传送数据的时候,第一

次接收的是第一路的心电信号,接下来的就是第二路和第三

路信号,接下来就是一、二、三路信号这样的循环的接收。所

以,在接收的时候,我们就对应的把各路的信号分别存放在

各自的文件中去。同时在第一次发送数据的时候,第一位发

送个心电信号开始记录的时间,这个要单单的给它接收下来,

作为判断信号的起始位,以后在处理信号的时候,对可疑的

信号定位都是要见来在这个时间的基础上的。在三路信号的

112

Page 113: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书选择上,程序如下:Select Case nCase 1

Open "shuju1.txt" For Random As #8 Len = Len(shuju)shuju.dianya = Format(shuju, "0.0000") Put #4, hao1, shuju n = n + 1 hao1 = hao1 + 1 Close #4

Case 2Open "shuju2.txt" For Random As #9 Len = Len(shuju)

shuju.dianya = Format(shuju, "0.0000") Put #4, hao1, shuju

n = n + 1 hao2 = hao2 + 1 Close #4

Case 3Open "shuju3.txt" For Random As #10 Len = Len(shuju)

shuju.dianya = Format(shuju, "0.0000") Put #4, hao1, shuju n = n - 2 hao3 = hao3 + 1 Close #4

End Select

5.5 本章小结 本章中,介绍了数据的传入,通过 VB中的 MSComm控件,来实现 VB和单片机之间的通讯。同时,在数据的记录上,是三路导联的信号分别输入,因此,在接受数据的时候,是采用三个文件分别接受,每次接受一个数据,就换一个文件。

113

Page 114: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书这样就把三路导联的信号分别的记录下来了。 第六章 设计总结综合上面的叙述,我总结如下:

1.在心电信号的处理方法上,采用现在最新的小波变换的

方法,把原始的信号数据,先经小波变换,然后接入本系

统中,做相应的分析。这是系统不足的地方,现在的心电

信号分析处理,在 VB 中编入小波变换的程序的方法,目

前还没有。所以,这还有待于更进一步的完善。2.软件中对患者基本信息、处理数据等信息的处理,都是采

用文件的形式处理的。因为考虑到数据类型的都是比较简

单,而且,特别是新电信号数据方面,数据的类型就是单

一的。如果采用数据库处理的话,道显的麻烦。所以,本

系统采用的是文件的形式来处理。处理起来,简洁方便。

114

Page 115: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书3.在软件的使用权限上,本系统涉及有两种类型的用户权

限:管理员权限和一般用户权限。一般用户的权限,只可

以使用本系统,但是不可以对系统的患者信息记录进行管

理;管理员权限的用户,不仅可以使用本系统,同时,还

可以对系统患者的信息记录进行管理,还有对其他用户授

权的功能。4.系统的帮助文件,可以在系统运行的同时,进行跟 踪帮

助。即你在使用系统的过程中,无论在那儿有疑问的话,

你可以随时的按“F1”键来得到系统的帮助。5.系统进行演示的数据问题,这些数据都是通过自己去点

而生成的,因此,有很大的认为因素在里面,与实际的心

电信号数据相差甚远。系统中还要注意的问题:

115

Page 116: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书1. 本次设计的目的就是实现对心电信号的 QRS波的查找、

R峰值的定位、P波的查找、心率的计算、早搏的判断、

室性事件和房性事件的判断、心电信号图形的显示。虽

然在设计中已经可以实现。但是,在现实中,这几种

判断室远远不够的。比如:房扑房颤、ST段分析、QT

段分析、QT 突变检测、心率变异分析、晚电位分析、房

速判断、结性心搏判断、室性二联率和室性三联率判断

房速和成对房早等等。因此,要想把系统进行更加完

善,还要很多很多的医学方面的专业性知识,同时,

还需要大量的时间。2. 系统的接口方面,因为没有条件能够进行调试,所以,

我只是把程序进行了编写。虽然在理论上是可以的,

116

Page 117: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书但是,理论和现实的距离太远太远,在实际的应用过

程中,肯定会出现一些这样或者那样的问题,因此,

这方面还是要继续进行调试的。最后,我想告诉对此方面感兴趣的人,可以在此基础上,

对此进行不断的完善,增加其功能,使其真正能够运用道现

实生活中,为医疗事业作出一点点的贡献。

后 记转眼大学的最后一个学期即将结束,回顾这三个多月的

毕业设计感想颇多。从针对与毕业设计的实习起,我就开始认真的把心态调

整好,在课题分发下来的同时,我就开始着手必要的知识准

117

Page 118: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书备,对于本系统的开发语言 VB ,以前从来没有接触过,因

此,也就是从那时候起,才开始学习 VB的基本知识。在这同

时,我还要着手查找与我们特别陌生的医学方面的书籍。重

点查找在新电信号处理方面的信息。虽然这方面是一个比较

新的课题,资料很多,但是,由于医学专业知识的匮乏,开

始根本就不能理解其中的含义,久了,才能有所理解。虽然这些知识对我来说都很陌生,但是,这也让我学到

了很多的新的知识。首先对软件编程有了进一步的了解;对

新电信号的有关知识也有了一定程度上的了解;更重要的是,

对我个人分析问题、解决问题的能力的培养,和对我一些好

的工作作风的初步形成都有莫大的帮助。在此过程中,首先要感谢指导老师黄民副教授给了我很

118

Page 119: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书的帮助,从整个设计的宏观方向上给我作了非常重要并且即

使的指导,百忙中金昌的督促我们的设计进度,帮助我解决

了很多的疑难问题。在这里我要感谢黄民老师的指导和支持。

同时,还要感谢黄老师的两位研究生张宁老师和袁晓明老师,

他们给我提供了很倒的心电信号方面的资料,还在很多的细

小的方面给我一些好的建议。以及在黄老师的和叶老师的研

究室里的陈磊老师、李功老师等等。他们都曾给我很多的帮助

在这里,也要好好的感谢他们。四年一瞬!但母校让我永远不会忘记,在这儿,帮助过

我关怀过我的老师和同学们,感谢你们的培养的恩情,感谢

你们友情!

119

Page 120: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

附录A 英文翻译Nonlinear analysis of continuous

ECG

during sleep I. ReconstructionJ. Fell1, K. Mann1, J. R È schke1, M. S. Gopinathan21 Department of Psychiatry, University of Mainz, Untere Zahlbacher Strasse 8, 55101 Mainz, Germany2 Department of Chemistry, Indian Institute of

120

Page 121: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书Technology, 600 036 Madras, Chennai, IndiaReceived: 7 June 1999 / Accepted in revised form: 10 December 1999Abstract. In recent years evidence has accumulated that ECG signals are of a nonlinear nature. It has been recognized that strictly periodic cardiac rhythms are not accompanied by healthy conditions but, on the contrary, by pathological states. Therefore, the application of methods from nonlinear system theory for the analysis of ECG signals has gained increasing interest. Crucialfor the application of nonlinear methods is the recon- struction (embedding) of the time series in a phase space with appropriate dimension. In this study continuous ECG signals of 12 healthy subjects recorded during di.erent sleep stages were analysed. Proper embedding dimension was determined by application of two tech- niques ± the false nearest neighbours method and the saturation of the correlation dimension. Results for the ECG signals were compared with findings for simulated data (quasiperiodic dynamics, Lorenz data, white noise) and for phase randomized surrogates. Findings obtained with the two approaches suggest that embeddingdimensions from 6 to 8 may be regarded as suitable for the topologically proper reconstruction of ECG signals.1 IntroductionThe concept of the cardiac rhythm as a periodic oscillator was challenged in the late 1980s, when research showed the heart to be associated with irregular and possibly chaotic dynamics (e.g. Babloyantz and Destexhe 1988). Several investigators have demonstrated that externally timulated cardiac tissue develops

121

Page 122: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书bifur- cation patterns like period doubling or intermittence that are characteristic of nonlinear dynamical systems (e.g. Chialvo and Jalife 1987; Chialvo et al. 1990). Other authors hypothesized that the fractal structure of the His-Purkinje system may represent a structural substrate of chaotic cardiac dynamics (e.g. Goldberger and West 1987). Evidence accumulated that strictly periodic car- diac dynamics are not accompanied by a healthy condition but, on the contrary turn out to be correlated with pathological states (e.g. Pool 1989). Since then, the idea that nonlinear methods might relect properties associated with normal as well as pathological heart functioning more accurately than conventional ones (e.g. Ravelli and Antolini 1992; Govindan et al. 1998; Na- rayanan et al. 1998) has stimulated increasing interest in the application of tools from nonlinear dynamics to ECG analysis. In addition, the successful application of so- called chaos control methods to cardiac cells (Garfinkel et al. 1982) suggested that cardiac malfunction could be controlled by a new generation of sophisticated pace- makers incorporating concepts of nonlinear dynamics. The utilization of nonlinear methods for the analysis of measured data is based on so-called embedding, i.e. reconstruction of the signal in a multidimensional space. The choice of the optimal embedding dimension is cru- cial for proper signal reconstruction and subsequent evaluation of nonlinear characteristics, which we per- formed in part II of this project (Fell et al. 2000). Arti- ficial crossing and folding of trajectories in phase space is known to occur in the presence of underembedding and leads to

122

Page 123: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书the distortion of phase space structures. In the present study the technique of false nearest neigh-bours first proposed by Kennel and colleagues (1992) was used to detect the possible presence of this e.ect in continuous sleep ECG data. The implementation of the false nearest neighbour technique was validated by the investigation of several simulated time series, i.e. chaotic Lorenz dynamics, three-periodic as well as five-periodic dynamics, and white noise. Further investigated was the convergence (saturation) of orrelation dimension esti- mates, an additional tool in the correct choice of the embedding dimension. One might wonder whether the tests for correct embedding are, in fact, related to non- linear deterministic dynamics, or whether a linear sto- chastic data set would similarly fulfil the requirements for proper reconstruction. Hence, we constructed Gaussian-rescaled phase-randomized surrogates pos- sessing the same amplitude distributions and very simi- lar power spectra as the original ECG signals (see e.g. Theiler et al. 1992). We then compared the continuous ECG findings with the results for the linear stochastic control data.2 Data acquisitionTwelve healthy male volunteers aged 21±34 years (mean: 27.3 . 4.2) recruited from the university student popu- lation and the general public participated in the inves- tigation. All reported to be in good health with regular sleep-wake patterns. There was no evidence of hypnotic drug abuse or more than moderate alcohol, ca.eine or nicotine consumption. None of the participants had a past history or current symptoms of psychopathology or a medical

123

Page 124: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书condition known to in uence sleep. Following an adaptation night to sleep laboratory conditions, polysomnographic data including sleep EEG and ECG were recorded from 11.00 p.m. to 7.00 a.m. the next day. Surface electrodes were placed on the skull (Fz, Pz, Cz, C3, and C4; 10±20 system) and mastoid to record electroencephalic activity, at the outer canthi on the left and right eye to record eye movements, and on the chin to record submental electromyographic activity. Inter- electrode impedances were all below 5 kW. The ECG signal was measured with leads axed to both arms. The ECG was digitized by a 12-bit analog-digital converter with a sampling frequency of fs = 100 Hz for further computer analysis. Visual analysis of the sleep EEG was performed according to Rechtscha.en and Kales (1968) by one experienced rater. Five time epochs (n = 16,384 data points, 2:44 min duration) free of technical and movement artifacts, each unambiguously corresponding to either sleep stage I, stage II, slow wave sleep (stage III or IV) or REM, were selected from the sleep EEG and ECG. Accuracy of the sleep stage classification was checked by another independent rater3 Methods of analysis3.1 False nearest neighbour technique The false nearest neighbour method utilizes geometric principles to determine the optimal embedding dimen- sion for time delay reconstruction. Takens (1981) demonstrated that an embedding dimension of 2d + 1 is generally sufficient to guarantee the proper reconstruction of phase space ynamics, where d is the dimension of the submanifold that contains the system attractor. More recently, Sauer and colleagues (1991)

124

Page 125: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书proved that two times the capacity (another Renyi dimension measure) of the system attractor is sufficient in the majority of cases. Proper reconstruction implies that the phase space trajectories are unfolded and that there are no crossings of orbits. Hence, it is a clear sign of underembedding if states in phase space are in close proximity in a certain embedding dimension but separate when increasing the embedding dimension. In other words, the system attractor has been reconstructed in a too-low-dimensional space and this low-dimensionalprojection of system trajectories results in neighbour points that would not be neighbours in the case of a proper reconstruction. We tested for false nearest neighbours following the proposal of Abarbanel and colleagues (1993) by defining a threshold for the difference between the separation R of two nearest neighbour points k and i in embedding dimension d as compared to embedding dimension d + 1. We chose the root mean square (RMS) of the time series as threshold. When two nearest neighbours in dimensiond were separated in dimension d + 1 about a distance greater than the threshold, that is, when we considered this pair to be false nearest neighbours.The percentage of false nearest neighbours was calculated by following this procedure for all points of a time series. Since this measure depends on the given thresh- old, it is to be understood as an operational quantity, designed to determine the optimal embedding dimension. The first minimum of the mutual information function was used as time increment s of the

125

Page 126: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书reconstruction, a choice that is recommended, for example, by Grassberger and colleagues (1991) (s = 12 sampling points for the Lorenz data; s = 4 for the quasiperiodic time series; s = 3 for white noise). We generated time series with simulated dynamics and white noise data to validate the false nearest neighbour analysis and to allow comparison with ECG data. One simulation data set was given by the x component of the Lorenz system with the parameter values b = 4, q = 40, and r = 16 (Lorenz 1963). The other two simulated time series were generated from three-periodic (three-torus) and five-periodic dynamics (five-torus), respectively. The incommensurable frequencies were chosen as (f1 =9.99 Hz, f 2=

p Hz, f 3 = p Hz, and f 4 = p Hz, f 5= p Hz), respectively. The sampling interval

was 0.01 s for all time series; data length was 16 k. 3.2 Dimension estimates: saturation The evaluation of the embedding dimension is based on the plots of the logarithm of the correlation sums against the logarithm of the distances between points in phase space (Grassberger and Procaccia 1983). The correlation sum C(R, d) is deirned as the number of pairs of state vectors in the d dimensional embedding space with a distance shorter than the radius R. The correlation dimension D2 results from: where

126

Page 127: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书: [yi : state vectors in the embedding

space; C(R): correlation sums; R: Euclidian distance]. In brief, we implemented 50 reference points, an R-axis domain of five decades and a Theiler correction of . the delay time (Theiler 1986). When increasing the embedding dimension d the curves should converge (saturate) against a finite value of D2 for a finite-dimensional system. In principle, the estimate of D2 should stay constant after reaching an embedding dimension sufficient to allow proper embedding. Since the number of data points required to reconstruct phase space structures ± and thus to calculate D2 ±increases exponentially with the system dimension, an accurate estimate of D2 essentially depends on the number of data points. Spurious saturation of D2 may be observed when a high-dimensional system is reconstructed with a small number of sampling points. Determination of the proper embedding dimension by observation of D2 saturation is therefore a less reliable method than the false nearest neighbours technique.3.3 Surrogate dataThe original time series is transformed into the complex frequency domain by FFT for the generation of phase randomized surrogates (Theileret al. 1992). The phases in the complex plane are defined by the real and imaginary parts of the complex frequency values

A

amplitude])The phases are then randomized by adding a uniformly distributed random variable

127

Page 128: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书from the interval [0; 2π], and the real and imaginary parts of the frequency values are changed accordingly. Hereby, the amplitudes of the frequency values and moreover, to obtain a real valued time series, the symmetry

has to be preserved. Finally, the phase-randomized frequency values are backtransformed into the time domain by FFT. The result is a time series with Gaussian amplitude distribution and the same power spectrum as the original time series, although with randomized phases of the Fourier transform. A modification of the simple phase randomization described above, the calculation of Gaussian-rescaled surrogates, was used in the present investigation. This procedure corrects for a non-Gaussian amplitude distribution of the original data, which may lead to spuri- ous detection of di.erences between original data and simple surrogates (Rapp et al. 1994). In a first step, a Gaussian distributed set of random numbers is generated. The rank structure of the Gaussian data set is then reordered in such a way that ranks of the Gaussian set and ranks of the original time series agree. Next, the phase randomization procedure is applied to theGaussian data set. Finally, the original time series is reordered, so that the rank structure agrees with the rank structure of the phase-randomized Gaussian data set. The Gaussian scrambled surrogate data set now is given by the reordered original time series. This procedure allows the construction of a phase-randomized surrogate data set exhibiting the same amplitude distribution as the original time

128

Page 129: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书series. Furthermore, the power spectrum of the original signal is preserved in the limit for infinite data length. In practice, i.e. for finite time series, a bias towards a white spectrum is observed (Schreiber and Schmitz 1996). In the present study the average relative discrepancy between the spectra of the ECG signals and the corresponding surrogates ranged around 8% (calculated according to Schreiber and Schmitz 1996 with a smoothing over 32 frequency bins). Figure 1 illustrates a single 20.5-s sleep ECG epoch of sleep stage I (top), and the corresponding Gaussian scrambled surrogate (bottom).

Fig. 1. ECG epoch from sleep stage I and corresponding Gaussian-rescaled phase-randomized surrogate

4 ResultsThe false nearest neighbour calculations for

129

Page 130: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书several simulated time series are shown in Fig. 2. The percent- age of false nearest neighbours ranges around and above 50% for white noise. A decrease at increasing embedding dimensions is not observable. Since the correlation dimension of the Lorenz system is slightly greater than 2 (D2 = 2.06; e.g. Sano and Sawada 1985), the percentage of false nearest neighbours drops from about 20% for embedding dimension 1 to near zero for embedding dimension 2 and remains at very low values for increasing dimensions. The percentage of false nearest neighbours is associated with a continuous decrease at increasing embedding dimensions for the three- and five-periodic dynamics, with values stabilizing at below 1% for embedding dimensions ranging around 5 and above and around 10 and above, respectively.

Fig. 2. Percentages of false nearest neighbours for Lorenz data, for three-periodic and five-periodic dynamics, as well as for white noise

Figure 3 (top) illustrates the false nearest neighbour analyses for ECG signals of the di.erent sleep stages averaged over all subjects. Averaged results for the respective Gaussian-rescaled surrogates are shown on the bottom. It becomes apparent that there is no clearly defined di.erence between sleep stages with

130

Page 131: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书respect to the percentage of false nearest neighbours, neither for ECG signals nor for the corresponding surrogates. Values for surrogates decrease slightly from around 30% for embedding dimension 1 to about 25% for embedding dimension 15, in the absence of a demonstrable minimum value. In contrast, values calculated for ECG signals initially range between 20% and 25% and decrease to approximately 5% for embedding dimensions 5±9, before rising slightly at increasing embedding dimension. These analyses allow the conclusion that (1) there is a marked di.erence between ECG signals and linear stochastic surrogates with respect to false nearest neighbours, and (2) the optimal embedding dimension for the analysis of ECG signals with respect to false nearest neighbours is within a range of 5±9.

131

Page 132: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

Fig. 3. Percentages of false nearest neighbours for ECG signals during di.erent sleep stages compared toGaussian-rescaled phase-randomized surrogates averaged over all subject s Figure 4 (top) illustrates the saturation of the cor- relation dimension estimates of ECG epochs selected from di.erent sleep stages in one of the subjects. D2 estimates for the respective surrogates are depicted on the bottom for comparison. There is no saturation of the correlation dimension for the surrogates at in- creasing embedding dimensions. In contrast, ECG signals are associated with convergence of D2 beginning with embedding dimensions 6±8, and thus, in agreement with the false nearest neighbour analysis, show markedly di.erent behavior compared with phase-randomized surrogates.

132

Page 133: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

Fig. 4. D2 saturation for ECG signals recorded in one subject during di.erent sleep stages and the corresponding Gaussian-rescaled phase-randomized surrogates5 DiscussionIt was the aim of this study to investigate the optimal embedding of continuous ECG signals recorded during sleep, using the false nearest neighbours technique and the assessment of the saturation of the correlation dimension. The false nearest neighbour analysis pro- posed by Kennel and colleagues (1992) was modified in accordance with the suggestions of Abarbanel and coworkers (1993). In the original proposal the distance threshold for the classification of a false nearest neighbour was defined as the separation in the next higher embedding

133

Page 134: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书dimension divided by the separation in the present embedding dimension. In view of the fact that the separation of nearest neighbours automatically tends to increase in relation to an increase in the embedding dimension, this method is associated with artificially low dimensional embedding. We therefore used a threshold value that does not rely on the relative, but on the absolute separation of the nearest neighbours in the next higher embedding dimension. The question is valid whether the highest possible embedding dimension might not anyhow represent the Fig. 2. Percentages of false nearest neighbours for Lorenz data, for three-periodic and five-periodic dynamics, as well as for white noise The question is valid whether the highest possible embedding dimension might not anyhow represent the optimal choice, considering that proper reconstruction can, in theory, always be achieved when the embedding dimension is greater than the required minimum value. In practice, however, overembedding is disadvantageous for several reasons: (1) the available data length is shortened (about the length: embedding dimension ¥ time delay); (2) noise contribution in the data may cause homogenous contamination of the embed- ding space and thus lead to the distortion of the estimates of nonlinear measures (e.g. D2 calculations will be biased towards higher values); and (3) the computational e.ort of estimating nonlinear properties increases in relation to the embedding dimension. De- termination of the optimal embedding dimension therefore represents an important goal for practical applications.

134

Page 135: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 The results of this study demonstrate that with respect to embedding, ECG signals exhibit a markedly di.erent behavior compared with Gaussian-rescaled phase-randomized control data, which are characterized by the same amplitude distribution and a very similar power spectrum. In this context, it needs to be emphasized that the ECG signal was analysed as a whole without di.erentiating between autonomically controlled RR dynamics and the PQRST cycle, which is associated with intracardiac physiology. A lack of evidence in support of low-dimensional determinism for RR-interval data has been reported (Kanters et al. 1994; Richter and Schreiber 1998), pointing to a stochastic character or to high-dimensional nonlinear dynamics. On the other hand, the PQRST cycle is highly phase structured and predictable in healthy subjects, suggesting an essentially nonchaotic deterministic origin (Kantz and Schreiber 1998). A di.erence between continuous ECG signals and phase-randomized stochastic control data is therefore not surprising.

The false nearest neighbour analysis carried out by this study suggests that an embedding dimension of 5±9may be appropriate for the reconstruction of ECG signals during sleep. The investigation of the saturation of correlation dimension estimates provides indirect infor- mation on correct embedding, which is less reliable than results obtained using the false nearest neighbour tech- nique. Our dimension analyses revealed convergence towards a plateau at

135

Page 136: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书embedding dimensions of 6±8. In conclusion consideration of the findings obtained with the two approaches suggests that embedding dimensions of 6±8 may be regarded as suitable for the topologically proper reconstruction of continuous ECG signals. Based on this knowledge we chose an embedding dimension of 8 in part II of this project (Fell et al. 2000), where we investigated how di.erent nonlinear characteristics of continuous ECG (correlation dimension, largest Lyapunov exponent, Kolmogorov entropy, as well as several unstable periodic orbit measures) change with sleep stage.

睡眠时连续心电图非线型分析 I再造J.Fell,k.Mann,J.RE schke,M S.Gopinathan1 Department of psychiatry,University of Mainz Untere Zahlbacher Strasse 8,55101Mainz,Germany2 Department of Chemistry,Indian Institue of Technology,600036 Madras,Chennai,IndiaReceived:7 june 1999/Accrpted in revised from: 10 December 1999

摘要: 进几年逐渐积累的经验证明心电图信号是有非线型性质。

136

Page 137: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书目前已经证实,严格的讲,心电图的周期频率与健康状况无关,相反地,与疾病状况有关。因此应用非线型系统理论分析心电图信号已经越来越受青睐。此非线型理论的应用极关重要的一点是在适当尺寸的一个相位的连续再现,在这个研究中,通过对 12个健康的人的不同睡眠时期的心电图信号图进行分析。适当的嵌入尺寸由 2 种技术正负相邻技术以及相关尺寸的应用,将心电图信号与模拟数据(单周期力学,Lorenz 数据)以及相随机数进行比较,结果包含 2种方法,暗示了从 6 到 8 的尺寸可以认为适应适当布局的再造心电图信号。1.介绍: 心脏频率的概念在 20世纪 80年代晚期得到发展。它有点像振动的周期,研究显示心脏与不规则甚至有点无秩序的动力学有关(例如 Babloyante 和 Destexhe 1988)好几个人研究证明:从外部来看,心脏组织不断分叉发展,像周期间歇式倍增,具有非线型活动的系统的特征(例见 Chialvo 和Jalife 1987;Chalvo etal 1990) 其他作者假设帕金叶系统的破碎可能代表了无秩序心脏力学当代化的结构。有证据证明

137

Page 138: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书周期的心脏力学与健康状况无关,相反地却与疾病有关。此外,所谓混沌控制的方法应用于心室细胞,暗示了心脏疾病可用新一代精密的起博器使非线型力学具体化。应用于测量数据的非线型方法是以所谓的嵌入为依据。比如,在多种尺寸空间的信号再造。最佳嵌入尺寸的选择对适当信号的再造和非线型特征的评估是至关重要的,这一部分我们将在实验第 2部分讲解。我们已经了解人是弹造轨道在嵌入下发生并有可能导致相位结构的扭转。目前由 Kennel和其同事对相近技术的研究用于检查可能存在的。(0f thise.ect )在连续睡眠心电图数据中。)相邻技术的推广是可应用于一些连续模拟时间的调查之中的,比如。无次序的劳伦滋力学,3 周期和(VE-PEIODIC)力学。在进一不调查融合关联处的尺寸平谷中。附加了一个插入尺寸选择工具。可能有人会想。这些为作正确决定的测试实际上是于非线性决定力学有关呢,还是为作适当进一不的调查线性随机数据会类似地满足所需要的要求呢?因此,我们用高斯随机来做为替代,使其相同的振幅干扰和类似力大小区域,这就会显示最早心电图的信号(见例 THEILERETAL,1992)这样我们可将连续心电图

138

Page 139: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书与线性随机数据做比较分析。2.数据的获得 12名健康男性作为志愿者假如了我们的调查中,他们部分是移民大学学生也有一般群众,年龄在 21到 34岁之间,他们都声称有固定的睡眠起床模式并且身体状况良好。他们没有人靠滥吃药来催眠的习惯,也没有人大量饮酒吸食卡因或尼古丁。他们当中没有人有任何历史记录或者目前症状说他们在接下来他们适应了实验室睡觉环境之后,第二天从晚上 11:00到早上 7:00不段有数据采样出来,在头颅上安放了表面电极(Fz,Pz,C3,和 C4;10+/-20 系统)和用来记录脑电图行为的颅骨状突起。按在人的左,右眼间处的颅骨突起是用来记录眼睛活动下巴的来记录潜意识机动电流图活动。里面电流阻抗都在 5KW之下。由连在两手笔的导线来测试心电图信号。心电图由一个 12 比特频率为 100 赫兹的模拟数字交流器将资料数字化,输入电脑做一年分析。曾经一个资深评定人根据 Rechtscha.en 和 kale(1968)的理论对睡眠 ECG 进行了依次栩栩如声的分析,(从睡眠心电图所择取的)(在 n=16.384数据点,持续 2:44分钟)没有技术

139

Page 140: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书处理和认为移动影响,每一个或对应着睡眠阶段 1,阶段 2

低波睡眠 3或 4或 REM。睡眠阶段分类的准确性是由另一个评定人校核。3.分析方法3.1 相邻技术。相邻技术方法是利用几何原理来决定最佳插入尺寸。Taken(1981) 证明通常 2d+1 的插入尺寸是足够大的,能保证适当的再造相位力学,此处 d 是包含吸引器系统的副本的尺寸。最近 Sauer 和同事们(1991)证明了大部分例子中 2倍于吸引器系统容量能够足够的。适当的再造暗示了相位抛射线的轨道是展开的,并且没有任何的几何交叉。因此,插入过程有个明显的迹象:如果相位状态很接近其插入尺寸,但是增大插入尺寸时独立存在。也就是说,系统吸引器已经在一个极低尺寸中再造,并且这个极低尺寸的 我们按照 Abarbanel 及其同事的提议,检测了假设的最邻近的数据,通过波形的开端由 R分离成的两个最近点 k 及 i之间,将尺寸 d 与 d+1比较。我们选择一个正方形作为基础,这个正方形一时间为起点。当坐标 d 中 2个最邻近的数据:在坐标 d+1中被分离,此时它们之间的距离大于下限。

140

Page 141: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书当

我们认为这组数据不是最近的。 虚假的最邻近数据的百分比可用时间轴的所有点按下列步骤算出。因为这个测量是在给定下限的前提下进行的,被认为是一个可用的数据,用于决定最理想的埋入面积相互作用的数据的最小值被用作再造时间增量 。此时,推荐一个选择,由 Grassberger及其同事所推荐的。( = 12 的点对应的李氏指数 ; = 4 的尺度上 ;

= 3 对应的是白色噪声) .我们用时间系统模拟动态及白色干扰数据来进行模拟最近数据分析及与心电图数据的比较。一组模拟数据设置 L系统中的 X元素参数值 b=4,q=40,r=16

( Lorenz 1963 ).另外两组模拟时间系统在 3—周期的特别是 ve-periodicd动力学中设定。那里有些数据不可测量频率被选定为(f1= 9.99 Hz,

)对于所有的时间系统样品区间取0.01s,数据长度 16K。3.2.尺寸估计:饱和

对插入尺寸的估计是建立在相关总数的对数平面同周期

141

Page 142: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书空间内点的对数距离比较的基础上的(Grassberger and

Procaccia 1983)相关总数 C(R,d)波形或成对的数据在半径小于 R的平面 D的插入空间内。相关尺寸 D2由以下公式得出( )简而言之,我们执行了 50

个参考点在一个 R-轴范围内及延迟时间的误差。(Theiler

1986)当插入面积 d增加时,弧线( )应该和 nite尺寸系统中的 nite值 D2相交。从原则上讲,对于D2 的估计在达到插入面积 S 之后 ,应该保持恒定,——达到适当的插入尺寸。由于数据的数量要求重建相交空间结构,由此算出 D2 在尺寸系统中呈指数地增加,对于 D2 的精确估计本质上依赖于数据点的数目。当用少量试验点一个尺寸系统时,会发现 D2

的谬误饱和,用适当的 插入尺寸来观察 D2 饱和应是因为理论比假设的最邻近点技术缺少可靠性。3.3数据替代 原始的时间被 FFT 转化成复杂的频率,用以周相随机替代的产生。结构复杂水平中 的 周 相 被 那些 采集的复杂的频率 值 的 实 部 和 虚 部 所

142

Page 143: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

这是通过加入一个(0,2π)之间的随机分配值,周相而变成随机,频率值的实部和虚部也相应地变化。以次,频率值的振幅为了达到一个真实的数据时间,对称性 必须受保护。最终,随机周相频率值通过FFT 被随机时间所代替。虽然,随着傅立叶随机周相的转换,结果是随普通振幅的时间和原始的时间有相同的光谱。

上面描述简单周相随机性的傅立叶变换的计算,被应用于目前的调查研究。这个程序改变了原始数据的非普通振幅分配,它将引导原始数据和简单替代之间的真假检测(Rappetal 1994) 在变换的步骤中形成了一系列随机数字的普通分配。接着,一系列的高斯数据结构在一系列的高斯装置和一系列原始时间的承认下重新排序,以至结构同意高斯数据装置的随机周相结构。这个程序允许随机周相数据代替装置结构显示和原始数据一样的振幅分配。进一步说原始信号的光谱能量被保存。实际上,观察到一条接近白色光谱的斜纹。(Schreiber and Schmitz 1996)在目前研究中,心电图信号的光谱与相应的替代的平均相关误差在 8%左右。图 1表

143

Page 144: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书明

图 1

4.结论 图 2显示了对几个模仿时间的错误的最近的计算。对白色噪音,错误率的范围在 50%以上。在增加插入尺寸方面的减少不明显,因为 Lorenz系统的相应尺寸稍大于 2,由插入尺寸1 产生的 20%的错误率下降到插入尺寸 2 产生几乎为零的错误率,而且由于尺寸的增加保持在一个很低的值。错误的最邻近的百分比随着插入尺寸的增加而连续下降,各自随着插入尺寸的范围在 5以上和 10 以上,以低于 1%浮动,而保持

144

Page 145: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书稳定。

图 2

图3说明了分析心电图信号的睡眠阶段的最接近错误超过了所有科目,平均的信号出现时间代用品的结果出现在底端。非常明显的是它没有明确的关系在睡眠阶段和临近的错误的百分比之间,既不是心电图信号也不是相应的代替品。代替品的价值微微减少了一点。从30%的包埋尺寸减少到大约25%的包埋尺寸15,出现了最小的(demon-strable)价值相反,计算心电图的价值开始在20%和25%范围内并减小了大约5%的包埋5+/-9,在微弱的上升之前已经增大了包埋尺寸。这些分析得出了这样的结论:(1)它有标志在心电图和线条的代替品之间,对应于相应的最接近的错误;(2)最适当的包埋尺寸对于心电图的分析对应于相应的最接近的错误在5+/-9范围内。

145

Page 146: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

图3

图 4说明了饱和的相关尺寸估计心电图选择从睡眠阶段是一个科目。D2估计信号的代替品被描绘在比较图的底端,代替品的增长尺寸没有各自的饱和尺寸。相反。心电图信号是和D2 的集中开始增长尺寸 6+/-8有关系的。这样,同意了最接近的错误理论,显示了有标志的行为和任意状态的代替品相比较。

146

Page 147: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

图 4

5结论 这个研究的主要目的是调查最合适的包埋尺寸继续心电图记录在睡眠阶段利用最接近的错误技术和对饱和的相互作用的估计。最接近的错误分析开始于 (kennel)和协会被(modired)和(abarbanel)和(coworkers)的建议相一致的。在最初的建议中最接近的错误的( clasticatis)的距离界限被拒绝作为各自的下一个包埋尺寸,被各自的包埋尺寸所分开。事实是各自的足以接近点自动将会增加并和包埋尺寸增加有关

147

Page 148: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书系,这种方法和低的包埋尺寸有关系。我们因此利用一个临界价值,它不依赖于关系,但是依赖于绝对的分开最接近点在下一个高包埋尺寸,问题是正确与否在于最可能的包埋尺寸最大值能否让其代替品图 2 的错误百分比三个阶段和白色噪音。 最合适的选择包括可能的重建,在当插入直径比所要求的规格大时理论上可以获得。然而实际上过多的插入量是不利的,因为(1)可利用的信息长度被缩短了(关于尺度,插入直径半间隔时间);(2)信息中的干扰作用可能会引起插入空间的同质的污染,进而导致对非直线测量的估计的曲解(例如,D2 的计算与标准有偏差)(3)算法估计非直线性能的增加与插入直径有关,因此,最佳插入直径的选择决定了实际应用的目的。 这项研究的结果表明。关于插入方面,ECG信号与高斯随机相重限定尺寸来控制时间相比,ECG信号能显著地显示行为而后者具有相同振幅分布和相似能量光谱等特征。在文中,需要强调的是对 ECG信号作总体分析是不需要自动控制 R-R

速度和 P-Q-R-S-T 循环。这两者与医学有关。对于 R-R时间

148

Page 149: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书间隔选用小尺寸是缺乏显示根据的,这一点 kantersetal 在1994年,Richter和 schreiber在 1998年分别提出。他们提出了特征猜测,或使用大尺寸非线性速度,另一方面,P-Q-R-

S-T 虚幻在健康专题方面是由相组成的且是可预测的,这就表明决定论的起源主要是非混乱的 (kantz 和 schreiber 与1998年提出)。因此,介于连续 ECG信号和随机的控制时间就不足为奇了。 最恰当的反证法表明,插入直径为 5+/-9 很适合睡眠中ECG信号的再建。饱和状态的相互作用尺寸确定了正确插入量下的见解数据。使用反证法假设技巧比直接获得解雇缺乏可靠性。当插入直径为 6+/-8的插入直径很合适连续 ECG信号的似地质学再建。基于这种理论,在这项实际的第二部分我们选用了 8 的插入直径。在此,我们讨论了在睡眠阶段连续 ECG 信号的非线性是如何改变的。

149

Page 150: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书附录 B 数据处理的程序片段

Dim mm As Single Dim i As IntegerDim t As Single Dim q As SingleDim zaob As Single Dim guoh As SingleDim xintsh As Single Dim j As IntegerDim k As Integer Dim Y As Integer

Dim 早搏点(0 To 100) As Integer

Dim 过缓点(0 To 100) As Integer

’’’心跳数 R 峰点心跳间隔检测,判断早搏,心跳过缓 Dim

mmm As Single max = 0 min = 100 xintsh = 0 guoh = 0 zaob = 0j = 0 k = 0Dim maxdian As IntegerDim mindian As IntegerOpen "shuju.txt" For Random As #4 Len = Len(shuju) last = LOF(4) / Len(shuju) For i = 2 To last Get #4, i, shuju m = Val(Trim$(shuju.dianya)) If m > 4 Then Get #4, i + 1, shuju mmm = Val(Trim$(shuju.dianya)) Get #4, i - 1, shuju mm = Val(Trim$(shuju.dianya)) If m > mmm And m > mm Then xintsh = xintsh + 1 If xintsh = 1 Then q = i Else: t = i - q q = i If max < t Then

150

Page 151: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 max = t maxdian = i End If If min > t Then min = t mindian = i End If If t > 64 Then guoh = guoh + 1

过缓点(j) = i

j = j + 1 ElseIf t < 60 Then zaob = zaob + 1

早搏点(k) = i

k = k + 1 End If End If End If End If Next i Close #4 Open Trim$(ming) & "chl" & ".txt" For Random As #6 Len = Len(chlshj)

chlshj.心跳数 = xintsh

chlshj.平均心率 = (xintsh * 67 * 60) / (last * 0.83)

chlshj.早搏个数 = zaob

chlshj.心跳过缓 = guoh

chlshj.最大心率 = max

chlshj.最大心率点 = maxdian

151

Page 152: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 chlshj.最小心率 = min

chlshj.最小心率点 = mindian

For Y = 0 To guoh

chlshj.过缓点(Y) = 过缓点(Y)

Next Y For Y = 0 To zaob

chlshj.早搏点(Y) = 早搏点(Y)

Next Y Put #6, 1, chlshj Close #6

' ' 'Q-R-S波群检测,测出是否为室性事件 ' ' ' ' ' '

Dim qr As Integer Dim qr1 As IntegerDim u1 As Integer Dim u2 As IntegerDim qrs(0 To 100) As SingleDim qrs1(0 To 100) As SingleDim c As Integer Dim l As IntegerDim ii As Integerc = 0 l = 0 qr = 0 qr1 = 0Open Trim$(ming) & "chl" & ".txt" For Random As #6 Len = Len(chlshj) Get #6, 1, chlshj Close #6

For ii = 1 To chlshj.早搏个数Open "shuju.txt" For Random As #4 Len = Len(shuju)

For i = chlshj.早搏点(ii - 1) - 5 To chlshj.早搏点(ii - 1) + 5

Get #4, i, shuju m = Val(Trim$(shuju.dianya)) If 1.5 < m And m < 2 Then Get #4, i - 1, shuju mm = Val(Trim$(shuju.dianya))

152

Page 153: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 Get #4, i + 1, shuju mmm = Val(Trim$(shuju.dianya)) If mm > m And m < mmm Then u1 = i End If End If If m < 1.4 Then Get #4, i - 1, shuju mm = Val(Trim$(shuju.dianya)) Get #4, i + 1, shuju mmm = Val(Trim$(shuju.dianya)) If m < mm And m < mmm Then u2 = i t = u2 - u1 If t > 5 Then qr1 = qr1 + 1

qrs1(l) = chlshj.早搏点(ii - 1)

l = l + 1 ElseIf t < 4 Then qr = qr + 1

qrs(c) = chlshj.早搏点(ii - 1)

c = c + 1 End If u1 = 0 u2 = 0 End If End If Next i Close #4 Next ii Open Trim$(ming) & "chl" & ".txt" For Random As #6 Len = Len(chlshj)

chlshj.室早个数 = qr

153

Page 154: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 chlshj.室缓数 = qr1

For Y = 0 To qr1

chlshj.室早点(Y) = qrs(Y)

Next Y For Y = 0 To qr1

chlshj.室缓点(Y) = qrs1(Y)

Next Y

chlshj.诊断 = ""

Put #6, 1, chlshj Close #6

' ' ' ' ' ' 'P波的检测,测是否有房性事件 ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '

'在此应该打开的是第二路上的信号,经小波分析之后在第四尺度上分析 p波 Dim f2(0 To 100) As Integer Dim f1 As Integer f1 = 0 Dim fangxing(0 To 100) As Integer Dim fangxingshu As Integer fangxingshu = 0 Open Trim$(ming) & "chl" & ".txt" For Random As #6 Len = Len(chlshj) Get #6, 1, chlshj Close #6

For i = 0 To chlshj.早搏个数 - 1

For j = 0 To chlshj.室早个数 - 1

If chlshj.早搏点(i) = chlshj.室早点(j) Then

GoTo tiaozh

154

Page 155: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 End If Next j

If j >= chlshj.室早个数 Then

fangxing(fangxingshu) = chlshj.早搏点(i)

fangxingshu = fangxingshu + 1 End Iftiaozh: Next i pandaun: Open "shuju.txt" For Random As #4 Len = Len(shuju)

For i = 0 To fangxingshu - 1 For j = fangxing(i) - 30 To fangxing(i) Get #4, j, shuju m = Val(Trim$(shuju.dianya)) If 2 < m < 2.4 Then Get #4, j - 1, shuju mm = Val(Trim$(shuju.dianya)) Get #4, j + 1, shuju mmm = Val(Trim$(shuju.dianya)) If m > mm And m > mmm Then t = fangxing(i) - j If t > 20 Then f2(f1) = j f1 = f1 + 1 End If End If End If Next j Next i Close #4

chlshj.房早个数 = f1

For i = 0 To f1

chlshj.房早点(i) = f2(i)

Next i Open Trim$(ming) & "chl" & ".txt" For Random As #6

155

Page 156: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书Len = Len(chlshj) Put #6, 1, chlshj Close #6

' ' ' ' ' '画出心跳分析直方图 ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '

Dim X(1 To 24, 1 To 2) As Variant Open Trim$(ming) & "chl" & ".txt" For Random As #6 Len = Len(chlshj) Get #6, 1, chlshj

X(1, 1) = chlshj.早搏个数 X(1, 2) = chlshj.心跳数 For i = 2 To 24 X(i, 1) = Rnd X(i, 2) = Rnd Next i MSChart1 = X Close #6

' ' ' ' ' ' ' ' ' ' ' ' '对分析界面提供数据 ' ' ' ' ' ' ' ' ' ' ' ' ' '

Open Trim$(ming) & "chl" & ".txt" For Random As #6 Len = Len(chlshj) Get #6, 1, chlshj

Label78.Caption = chlshj.室早个数 Label84.Caption = chlshj.房早个数 Label76.Caption = chlshj.平均心率 Label74.Caption = chlshj.最小心率 Label75.Caption = chlshj.最大心率 Label84.Caption = chlshj.房早个数

156

Page 157: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 Label94.Caption = chlshj.心跳过缓 Close #6Open "xhzh.txt" For Random As #3 Len = Len(xhzh) last = LOF(3) / Len(xhzh) For i = 1 To last Get #3, i, xhzh

If xhzh.患者姓名 = ming Then

Label102.Caption = xhzh.时间 GoTo 10 End If Next i

' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '界面转换 ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '

10: Frame1.Visible = False Frame2.Visible = False Frame3.Visible = False Frame4.Visible = False Frame5.Visible = False Frame15.Visible = True Close #3 End Sub

157

Page 158: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书

附录 C 动态心电图形显示程序Private Sub Timer1_Timer()

Dim i As Single Dim j As Single If n = last Then Timer1.Enabled = False Exit Sub End IfPicture1.Scale (0, 8)-(150, 0)Open "shuju.txt" For Random As #4 Len = Len(shuju) last = LOF(4) / Len(shuju) If nowx > 150 Then nowx = 150 For i = 1 To 150

' ' ' ' ' ' ' '利用数组来动态显示读入的心电图形 ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '

dotdata(i - 1) = dotdata(i) Next i End If Get #4, n, shuju Close #4

158

Page 159: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 dotdata(nowx) = shuju.dianya Picture1.ClsPicture1.Scale (0, 8)-(150, 0)Picture1.DrawStyle = vbSolidPicture1.ForeColor = &H8000&Picture1.DrawWidth = 1

' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '画出底部网格 ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '

For j = 1 To 9 Picture1.Line (j * 1.5, 0)-(j * 1.5, 8) Picture1.Line (0, j * 2 / 10)-(150, j * 2 / 10) Next jFor i = 1 To 9 For j = 1 To 9 Picture1.ForeColor = &H8000& Picture1.Line (j * 1.5 + i * 15, 0)-(j * 1.5 + i * 15, 8) Next j Picture1.ForeColor = vbYellow Picture1.Line (i * 15, 0)-(i * 15, 8)Next iFor i = 1 To 4 For j = 1 To 9

Picture1.ForeColor = &H8000&Picture1.Line (0, j * 2 / 10 + i * 2)-(150, j * 2 / 10 + i * 2)

Next j Picture1.ForeColor = vbYellow Picture1.Line (0, i * 2)-(150, i * 2)Next i

' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '画出波形 ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '

Picture1.ForeColor = &HFF00& Picture1.DrawWidth = 3 Picture1.PSet (0, dotdata(0)) For i = 1 To nowx Picture1.Line -(i, dotdata(i - 1)) Next i nowx = nowx + 1

159

Page 160: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书 n = n + 1Close #4End Sub

参考文献1. 周贵系 心血管病流行病学调查方法手册

北京医科大学中心出版社 1998

2. 杨心凡 心脏病学 人民卫生出版社 1998

3. 李振波 心脏病诊疗精要 中国医药科技出版社 1997

160

Page 161: 目录 - search read.pudn.comread.pudn.com/downloads85/sourcecode/others/328134/ecg... · Web viewIt was the aim of this study to investigate the optimal embedding of continuous ECG

中国矿业大学毕业设计说明书4. 黄伟元 临床心血管病学

天津科学技术出版社 1998

5. 尉挺 现代临床心脏病学

人民军医出版社 1992

6. 张永红 实用小波变换 科技出版社 1995

7. 李朝青 单片机原理及接口技术 北京航空航天大学出版社 1998

8. JAN AXELSON [美] 串行端口大全 译林出版社 1996

9. 张艳 Visual Basic 程序设计教程 中国矿业大学出版社 2001

10. 张树兵 Visual Basic 6.0 中文版入门与提高 清华大学出版社 1999

161