-
Notifications
You must be signed in to change notification settings - Fork 2
/
c04_showResults_SinglePatient.m
137 lines (118 loc) · 3.43 KB
/
c04_showResults_SinglePatient.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
%% Description
% Loads maps from RRIFT and Extended Tofts Model
% Displays maps for a single patient at 3 slices
% Also plots the AIF/Muscle curve and RRIFT fit
% Estimated runtime: 1 second
%%
clearvars
fclose('all')
addpath('./mfiles')
tic
inDir = './data/TCGA-GBM-Results/c02_postprocessed';
matFiles = dir([inDir '/*.mat']);
idx = 7; % Chosen Patient (choices are between 1:9)
curFile = matFiles(idx).name;
load(fullfile(inDir,curFile));
% Remove unphysical values from ve and vp
mapVe(mapVe>1)=NaN;
mapVe(mapVe<0)=NaN;
mapVeR(mapVeR>1)=NaN;
mapVeR(mapVeR<0)=NaN;
mapVp(mapVp>1)=NaN;
mapVp(mapVp<0)=NaN;
mapVpR(mapVpR>1)=NaN;
mapVpR(mapVpR<0)=NaN;
%% Crop the image
mapKt = AutoCrop(mapKt);
mapKep = AutoCrop(mapKep);
mapVe = AutoCrop(mapVe);
mapVp = AutoCrop(mapVp);
mapKtR = AutoCrop(mapKtR);
mapKepR = AutoCrop(mapKepR);
mapVeR = AutoCrop(mapVeR);
mapVpR = AutoCrop(mapVpR);
%% Plot slices for P7
slices = [7,9,11];
nS = length(slices);
majula = jet(100);
% Ktrans
figure
clims = [0 0.16];
for i = 1:length(slices)
subplot(2,nS,i)
imagesc(mapKt(:,:,slices(i)));
caxis(clims); colormap(majula); set(gca,'XColor','none','YColor','none');
title('Ktrans-ETM')
subplot(2,nS,nS+i)
imagesc(mapKtR(:,:,slices(i)));
caxis(clims); colormap(majula); set(gca,'XColor','none','YColor','none');
title('Ktrans-RRIFT')
end
% ve
h=fspecial('disk',1);
mapVeF = mapVe;
mapVeFR = mapVeR;
mapVeF(~isfinite(mapVeF))=0;
mapVeFR(~isfinite(mapVeFR))=0;
mapVeF = imfilter(mapVeF,h);
mapVeFR = imfilter(mapVeFR,h);
figure
clims = [0 0.6];
for i = 1:length(slices)
subplot(2,nS,i)
imagesc(mapVeF(:,:,slices(i)));
caxis(clims); colormap(majula); set(gca,'XColor','none','YColor','none');
title('ve-ETM')
subplot(2,nS,nS+i)
imagesc(mapVeFR(:,:,slices(i)));
caxis(clims); colormap(majula); set(gca,'XColor','none','YColor','none');
title('ve-RRIFT')
end
% vp
figure
clims = [0 0.1];
for i = 1:length(slices)
subplot(2,nS,i)
imagesc(mapVp(:,:,slices(i)));
caxis(clims); colormap(majula); set(gca,'XColor','none','YColor','none');
title('vp-ETM')
subplot(2,nS,nS+i)
imagesc(mapVpR(:,:,slices(i)));
caxis(clims); colormap(majula); set(gca,'XColor','none','YColor','none');
title('vp-RRIFT')
end
%% Plot the Cp, Crr, and RRIFT fit for the patient
figure('Position',[300,300,1500,400])
subplot(1,3,1)
plot(t,Cp,'r','LineWidth',2)
customizeFig(gca);
xlim([0 7])
xlabel('Time [min]');
ylabel('Concentration [mM]')
title('Concentration in Blood Plasma')
subplot(1,3,2)
plot(t,Crr,'g','LineWidth',2)
xlim([0 7])
ylim([0 0.3])
customizeFig(gca);
xlabel('Time [min]');
ylabel('Concentration [mM]')
title('Concentration in Reference Region (Muscle)')
subplot(1,3,3)
scatter(denum,num,70,'r','LineWidth',2,'MarkerEdgeAlpha',.6)
hold on;
plot(denum,(denum\num)*denum,'-.k','LineWidth',2)
customizeFig(gca);
xlabel('Denominator')
ylabel('Numerator')
title('Example of RRIFT fit')
dummyh = line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none');
dummyh2 = line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none');
legend(dummyh, ['R^2: ' num2str(corr2(num, denum)^2)],'location','southeast')
legend boxoff
%% Display the estimates muscle parameters from RRIFT and from ETM fits
disp('Estimated muscle parameters from RRIFT [KtransRR veRR]:')
disp([estKtRR estVeRR])
disp('Estimates muscle parameters from ETM [KtransRR veRR vpRR]:')
disp([ETM.muscle(1) ETM.muscle(1)./ETM.muscle(2) ETM.muscle(3)]);
toc