【心电信号】基于matlab GUI心电信号预处理【含Matlab源码 938期】
作者:互联网
一、简介
1 心音:
心脏收缩舒张时产生的声音,可用耳或听诊器在胸壁听到,亦可用电子仪器记录下来(心音图)。可分为第一心音(S1)第二心音(S2)。(正常情况下均可听到)。第三心音(S3通常仅在儿童及青少年可听到),第四心音(S4正常情况很少听到)。从心脏产生的心音经过组织的介导传到胸壁表面,其中以骨传导最好。
心音是心脏及心血管系统机械运动状况的反映,其中包含着心脏各个部分本身及相互之间作用的生理和病理信息。心音信号的识别与分类对心血管系统疾病的诊断具有重要的意义,其准确性、可靠性的好坏决定着诊断与治疗心脏病患者的效果。早期的心音识别与分类是医生根据听诊结果来完成的,显然这一过程具有一定的主观性且可靠性不高。随着信号处理与分析技术的不断发展,对心音的研究也逐步由定性分析进入了定量分析的阶段。国内外许多生物医学工程研究人员将传统的模式识别方法,以及神经网络方法用于心音的识别与分类,期望实现心音的自动解释和自动诊断,以便向临床医生提供实用的辅助诊断信息。此外,心音的识别与分类还有助于对心音产生机制的理解。
心音信号研究主要是采用微电子技术,检测技术,现代数字信号处理技术和生物医学工程技术,研究和揭示心音与心脏病之间的关系。
无论是多大单位的记录,人的体重,心率,血压等生理参数,都是时变的,称为心率或者血压的变异性。
心音是在心动周期中,由于心肌收缩和舒张,瓣膜启闭,血流冲击心室壁和大 动脉等因素引起的机械振动,通过周围组织传到胸壁,将耳紧贴胸壁或将听诊器放在胸壁 定部位,听到的声音 通常很容易听到第一和第二心音,有时在某些情况下听到第三或第四心音。
第一心音:S1,发生在心脏收缩期开始,音调低沉,持续时间较长(约0.15秒)。产生的原因包括心室肌的收缩,房室瓣突然关闭以及随后射血入主动脉等引起的振动。第一心音的最佳听诊部位在锁骨中线第五肋间隙或在胸骨右缘。相对于心电图上QRS波开始后0.020.04s,占时0.080.15s
第二心音:S2,发生在心脏舒张期的开始,频率较高,持续时间较短(约0.08秒)。产生的原因是半月瓣关闭,瓣膜互相撞击以及大动脉中血液减速和室内压迅速下降引起的振动。第二心音的最佳听诊部位在第二肋间隙右侧的主动脉瓣区和左侧的肺动脉瓣区。相对于T波终末部。
第三心音和第四心音:
第三心音S3发生在第二心音后0.1~0.2秒,频率低,它的产生与血液快速流入心室使心室和瓣膜发生振动有关,通常仅在儿童能听到,因为 较易传导到体表。相当于T波后距第二心音0.12~0.20s。
第四心音S4由心房收缩引起,也称心房音,相当于心电图上P波后0.15~0.18s,振幅低。
心音杂音对正常心音形成了一定的干扰,但心音杂音的出现对心音信号分析具有实际应用价值和临床意义。
根据杂音出现的时间与S1,S2心音的关系,可分为早,中,晚期杂音。杂音的强度一般可视其振幅与S1比较分类。大于S1,强。小于S1,大于1/3S1,中。低于S1的1/3则为低,仅有轻微振动则为极低振幅杂音。
由于心音信号属于强噪声背景下的人体微弱生物信号,由于心音信号是由复杂的生命体发出的不稳定的自然信号。心音的改变和杂音的出现往往是心脏产生器质性病变的早期症状,心脏内部的物理结构发生变化将直接影响和改变心音信号。
目前广泛应用 的心电图检查是心脏变时性和变传导性的最佳检测方法,但不能用来检测心脏的变力性先天心脏瓣膜受损。心脏传导组织病变引起的心脏机械活动障碍不会首先反应在心电图上,却能首先反应在心音信号上。当冠心病的阻塞达到70%以上时才能引起心电图信号的改变,实际上,达到25%就可以改变心音信号。
2 异常心音
包括S2、S2的异常及收缩期,舒张期的附加音(或额外音)。
① 第一心音异常。指S1增强,减弱或分裂。估计S1的响度,最好是用听诊,心音图判断能力有限。S1增强、减弱或强弱不等的临床情况见表1。S1分裂指M1与T1相距>0.04sec,可见于正常儿童、青年及体瘦者,无重要意义。S1异常分裂时M1与T1相距可大于0.06秒,见于电激动延迟(如右束支传导阻滞等)、机械活动延迟(如房间隔缺损、严重二尖瓣狭窄等。听诊S1分裂在二尖瓣及三尖瓣区最清楚坐位及呼气时更清楚。
② 第二心音异常。包括S2增强,减弱或分裂。
S2增强又分P2增强及A2增强,P2增强见于肺血流量增多(如间隔缺损),肺血管阻力增加;肺静脉压力增高(如二尖瓣狭窄)。P2亢进一般在肺动脉瓣区听到。A2增强见于体循环阻力增高或血流量增多,向肺动脉瓣及心尖区传导,见于 高血压等。
S2减弱又分P2减弱及A2减弱。P2减弱见于肺动脉压低、肺血流量减少或 肺动脉瓣狭窄等。A2减弱见于体循环阻力低、血流减少、血压低、 主动脉瓣狭窄或严重关闭不全。
S2分裂可为生理性。右室射血结束稍晚于左室,吸气时P2延迟出现,此时可听到S2分裂。但呼气时A2与P2接近或重叠,分裂消失。这见于青少年,在肺动脉瓣区听诊明显,坐位时可消失。
S2异常分裂包括宽分裂、固定分裂、逆分裂、分裂减窄。宽分裂是呼气时S2分裂不消失,见于右室射血时间延长或左室射血时间缩短等情况。S2固定分裂指呼吸时A2 -P2间期无明显改变或变动<0.02sec,见于分流量较大的房间隔缺损等。S2逆分裂指A2在P2之后,吸气时A2-P2分裂不显,呼气时P2提早出现,分裂增宽。见于主动脉瓣关闭延迟。S2分裂减窄常由于严重肺动脉高压P2较早出现所致。
3 心音信号分析方法:
传统的谱分析方法通过快速傅立叶变换将时,频域关联起来。但FFT时频域分离,并以信号的频率特性时不变,或统计特性稳定为前提。
传统的稳态分析方法反映的是信号的静态频谱特征,对于包括人体心音信号在内的生物学生理信号,由于环境的影响而表现为非平稳时变特性。因此采用经典谱分析方法难以准确反映心音信号的动态变化。
在传统心音分析的基础上,提出了很多方法:
1.短时傅立叶变换(STFT)
2.小波变换
3.其他时频分析方法
二、源代码
function varargout = kaishi(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @kaishi_OpeningFcn, ...
'gui_OutputFcn', @kaishi_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before kaishi is made visible.
function kaishi_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to kaishi (see VARARGIN)
% Choose default command line output for kaishi
%handles.output = hObject;
ha=axes('units','normalized','position',[0 0 1 1]);
colormap gray
set(ha,'handlevisibility','off','visible','off');
% Update handles structure
global xd;
handles.output = xd;
guidata(hObject, handles);
% UIWAIT makes kaishi wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = kaishi_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in xhxz.
function xhxz_Callback(hObject, eventdata, handles)
% hObject handle to xhxz (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global m;
global xd;
global a;
global n;
n=25000;
[filename, pathname,index] = uigetfile('*.txt', '请选择信号');
m=index;
if isequal(filename,0)
f = errordlg('没有选择有效信号', '注意!', 'modal');
else
f1=importdata(filename);
plot(xd);
title('选取的心电信号');
end
% --- Executes on button press in exit_1.
function exit_1_Callback(hObject, eventdata, handles)
% hObject handle to exit_1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(gcf);
% --- Executes during object creation, after setting all properties.
function figure1_CreateFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in FD.
function FD_Callback(hObject, eventdata, handles)
% hObject handle to FD (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%xd=a(13000:5:25000);
%plot(xd);
% --- Executes on button press in SX.
function SX_Callback(hObject, eventdata, handles)
% hObject handle to SX (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global m;
XZLB;
else
f0 = errordlg('没有选择有效信号', '注意!', 'modal');
end
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
close(gcf);
JGXS;
% --- Executes on button press in FD1.
function FD1_Callback(hObject, eventdata, handles)
% hObject handle to FD1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global xd;
global a;
global n;
global c;
if n>15000
n=n-2000;
else
n=n;
end
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @XBQZCS_OpeningFcn, ...
'gui_OutputFcn', @XBQZCS_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before XBQZCS is made visible.
function XBQZCS_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to XBQZCS (see VARARGIN)
% Choose default command line output for XBQZCS
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
ha=axes('units','normalized','position',[0 0 1 1]);
uistack(ha,'down')
II=imread('aa6.jpg');%里面的参数可以是你自己的图片,把名字连同格式写进去就可以了
image(II)
colormap gray
set(ha,'handlevisibility','off','visible','off');
% UIWAIT makes XBQZCS wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = XBQZCS_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in goon_2.
function goon_2_Callback(hObject, eventdata, handles)
% hObject handle to goon_2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(gcf);
JGXS;
% --- Executes on button press in exit_5.
function exit_5_Callback(hObject, eventdata, handles)
% hObject handle to exit_5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(gcf);
XZLB;
% --- Executes when selected object is changed in uipanel3.
function uipanel3_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in uipanel3
% eventdata structure with the following fields (see UIBUTTONGROUP)
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty if none was selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
global xd;
global Y1;
tString=get(hObject,'tag');
switch tString
case 'sym_4'
Y1=wden(xd,'heursure','s','one',3,'sym4'); %进行相应的操作
case 'sym_6'
Y1=wden(xd,'heursure','s','one',3,'sym6');%进行相应的操作
case 'sym_8'
Y1=wden(xd,'heursure','s','one',3,'sym8');%进行相应的操作
case 'sym_10'
Y1=wden(xd,'heursure','s','one',3,'sym10'); %进行相应的操作
end
三、运行结果
四、备注
版本:2014a
完整代码或代写加1564658423
标签:see,GUI,handles,电信号,hObject,源码,心音,eventdata,gui 来源: https://www.cnblogs.com/homeofmatlab/p/14906848.html