-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtbx_scfg_ParEx.m
154 lines (138 loc) · 5.78 KB
/
tbx_scfg_ParEx.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
function ParEx = tbx_scfg_ParEx
% MATLABBATCH sub-configuration file.
% Extracting parameters from the segmented images
%__________________________________________________________________________
% Copyright (C) 2015 Cyclotron Research Centre
% ---------------------------------------------------------------------
% imgMPM Structural quantitative images
% ---------------------------------------------------------------------
imgMPM = cfg_files;
imgMPM.tag = 'imgMPM';
imgMPM.name = 'Structural quantitative images';
imgMPM.help = {'Select the structural quantitative (MPM-VBQ) images.'};
imgMPM.filter = 'image';
imgMPM.ufilter = '.*';
imgMPM.num = [1 Inf];
% ---------------------------------------------------------------------
% imgMPMmsk Mask of excluded voxels from structural quantitative images
% ---------------------------------------------------------------------
imgMPMmsk = cfg_files;
imgMPMmsk.tag = 'imgMPMmsk';
imgMPMmsk.name = 'Mask of excluded voxels from MPMs';
imgMPMmsk.help = {'Select the "msk_MPM" images.'};
imgMPMmsk.filter = 'image';
imgMPMmsk.ufilter = '.*';
imgMPMmsk.num = [0 Inf];
imgMPMmsk.val = {''};
% ---------------------------------------------------------------------
% cImg Tissue class images
% ---------------------------------------------------------------------
cImg = cfg_files;
cImg.tag = 'cImg';
cImg.name = 'Tissue class images';
cImg.help = {'Select the tissue classes of GM/WM/CSF/Lesion'};
cImg.filter = 'image';
cImg.ufilter = '^c.*';
cImg.num = [3 4];
% ---------------------------------------------------------------------
% imgMsk Mask image
% ---------------------------------------------------------------------
imgMsk = cfg_files;
imgMsk.tag = 'imgMsk';
imgMsk.name = 'Mask image';
imgMsk.help = {'Select the "lesiosn mask" image.'};
imgMsk.filter = 'image';
imgMsk.ufilter = '.*';
imgMsk.num = [0 1];
%--------------------------------------------------------------------------
% outdir Output Directory
%--------------------------------------------------------------------------
outdir = cfg_files;
outdir.tag = 'outdir';
outdir.name = 'Output Directory';
outdir.val{1} = {''};
outdir.help = {'File produced will be written into this output directory. If no directory is given, file will be written to directory of MPM images.'};
outdir.filter = 'dir';
outdir.ufilter = '.*';
outdir.num = [0 1];
%--------------------------------------------------------------------------
% thrICV Threshold for ICV definition
%--------------------------------------------------------------------------
thrICV = cfg_entry;
thrICV.tag = 'thrICV';
thrICV.name = 'Threshold for ICV definition';
thrICV.help = {'Threshold for ICV definition'};
thrICV.strtype = 'r';
thrICV.num = [1 1];
thrICV.val = {.5};
%--------------------------------------------------------------------------
% thrLesion Threshold for Lesion volume
%--------------------------------------------------------------------------
thrLesion = cfg_entry;
thrLesion.tag = 'thrLesion';
thrLesion.name = 'Threshold for Lesion volume';
thrLesion.help = {'Threshold to estimate the lesion volume'};
thrLesion.strtype = 'r';
thrLesion.num = [1 1];
thrLesion.val = {.8};
%--------------------------------------------------------------------------
% thrTC Threshold for tissue classes
%--------------------------------------------------------------------------
thrTC = cfg_entry;
thrTC.tag = 'thrTC';
thrTC.name = 'Threshold for tissue classes';
thrTC.help = {'Threshold for tissue classes, when extracting the MPM values'};
thrTC.strtype = 'r';
thrTC.num = [1 1];
thrTC.val = {.8};
% ---------------------------------------------------------------------
% opt Options
% ---------------------------------------------------------------------
opt = cfg_branch;
opt.tag = 'opt';
opt.name = 'Options';
opt.val = {thrICV thrLesion thrTC};
opt.help = {'Defining some thresholds for the parameters/values extraction'};
%_______________________________________________________________________
%% EXEC function
% ---------------------------------------------------------------------
% ParEx Unified segmentation with lesion mas
% ---------------------------------------------------------------------
ParEx = cfg_exbranch;
ParEx.tag = 'ParEx';
ParEx.name = 'Parameter extraction for the GM/WM/lesion';
ParEx.val = {imgMPM imgMPMmsk cImg imgMsk outdir opt};
ParEx.help = {['Extracting some parameters from the MPMs over the ',...
'GM/WM/lesion tissue classes.'],...
'See the processing function itself for the details of what''s computed.'};
ParEx.prog = @crc_ExtractParam;
ParEx.vout = @vout_ExtractParam;
ParEx.check = @imgMPMmsk_check;
end
%% OUTPUT function
%_______________________________________________________________________
function dep = vout_ExtractParam(job) %#ok<*INUSD>
dep = cfg_dep;
dep.sname = 'Extracted Parameters Mat_file';
dep.src_output = substruct('.','fn_ExParam');
dep.tgt_spec = cfg_findspec({{'filter','mat'}});
end
%_______________________________________________________________________
%% CHECK function
%_______________________________________________________________________
function t = imgMPMmsk_check(job)
t = {};
if ~isempty(job.imgMPM) && ~isempty(job.imgMPMmsk)
% Check that numbers do match.
Nimg = numel(job.imgMPM);
Nmsk = numel(job.imgMPMmsk);
if Nimg~=Nmsk
t = {sprintf('Num MPM images (%d) ~= Num Msk images (%d)', Nimg,Nmsk)};
end
end
% for i=1:numel(sess.regress)
% if numel(sess.scans) ~= numel(sess.regress(i).val)
% t = {t{:}, sprintf('Num scans (%d) ~= Num regress[%d] (%d).',numel(sess.scans),i,numel(sess.regress(i).val))};
% end
% end
end