-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleuvenLabelsVisualInspection.m
81 lines (66 loc) · 2.64 KB
/
leuvenLabelsVisualInspection.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
% Visual inspection for Leuven annotations
clear
addpath(genpath('lib'));
addpath(genpath('dataset'));
set(0,'defaultAxesFontName', 'Helvetica');
set(0,'defaultTextFontName', 'Helvetica');
set(0,'defaulttextInterpreter','latex')
set(0,'defaultLegendInterpreter','latex');
set(0,'defaultAxesFontSize', 20);
set(0,'defaultTextFontSize', 20);
set(0, 'defaultFigureRenderer', 'painters')
% Load signals
subjectNumber = '02'; % CVHR events: 2, 5, 6, 8, 10...
load(['results/labels/UZLeuven0' subjectNumber '_labels.mat'])
load(['results/signals/UZLeuven0' subjectNumber '_psg.mat'])
% Plots
figure;
ax(1) = subplot(411);
hold on
for kk=1:size(apneas,1)
p(1) = patch([apneas(kk, 1) apneas(kk, 2) apneas(kk, 2) apneas(kk, 1)],[-6 -6 15 15],[1 0 0],'FaceAlpha',.3,'EdgeColor','none');
end; clear kk
for kk=1:size(hypopneas,1)
p(2) = patch([hypopneas(kk, 1) hypopneas(kk, 2) hypopneas(kk, 2) hypopneas(kk, 1)],[-6 -6 15 15],[0 0 1],'FaceAlpha',.3,'EdgeColor','none');
end; clear kk
plot(tNasalPressure,nasalPressureProcessed)
plot(tNasalPressure,medfilt1(tidalVolume,180*nasalPressureFs)+5,'k--');
plot(tNasalPressure,tidalVolume+5);
yline(5)
ylabel('Nasal pressure')
axis tight;
ax(2) = subplot(412);
plot(tSpo2,spo2Processed,'b'); axis tight;
hold on
for kk=1:size(apneas,1)
p(1) = patch([apneas(kk, 1) apneas(kk, 2) apneas(kk, 2) apneas(kk, 1)],[80 80 100 100],[1 0 0],'FaceAlpha',.3,'EdgeColor','none');
end; clear kk
for kk=1:size(hypopneas,1)
p(2) = patch([hypopneas(kk, 1) hypopneas(kk, 2) hypopneas(kk, 2) hypopneas(kk, 1)],[80 80 100 100],[0 0 1],'FaceAlpha',.3,'EdgeColor','none');
end; clear kk
ylabel('SpO2')
legend(p,'Apnea','Hypopnea','Location','southeast'); clear p
ax(3) = subplot(413);
plot(tAbdBelt,ripSum,'b'); axis tight;
hold on
for kk=1:size(apneas,1)
p(1) = patch([apneas(kk, 1) apneas(kk, 2) apneas(kk, 2) apneas(kk, 1)],[-10 -10 10 10],[1 0 0],'FaceAlpha',.3,'EdgeColor','none');
end; clear kk
for kk=1:size(hypopneas,1)
p(2) = patch([hypopneas(kk, 1) hypopneas(kk, 2) hypopneas(kk, 2) hypopneas(kk, 1)],[-10 -10 10 10],[0 0 1],'FaceAlpha',.3,'EdgeColor','none');
end; clear kk
ylabel('RIPsum')
ax(4) = subplot(414);
p = plot(tHypno,hypno,'b'); axis tight;
hold on
for kk=1:size(apneas,1)
p(1) = patch([apneas(kk, 1) apneas(kk, 2) apneas(kk, 2) apneas(kk, 1)],[0 0 6 6],[1 0 0],'FaceAlpha',.3,'EdgeColor','none');
end; clear kk
for kk=1:size(hypopneas,1)
p(2) = patch([hypopneas(kk, 1) hypopneas(kk, 2) hypopneas(kk, 2) hypopneas(kk, 1)],[0 0 6 6],[0 0 1],'FaceAlpha',.3,'EdgeColor','none');
end; clear kk
xlabel('Time (seconds)');
ylabel('Hypnogram')
yticks(1:5);
yticklabels({'NREM3','NREM2','NREM1','REM','WAKE'})
linkaxes(ax,'x'); clear ax