-
Notifications
You must be signed in to change notification settings - Fork 2
/
e03_x_seeMaps.m
105 lines (85 loc) · 2.19 KB
/
e03_x_seeMaps.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
clearvars
addpath('./mfiles')
refName = 'refY'; % Choices: 'refY', 'refWS', 'refP'
% Depends on choice used in e03_5
% Patient of Interest - Which patient to process?
PoI = 1;
%% Get the reference region properties
refProp = SimProperties(refName);
ktRR = refProp.KtRR;
veRR = refProp.veRR;
kepRR = refProp.kepRR;
%% Load Data
dirLocation = DefaultFolders();
llDir = fullfile(dirLocation.qin,['MapsLL-' refName]);
matFiles = dir([llDir '/*.mat']);
q=PoI;
curFile = matFiles(q).name;
llFile = fullfile(llDir, curFile);
load(llFile)
%% Re-arrange Tofts Model map
pkParamsT = pkParamsLT;
pkParamsT(:,3) = pkParamsT(:,2);
pkParamsT(:,2) = pkParamsT(:,1)./pkParamsT(:,3);
%% Get KTrans
ktLL = ktRR*pkParamsLL(:,1);
ktCL = ktRR*pkParamsCL(:,1);
ktT = pkParamsT(:,1);
%% Get Ve
veLL = veRR*pkParamsLL(:,2);
veCL = veRR*pkParamsCL(:,2);
veT = pkParamsT(:,2);
%% Get Kep
kepLL = pkParamsLL(:,3);
kepCL = pkParamsCL(:,3);
kepT = pkParamsT(:,3);
%% Get Mask
nZ = size(mask,2);
mask = reshape(mask,[320 320 nZ]);
%% Make the maps
% Initialize matrices
imKtLL = zeros(size(mask));
imKtCL = imKtLL;
imKtT = imKtLL;
imKepLL = imKtLL;
imKepCL = imKtLL;
imKepT = imKtLL;
imVeLL = imKtLL;
imVeCL = imKtLL;
imVeT = imKtLL;
% KTrans
imKtLL(mask>0) = ktLL;
imKtCL(mask>0) = ktCL;
imKtT(mask>0) = ktT;
% kep
imKepLL(mask>0) = kepLL;
imKepCL(mask>0) = kepCL;
imKepT(mask>0) = kepT;
% ve
imVeLL(mask>0) = veLL;
imVeCL(mask>0) = veCL;
imVeT(mask>0) = veT;
% Reshape the maps into 3D
imKtLL = reshape(imKtLL,[320 320 nZ]);
imKtCL = reshape(imKtCL,[320 320 nZ]);
imKtT = reshape(imKtT,[320 320 nZ]);
imKepLL = reshape(imKepLL,[320 320 nZ]);
imKepCL = reshape(imKepCL,[320 320 nZ]);
imKepT = reshape(imKepT,[320 320 nZ]);
imVeLL = reshape(imVeLL,[320 320 nZ]);
imVeCL = reshape(imVeCL,[320 320 nZ]);
imVeT = reshape(imVeT,[320 320 nZ]);
% Crop the masks to focus on tumour region
mask = reshape(mask,[320 320 nZ]);
imKtLL = AutoCrop(imKtLL,mask);
imKtCL = AutoCrop(imKtCL,mask);
imKtT = AutoCrop(imKtT,mask);
imKepLL = AutoCrop(imKepLL,mask);
imKepCL = AutoCrop(imKepCL,mask);
imKepT = AutoCrop(imKepT,mask);
imVeLL = AutoCrop(imVeLL,mask);
imVeCL = AutoCrop(imVeCL,mask);
imVeT = AutoCrop(imVeT,mask);
return
%% Pick which map to show
showMe(imKepLL)