【心电信号】基于matlab实现心音诊断系统含GUI
【心电信号】基于matlab实现心音诊断系统含GUI
TT_Matlab
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,完整matlab代码或者程序定制加qq1575304183。
1 简介
心血管疾病已成为导致人类死亡最主要的原因,是世界范围内的临床医学和人类社会负担.在临床方面:心脏性猝死,孕产妇心脏健康问题,麻醉安全问题与心脏都有着直接或间接的联系.目前,临床关于心脏性猝死的预警,心脏监护室和危重病人监护,麻醉安全监测项目中都没有对心脏储备指标的监测,忽略了从心力,心律,心率等几个方面同时观察研究.因此,开展基于"心音和心电综合分析"的研究具有重要的学术意义和实用价值.本文从心音位置、心音峰值、心音门限等方面进行心音的诊断。
2 部分代码
function varargout = xingyingzhengduan(varargin)
% XINGYINGZHENGDUAN M-file
for
xingyingzhengduan.fig
% XINGYINGZHENGDUAN, by itself, creates a new XINGYINGZHENGDUAN
or
raises the existing
% singleton*.
%
% H = XINGYINGZHENGDUAN returns the handle to a new XINGYINGZHENGDUAN
or
the handle to
% the existing singleton*.
%
% XINGYINGZHENGDUAN(
’CALLBACK’
,hObject,eventData,handles,...) calls the local
% function named CALLBACK
in
XINGYINGZHENGDUAN.M with the given input arguments.
%
% XINGYINGZHENGDUAN(
’Property’
,
’Value’
,...) creates a new XINGYINGZHENGDUAN
or
raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before xingyingzhengduan_OpeningFcn gets called. An
% unrecognized property name
or
invalid value makes property application
% stop. All inputs are passed to xingyingzhengduan_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE
’s Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help xingyingzhengduan
% Last Modified by GUIDE v2.5 03-May-2021 02:33:20
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(’
gui_Name
’, mfilename, ...
’
gui_Singleton
’, gui_Singleton, ...
’
gui_OpeningFcn
’, @xingyingzhengduan_OpeningFcn, ...
’
gui_OutputFcn
’, @xingyingzhengduan_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 xingyingzhengduan is made visible.
function xingyingzhengduan_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 xingyingzhengduan (see VARARGIN)
% Choose default command line output for xingyingzhengduan
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes xingyingzhengduan wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = xingyingzhengduan_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;
%==========================================================================%
handles.DoorHeartSoundsAfterShann = DoorPa;
handles.DoorHeartSoundsAfterShannT = (1:1:length(DoorPa)).*22/2205;
handles.NumSick = 0;
if (handles.numCanyonMax3 >2 ||handles.numCanyonMin3 >3)||((handles.numCanyonMax3 ==1) && (handles.numCanyonMax3+handles.numCanyonMin3)>4) %设置分裂基准数
handles.NumSick = handles.NumSick+1;
handles.SickDescribe(handles.NumSick,1:9) = ’
心音存在分裂
’;
end
if (handles.numCanyonMax5 >1 ||handles.numCanyonMin5 >3)||((handles.numCanyonMax5 ==1) && (numCanyonMax5+numCanyonMin5)>3) %设置分裂基准数
handles.NumSick = handles.NumSick+1;
handles.SickDescribe(handles.NumSick,1:9) =’
心音存在严重分裂
’;
end
if handles.S1RangeAverage<0.08
handles.NumSick = handles.NumSick+1;
handles.SickDescribe(handles.NumSick,1:9) =’
第一心音狭窄
’;
else if handles.S1RangeAverage>0.12
handles.NumSick = handles.NumSick+1;
handles.SickDescribe(handles.NumSick,1:9) =’
第一心音肥厚
’;
end
end
if handles.S2RangeAverage<0.08
handles.NumSick = handles.NumSick+1;
handles.SickDescribe(handles.NumSick,1:9) = ’
第二心音狭窄
’;
else if handles.S2RangeAverage>0.12
handles.NumSick = handles.NumSick+1;
handles.SickDescribe(handles.NumSick,1:9) =’
第二心音肥厚
’;
end
end
if (handles.S1AndS2DoorRange<0.3)||(handles.S1AndS2DoorRange>0.5)
handles.NumSick = handles.NumSick+1;
handles.SickDescribe(handles.NumSick,1:9) =’
第一二心音间隔异常
’;
end
if (handles.S1ToS1DoorRange<0.7)||(handles.S1AndS2DoorRange>0.9)
handles.NumSick = handles.NumSick+1;
handles.SickDescribe(handles.NumSick,1:9) =’
心动周期间隔异常
’;
end
set(handles.describe, ’
string
’ , handles.SickDescribe);
if handles.NumSick>2
set(handles.result, ’
string
’ , ’
心音异常--仅供参考
’);
set(handles.advise, ’
string
’ , ’
请根据自身情况尽早去医院检查--仅供参考
’);
else
set(handles.result, ’
string
’ , ’
心音正常--仅供参考
’);
set(handles.advise, ’
string
’ , ’
您很健康,祝您身体健康!--仅供参考
’);
end
guidata(hObject , handles);
%=========================================================================%
% --- Executes on button press in pushbutton19.
function pushbutton19_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton19 (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 Shannon.
function Shannon_Callback(hObject, eventdata, handles)
% hObject handle to Shannon (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if(get(hObject,’
Value
’)==get(hObject,’
Max
’)) %被选中了的操作
set(findobj(’
Tag
’,’
Threshold
’),’
enable
’,’
off
’);
set(findobj(’
Tag
’,’
DownThreshold
’),’
enable
’,’
off
’);
set(findobj(’
Tag
’,’
ChangeThreshold
’),’
enable
’,’
off
’);
hold off;
plot(handles.axes1,handles.HeartSoundsAfterShanT,handles.HeartSoundsAfterShan);
title(’
香农能量分布
’);
else
set(findobj(’
Tag
’,’
Threshold
’),’
enable
’,’
on
’);
set(findobj(’
Tag
’,’
DownThreshold
’),’
enable
’,’
on
’);
set(findobj(’
Tag
’,’
ChangeThreshold
’),’
enable
’,’
on
’);
end
% Hint: get(hObject,’
Value
’) returns toggle state of Shannon
% --- Executes on button press in S1OrS2Door.
function S1OrS2Door_Callback(hObject, eventdata, handles)
% hObject handle to S1OrS2Door (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if(get(hObject,’
Value
’)==get(hObject,’
Max
’)) %被选中了的操作
set(findobj(’
Tag
’,’
Threshold
’),’
enable
’,’
on
’);
set(findobj(’
Tag
’,’
DownThreshold
’),’
enable
’,’
on
’);
set(findobj(’
Tag
’,’
ChangeThreshold
’),’
enable
’,’
on
’);
hold off;
plot(handles.axes1,handles.DoorHeartSoundsAfterShannT,handles.DoorHeartSoundsAfterShann);
axis([0 , max(handles.DoorHeartSoundsAfterShannT),-0.2 ,1.2]);title(’
S1,S2时间门
’);
else
set(findobj(’
Tag
’,’
Threshold
’),’
enable
’,’
of
’);
set(findobj(’
Tag
’,’
DownThreshold
’),’
enable
’,’
of
’);
set(findobj(’
Tag
’,’
ChangeThreshold
’),’
enable
’,’
of
’);
end
% Hint: get(hObject,’
Value
’) returns toggle state of S1OrS2Door
% --- Executes on button press in NoiseDown.
function NoiseDown_Callback(hObject, eventdata, handles)
% hObject handle to NoiseDown (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if(get(hObject,’
Value
’)==get(hObject,’
Max
’)) %被选中了的操作
set(findobj(’
Tag
’,’
Threshold
’),’
enable
’,’
off
’);
set(findobj(’
Tag
’,’
DownThreshold
’),’
enable
’,’
off
’);
set(findobj(’
Tag
’,’
ChangeThreshold
’),’
enable
’,’
off
’);
hold off;
plot(handles.axes1,handles.HeartSoundsNoiseDownT,handles.HeartSoundsNoiseDown);title(’
强制降噪后
’);
else
set(findobj(’
Tag
’,’
Threshold
’),’
enable
’,’
on
’);
set(findobj(’
Tag
’,’
DownThreshold
’),’
enable
’,’
on
’);
set(findobj(’
Tag
’,’
ChangeThreshold
’),’
enable
’,’
on
’);
end
% Hint: get(hObject,’
Value
’) returns toggle state of NoiseDown
function DownThreshold_Callback(hObject, eventdata, handles)
% hObject handle to DownThreshold (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 DownThreshold as text
% str2double(get(hObject,’
String
’)) returns contents of DownThreshold as a double
% --- Executes during object creation, after setting all properties.
function DownThreshold_CreateFcn(hObject, eventdata, handles)
% hObject handle to DownThreshold (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 ViewTogetherNoiseAndOriganl.
function ViewTogetherNoiseAndOriganl_Callback(hObject, eventdata, handles)
% hObject handle to ViewTogetherNoiseAndOriganl (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
hold off;
plot(handles.axes1,handles.HeartSoundsOriginalCutT ,handles.HeartSoundsOriginalCut,’
r--
’);
axis([0,max(handles.HeartSoundsOriginalCutT) ,min(handles.HeartSoundsOriginalCut)*1.1, max(handles.HeartSoundsOriginalCut)*1.1]);
hold on;
plot(handles.axes1,handles.HeartSoundsNoiseDownT,handles.HeartSoundsNoiseDown);
% --- Executes on button press in ViewTogetherShanAndDoor.
function ViewTogetherShanAndDoor_Callback(hObject, eventdata, handles)
% hObject handle to ViewTogetherShanAndDoor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
hold off;
plot(handles.axes1,handles.HeartSoundsAfterShanT,handles.HeartSoundsAfterShan);hold on;
plot(handles.axes1,handles.DoorHeartSoundsAfterShannT,handles.DoorHeartSoundsAfterShann,’
g--
’);
axis([0 , max(handles.DoorHeartSoundsAfterShannT),min(handles.HeartSoundsAfterShan) ,max(handles.HeartSoundsAfterShan)]);title(’
S1,S2时间门
’);
% --- Executes on button press in Db6Division.
function Db6Division_Callback(hObject, eventdata, handles)
% hObject handle to Db6Division (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
figure(2),subplot(221),plot(handles.td1,handles.cd1) ,axis([0,max(handles.td1) ,-handles.cmax , handles.cmax]),...
title(’
cd1:
551
--
1102
Hz
’),subplot(222 ) , plot(handles.td2 ,handles.cd2), axis([0,max(handles.td1) ,-handles.cmax , handles.cmax]),...
title(’
cd2:
275
--
551
Hz
’),subplot(223),plot(handles.td3,handles.cd3),axis([0,max(handles.td1) ,-handles.cmax , handles.cmax]),title(’
cd3:
138
--
275
Hz
’),...
subplot(224),plot(handles.ta3,handles.ca3),axis([0,max(handles.td1) ,-handles.cmax , handles.cmax]),title(’
ca3:
0
--
138
Hz
’);
% --- Executes during object creation, after setting all properties.
function uipanel5_CreateFcn(hObject, eventdata, handles)
% hObject handle to uipanel5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
3 仿真结果
4 参考文献
[1]王东. 基于心音和心电的心功能检测系统研究[D]. 重庆大学, 2010.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
-
2023年血糖新标准公布,不是3.9-6.1,快来看看你的血糖正常吗? 2023-02-07
-
2023年各省最新电价一览!8省中午执行谷段电价! 2023-01-03
-
GB 55009-2021《燃气工程项目规范》(含条文说明),2022年1月1日起实施 2021-11-07
-
PPT导出高分辨率图片的四种方法 2022-09-22
-
2023年最新!国家电网27家省级电力公司负责人大盘点 2023-03-14
-
全国消防救援总队主官及简历(2023.2) 2023-02-10
-
盘点 l 中国石油大庆油田现任领导班子 2023-02-28
-
我们的前辈!历届全国工程勘察设计大师完整名单! 2022-11-18
-
关于某送变电公司“4·22”人身死亡事故的快报 2022-04-26
