-
Notifications
You must be signed in to change notification settings - Fork 2
/
b03_mainSimFigures.m
278 lines (243 loc) · 7.5 KB
/
b03_mainSimFigures.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
addpath('./mfiles')
clearvars
load('./data/simMap.mat');
load('./data/simResults.mat');
%%
[nVox nP nRep nRes nSig] = size(params.CERRM);
pkCE = reshape(params.CERRM,[nVox 5 nRep*nRes*nSig]);
pkET = reshape(params.ETM,[nVox 3 nRep*nRes*nSig]);
pkCE = permute(pkCE,[1 3 2]);
pkET = permute(pkET,[1 3 2]);
%%
rrKt = repmat(estKtRR(:),[1 nVox])';
rrKep = repmat(estKepRRS(:),[1 nVox])';
rrVe = rrKt./rrKep;
%%
errKtCE = PercentError(pkCE(:,:,1).*rrKt,trueKt(:));
errVeCE = PercentError(pkCE(:,:,2).*rrVe,trueVe(:));
errVpCE = PercentError(pkCE(:,:,4).*rrKt,trueVp(:));
errKtET = PercentError(pkET(:,:,1),trueKt(:));
errVeET = PercentError(pkET(:,:,1)./pkET(:,:,2),trueVe(:));
errVpET = PercentError(pkET(:,:,3),trueVp(:));
%%
errKtCE = reshape(errKtCE,[nVox*nRep nRes nSig]);
errVeCE = reshape(errVeCE,[nVox*nRep nRes nSig]);
errVpCE = reshape(errVpCE,[nVox*nRep nRes nSig]);
errKtET = reshape(errKtET,[nVox*nRep nRes nSig]);
errVeET = reshape(errVeET,[nVox*nRep nRes nSig]);
errVpET = reshape(errVpET,[nVox*nRep nRes nSig]);
%%
errKepRR = PercentError(reshape(estKepRRS,[nRep nRes*nSig]),kepRR);
errKtRR = PercentError(reshape(estKtRR,[nRep nRes*nSig]),ktRR);
errVeRR = PercentError(reshape(estKtRR./estKepRRS,[nRep nRes*nSig]),veRR);
errKepRRD = PercentError(reshape(estKepRRS,[nRep nRes*nSig]),kepRR);
errKtRRD = PercentError(reshape(estKtRRD,[nRep nRes*nSig]),ktRR);
errVeRRD = PercentError(reshape(estKtRRD./estKepRRS,[nRep nRes*nSig]),veRR);
errKepRR = reshape(errKepRR,[nRep nRes nSig]);
errKtRR = reshape(errKtRR,[nRep nRes nSig]);
errVeRR = reshape(errVeRR,[nRep nRes nSig]);
errKepRRD = reshape(errKepRRD,[nRep nRes nSig]);
errKtRRD = reshape(errKtRRD,[nRep nRes nSig]);
errVeRRD = reshape(errVeRRD,[nRep nRes nSig]);
%%
errKtCE = shiftdim(errKtCE,1);
errVeCE = shiftdim(errVeCE,1);
errVpCE = shiftdim(errVpCE,1);
errKtET = shiftdim(errKtET,1);
errVeET = shiftdim(errVeET,1);
errVpET = shiftdim(errVpET,1);
errKepRR = shiftdim(errKepRR,1);
errKtRR = shiftdim(errKtRR,1);
errVeRR = shiftdim(errVeRR,1);
errKepRRD = shiftdim(errKepRRD,1);
errKtRRD = shiftdim(errKtRRD,1);
errVeRRD = shiftdim(errVeRRD,1);
%% Median/IQR RR
cSize = 10;
iList = 1:4;
myColours = [0.000, 0.408, 0.216;...
0.192, 0.640, 0.329;...
0.471, 0.777, 0.474;...
0.761, 0.902, 0.600];
figure('Position',[300,300,1600,400]);
subplot(1,3,1); hold on;
curErr = errKepRR;
errQt = quantile(curErr,[.25 .75],3);
errMd = median(curErr,3);
for i=iList
errorbar(listSigmaC,errMd(i,:),abs(errQt(i,:,1)-errMd(i,:)),abs(errQt(i,:,2)-errMd(i,:)),'linewidth',2,'CapSize',cSize, 'color',myColours(i,:));
end
ylim([-35 5])
set(gca,'XTick',[0:0.01:0.05])
title('kepRR')
xlabel('Noise [mM]')
ylabel('Percent Error')
customizeFig(gca);
subplot(1,3,2); hold on;
curErr = errKtRR;
errQt = quantile(curErr,[.25 .75],3);
errMd = median(curErr,3);
for i=iList
errorbar(listSigmaC,errMd(i,:),abs(errQt(i,:,1)-errMd(i,:)),abs(errQt(i,:,2)-errMd(i,:)),'linewidth',2,'CapSize',cSize,'color',myColours(i,:));
end
ylim([-35 5])
set(gca,'XTick',[0:0.01:0.05])
title('ktransRR')
xlabel('Noise [mM]')
customizeFig(gca);
subplot(1,3,3); hold on;
curErr = errVeRR;
errQt = quantile(curErr,[.25 .75],3);
errMd = median(curErr,3);
for i=iList
errorbar(listSigmaC,errMd(i,:),abs(errQt(i,:,1)-errMd(i,:)),abs(errQt(i,:,2)-errMd(i,:)),'linewidth',2,'CapSize',cSize,'color',myColours(i,:));
end
ylim([-35 5])
set(gca,'XTick',[0:0.01:0.05])
title('veRR')
xlabel('Noise [mM]')
legend({num2str(TRes(iList(1))),num2str(TRes(iList(2))),num2str(TRes(iList(3))),num2str(TRes(iList(4)))},'location','southeast')
legend boxoff
customizeFig(gca);
%% Median/IQR for TOI
cSize = 10;
iList = 1:4;
myColours = [0.145, 0.204, 0.580;...
0.172, 0.498, 0.722;...
0.255, 0.714, 0.769;...
0.631, 0.855, 0.706];
figure('Position',[300,300,1500,400]);
subplot(1,3,1); hold on;
curErr = errKtCE;
errQt = quantile(curErr,[.25 .75],3);
errMd = median(curErr,3);
for i=iList
errorbar(listSigmaC,errMd(i,:),abs(errQt(i,:,1)-errMd(i,:)),abs(errQt(i,:,2)-errMd(i,:)),'linewidth',2,'CapSize',cSize,'color',myColours(i,:));
end
ylim([-50 50])
set(gca,'XTick',[0:0.01:0.05])
title('ktrans')
xlabel('Noise [mM]')
ylabel('Percent Error')
legend({num2str(TRes(iList(1))),num2str(TRes(iList(2))),num2str(TRes(iList(3))),num2str(TRes(iList(4)))},'location','southeast')
legend boxoff
subplot(1,3,2); hold on;
curErr = errVeCE;
errQt = quantile(curErr,[.25 .75],3);
errMd = median(curErr,3);
for i=iList
errorbar(listSigmaC,errMd(i,:),abs(errQt(i,:,1)-errMd(i,:)),abs(errQt(i,:,2)-errMd(i,:)),'linewidth',2,'CapSize',cSize,'color',myColours(i,:));
end
ylim([-50 50])
set(gca,'XTick',[0:0.01:0.05])
title('ve')
xlabel('Noise [mM]')
subplot(1,3,3); hold on;
curErr = errVpCE;
errQt = quantile(curErr,[.25 .75],3);
errMd = median(curErr,3);
for i=iList
errorbar(listSigmaC,errMd(i,:),abs(errQt(i,:,1)-errMd(i,:)),abs(errQt(i,:,2)-errMd(i,:)),'linewidth',2,'CapSize',cSize,'color',myColours(i,:));
end
ylim([-50 50])
set(gca,'XTick',[0:0.01:0.05])
title('vp')
xlabel('Noise [mM]')
%% IQR stats - RR
disp('Median err kepRR')
disp(median(errKepRR,3))
disp('Median err ktRR')
disp(median(errKtRR,3))
disp('Median err veRR')
disp(median(errVeRR,3))
disp('IQR err kepRR')
disp(iqr(errKepRR,3))
disp('IQR err ktRR')
disp(iqr(errKtRR,3))
disp('IQR err veRR')
disp(iqr(errVeRR,3))
%% IQR stats - TOI
disp('RRIFT ====================')
disp('Median err kt')
disp(median(errKtCE,3))
disp('Median err ve')
disp(median(errVeCE,3))
disp('Median err vp')
disp(median(errVpCE,3))
disp('IQR err kt')
disp(iqr(errKtCE,3))
disp('IQR err ve')
disp(iqr(errVeCE,3))
disp('IQR err vp')
disp(iqr(errVpCE,3))
%% IQR stats - TOI - ETM
disp('ETM ====================')
disp('Median err kt')
disp(median(errKtET,3))
disp('Median err ve')
disp(median(errVeET,3))
disp('Median err vp')
disp(median(errVpET,3))
disp('IQR err kt')
disp(iqr(errKtET,3))
disp('IQR err ve')
disp(iqr(errVeET,3))
disp('IQR err vp')
disp(iqr(errVpET,3))
%%
return
%% EXTRA - Run blocks with Ctrl+Enter
%%
disp('RRIFT - ETM ====================')
disp('Median err kt')
disp(abs(median(errKtCE,3)) - abs(median(errKtET,3)))
disp('Median err ve')
disp(abs(median(errVeCE,3)) - abs(median(errVeET,3)))
disp('Median err vp')
disp(abs(median(errVpCE,3)) - abs(median(errVpET,3)))
%%
disp('IQR err kt')
disp(iqr(errKtET,3))
disp('IQR err ve')
disp(iqr(errVeET,3))
disp('IQR err vp')
disp(iqr(errVpET,3))
%% [EXTRA] Median/IQR for TOI using ETM
cSize = 10;
figure('Position',[300,300,1500,400]);
subplot(1,3,1); hold on;
curErr = errKtET;
errQt = quantile(curErr,[.25 .75],3);
errMd = median(curErr,3);
for i=iList
errorbar(listSigmaC,errMd(i,:),abs(errQt(i,:,1)-errMd(i,:)),abs(errQt(i,:,2)-errMd(i,:)),'linewidth',2,'CapSize',cSize);
end
ylim([-50 50])
set(gca,'XTick',[0:0.01:0.05])
title('ktrans')
xlabel('Noise [mM]')
ylabel('Percent Error')
subplot(1,3,2); hold on;
curErr = errVeET;
errQt = quantile(curErr,[.25 .75],3);
errMd = median(curErr,3);
for i=iList
errorbar(listSigmaC,errMd(i,:),abs(errQt(i,:,1)-errMd(i,:)),abs(errQt(i,:,2)-errMd(i,:)),'linewidth',2,'CapSize',cSize);
end
ylim([-50 50])
set(gca,'XTick',[0:0.01:0.05])
title('ve')
xlabel('Noise [mM]')
subplot(1,3,3); hold on;
curErr = errVpET;
errQt = quantile(curErr,[.25 .75],3);
errMd = median(curErr,3);
for i=iList
errorbar(listSigmaC,errMd(i,:),abs(errQt(i,:,1)-errMd(i,:)),abs(errQt(i,:,2)-errMd(i,:)),'linewidth',2,'CapSize',cSize);
end
ylim([-50 50])
set(gca,'XTick',[0:0.01:0.05])
title('vp')
xlabel('Noise [mM]')
legend({num2str(TRes(iList(1))),num2str(TRes(iList(2))),num2str(TRes(iList(3))),num2str(TRes(iList(4)))},'location','southeast')
legend boxoff