MIMIC数据读取和MATLAB显示
2018-03-18 22:47
2911 查看
MIMIC数据库里面提供了诸如心电信号(ECG)、光电容积脉搏波信号(Pleth)、动脉血压信号(ABP)和呼吸信号(RESP)等从ICU病房中采集的生理数据。数据下载网站为:PhysioNet(http://physionet.org/)。这是课程作业,我也是自己总结查资料保存一下。
数据下载步骤:
1.通过PhysioBank ATM对MIMIC数据库进行访问(网址:https://physionet.org/cgi-bin/atm/ATM)。在DataBase中选择MIMIC DateBase(mimicdb),如下如图所示:
2.选中后下载相关文件即可:
3.用matlab打开plotATM.m的文件,修改文件名。
% usage: plotATM('RECORDm')
%
% This function reads a pair of files (RECORDm.mat and RECORDm.info) generated
% by 'wfdb2mat' from a PhysioBank record, baseline-corrects and scales the time
% series contained in the .mat file, and plots them. The baseline-corrected
% and scaled time series are the rows of matrix 'val', and each
% column contains simultaneous samples of each time series.
%
% 'wfdb2mat' is part of the open-source WFDB Software Package available at
% http://physionet.org/physiotools/wfdb.shtml % If you have installed a working copy of 'wfdb2mat', run a shell command
% such as
% wfdb2mat -r 100s -f 0 -t 10 >100sm.info
% to create a pair of files ('100sm.mat', '100sm.info') that can be read
% by this function.
%
% The files needed by this function can also be produced by the
% PhysioBank ATM, at
% http://physionet.org/cgi-bin/ATM %
% plotATM.m O. Abdala 16 March 2009
% James Hislop 27 January 2014 version 1.1
function h = plotATM(Name)
if nargin == 0
Name = '055m';
end
%读取数据
infoName = strcat(Name, '.info');
matName = strcat(Name, '.mat');
Octave = exist('OCTAVE_VERSION');
load(matName);
fid = fopen(infoName, 'rt');
fgetl(fid);
fgetl(fid);
fgetl(fid);
[freqint] = sscanf(fgetl(fid), 'Sampling frequency: %f Hz Sampling interval: %f sec');
interval = freqint(2);
fgetl(fid);
if(Octave)
for i = 1:size(val, 1)
R = strsplit(fgetl(fid), char(9));
signal{i} = R{2};
gain(i) = str2num(R{3});
base(i) = str2num(R{4});
units{i} = R{5};
end
else
for i = 1:size(val, 1)
[row(i), signal(i), gain(i), base(i), units(i)]=strread(fgetl(fid),'%d%s%f%f%s','delimiter','\t');
end
fclose(fid);
%数据处理
val(val==-32768) = NaN;
for i = 1:size(val, 1)
val(i, :) = (val(i, :) - base(i)) / gain(i);
end
x = (1:size(val, 2)) * interval;
plot(x', val');
for i = 1:length(signal)
labels{i} = strcat(signal{i}, ' (', units{i}, ')');
end
if length(signal) == 1
legend(labels{1});
else
legend(labels);
end
xlabel('Time (sec)');
xlim([min(x) max(x)]); % 设置横坐标
end
% grid on
4.附处理后图片,我选择的是055.
数据下载步骤:
1.通过PhysioBank ATM对MIMIC数据库进行访问(网址:https://physionet.org/cgi-bin/atm/ATM)。在DataBase中选择MIMIC DateBase(mimicdb),如下如图所示:
2.选中后下载相关文件即可:
3.用matlab打开plotATM.m的文件,修改文件名。
% usage: plotATM('RECORDm')
%
% This function reads a pair of files (RECORDm.mat and RECORDm.info) generated
% by 'wfdb2mat' from a PhysioBank record, baseline-corrects and scales the time
% series contained in the .mat file, and plots them. The baseline-corrected
% and scaled time series are the rows of matrix 'val', and each
% column contains simultaneous samples of each time series.
%
% 'wfdb2mat' is part of the open-source WFDB Software Package available at
% http://physionet.org/physiotools/wfdb.shtml % If you have installed a working copy of 'wfdb2mat', run a shell command
% such as
% wfdb2mat -r 100s -f 0 -t 10 >100sm.info
% to create a pair of files ('100sm.mat', '100sm.info') that can be read
% by this function.
%
% The files needed by this function can also be produced by the
% PhysioBank ATM, at
% http://physionet.org/cgi-bin/ATM %
% plotATM.m O. Abdala 16 March 2009
% James Hislop 27 January 2014 version 1.1
function h = plotATM(Name)
if nargin == 0
Name = '055m';
end
%读取数据
infoName = strcat(Name, '.info');
matName = strcat(Name, '.mat');
Octave = exist('OCTAVE_VERSION');
load(matName);
fid = fopen(infoName, 'rt');
fgetl(fid);
fgetl(fid);
fgetl(fid);
[freqint] = sscanf(fgetl(fid), 'Sampling frequency: %f Hz Sampling interval: %f sec');
interval = freqint(2);
fgetl(fid);
if(Octave)
for i = 1:size(val, 1)
R = strsplit(fgetl(fid), char(9));
signal{i} = R{2};
gain(i) = str2num(R{3});
base(i) = str2num(R{4});
units{i} = R{5};
end
else
for i = 1:size(val, 1)
[row(i), signal(i), gain(i), base(i), units(i)]=strread(fgetl(fid),'%d%s%f%f%s','delimiter','\t');
end
fclose(fid);
%数据处理
val(val==-32768) = NaN;
for i = 1:size(val, 1)
val(i, :) = (val(i, :) - base(i)) / gain(i);
end
x = (1:size(val, 2)) * interval;
plot(x', val');
for i = 1:length(signal)
labels{i} = strcat(signal{i}, ' (', units{i}, ')');
end
if length(signal) == 1
legend(labels{1});
else
legend(labels);
end
xlabel('Time (sec)');
xlim([min(x) max(x)]); % 设置横坐标
end
% grid on
4.附处理后图片,我选择的是055.
相关文章推荐
- 用matlab实时读取串口数据并动态显示曲线
- Matlab读取点云数据 + 显示
- matlab读取串口数据并显示曲线
- matlab读取一维数组数据,并显示直方图分布,不同分段显示不同颜色
- MATLAB读取和显示obj文件的数据
- MATLAB数据文件读取
- matlab 函数或者GUI从工作空间读取参数数据
- C#从数据库中读取二进制数据,并显示图片
- 从数据库中读取二进制数据,并显示图片
- Android 读取后台数据并显示。模拟小区车辆管理系统
- 串口数据的读取与显示
- WPF使用---数据读取显示GridView
- docker部署node及mongodb,node.js读取mongodb数据以Web显示给用户
- matlab中如何读取TXT数据文件 (续)
- 三轴力传感器数据在MATLAB中实时显示
- 从网络读取数据并动态的显示在ListView中
- Linux下用C语言读取Matlab的.mat数据及Cmakelists的相关配置
- 批量读取文件夹下的DR8光谱数据,并完成显示保存图片以及统计Z和Obj的分布情况
- matlab中数据类型及图像显示