天天看點

matlab讀取hea,MIMIC資料庫中資料的下載下傳以及MATLAB讀取

一、MIMIC資料庫介紹

MIMIC資料庫是美國麻省理工提供的一個對公衆開放的多參數重症監護資料庫,裡面提供了諸如心電信号(ECG)、光電容積脈搏波信号(Pleth)、動脈血壓信号(ABP)和呼吸信号(RESP)等從ICU病房中采集的生理資料。改資料庫經過多個學科10多年的建設,目前已被成功運用于ICU臨床資料挖掘的多個研究領域。

MIMIC中所有的資料資源經過嚴格的去處身份資訊處理後,對全球研究人員免費開放,可以通過生理資料資源網站PhysioNet(http://physionet.org/)通路。詳細的資料庫介紹資訊可以從網址得到:https://www.physionet.org/physiobank/database/mimicdb/

二、MIMIC資料庫的下載下傳

通過PhysioBank ATM對MIMIC資料庫進行通路(網址:https://physionet.org/cgi-bin/atm/ATM)。在DataBase中選擇MIMIC Database(mimicdb),如下如圖所示:

matlab讀取hea,MIMIC資料庫中資料的下載下傳以及MATLAB讀取

選擇相應的Record樣本(如055),以及輸出時長 Output Length(如10 sec),在Toolbox中選擇 Export signal as .mat,會有如下四個檔案可供下載下傳。其中.mat檔案中存儲信号資料、.info檔案存儲各路信号名字以及相應的其他資訊、.hea檔案是在相應軟體中讀取.mat檔案所需要的資料檔案,plotATM.m為所提供的用于從.mat和.info中讀取資料的matlab代碼,通過調用如plotATM('055m')即可從中讀取資料。

matlab讀取hea,MIMIC資料庫中資料的下載下傳以及MATLAB讀取
matlab讀取hea,MIMIC資料庫中資料的下載下傳以及MATLAB讀取

需要注意的:資料庫中ECG采樣率為500Hz,而PLETH和ABP等資料采用率為125Hz,而生成的.mat資料中,統一為125Hz,即将每路資料每4個取一次平均作為最後的資料。

matlab讀取hea,MIMIC資料庫中資料的下載下傳以及MATLAB讀取

plotATM.m代碼如下:

function plotATM(Name)

% 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. Abdala16 March 2009

% James Hislop 27 January 2014version 1.1

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

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

legend(labels);

xlabel('Time (sec)');

% grid on

end