-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInvestigate_Layer_Variance.m
75 lines (58 loc) · 2.14 KB
/
Investigate_Layer_Variance.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
%% Investigation of layer thickness variation
% Load patient information
Cirrus_OCT_pathlist;
nPatients = length(pathlist);
nSurfaces = 11; %number of surfaces generated by the segmentation algo
nLayers = 10; %number of layer thicknesses
%% Load the surface coordinates for all patients
surfaces=cell(nPatients);
for iPatient = 1:nPatients
folder = fullfile(basepath,pathlist{iPatient});
surfaces{iPatient} = loadPatientSurfaces(folder);
end
%% Convert surface coordinates into layer thickness
layers=cell(nPatients);
for iPatient = 1:nPatients
layers{iPatient} = calcLayerThickness(surfaces{iPatient});
end
%% Calculate the thickness variance for each layer
% each column in layer variance is a patient, each row a layer
layerVariance = nan(10,nPatients);
for iPatient = 1:nPatients
tmpPatient = layers{iPatient};
for iLayer = 1:nLayers
tmpLayer = tmpPatient(:,:,iLayer);
layerVariance(iLayer,iPatient) = var(tmpLayer(:));
end
end
%% Plot the data
layerLabs= {'NFL','GCL','IPL','INL','OPL','ONL','IS','OS','RPE','Choroid'};
figure;
for iLayer = 1:9
subplot(3,3,iLayer);
boxplot(layerVariance(iLayer,:),patGroups, ...
'labels',{'Diabetic','Control'});
%set(gca, 'OuterPosition', [0 0 0.5 .95]) % Shrink the plot a little
title(layerLabs{iLayer});
end
%Add a main title
ha = axes('Position',[0 0 1 1],'Xlim',[0 1],'Ylim',[0
1],'Box','off','Visible','off','Units','normalized', 'clipping' , 'off');
text(0.5, 1,'\bf Variance of retinal layer thicknesses',...
'HorizontalAlignment','center','VerticalAlignment', 'top')
figure;
iPlot=0;
for iLayer=[2,3,4]
iPlot=iPlot+1;
subplot(1,3,iPlot);
boxplot(layerVariance(iLayer,:),patGroups, ...
'labels',{'Diabetic','Control'});
%set(gca, 'OuterPosition', [0 0 0.5 .95]) % Shrink the plot a little
title(layerLabs{iLayer});
ylabel('Variance');
end
%Add a main title
ha = axes('Position',[0 0 1 1],'Xlim',[0 1],'Ylim',[0
1],'Box','off','Visible','off','Units','normalized', 'clipping' , 'off');
text(0.5, 1,'\bf Variance of retinal layer thicknesses',...
'HorizontalAlignment','center','VerticalAlignment', 'top')