/
CheckTargets.m
48 lines (39 loc) · 1.5 KB
/
CheckTargets.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
function CheckTargets(MRS_struct)
switch num2str(length(MRS_struct.p.target))
case '1'
if any(strcmp(MRS_struct.p.target,{'GABA','Glx','GABAGlx','GSH','Lac','EtOH'}))
if MRS_struct.p.phantom && strcmp(MRS_struct.p.target,'GABAGlx')
PassError;
end
if MRS_struct.p.HERMES
error('MRS_struct.p.HERMES is set to 1 in GannetPreInitialise.m. Add a second target metabolite or set flag to 0');
end
else
PassError;
end
case '2'
if any([all(strcmp(MRS_struct.p.target,{'GABAGlx','GSH'})) ...
all(strcmp(MRS_struct.p.target,{'GABA','GSH'})) ...
all(strcmp(MRS_struct.p.target,{'Lac','GSH'}))])
if MRS_struct.p.phantom && any(strcmp(MRS_struct.p.target,'GABAGlx'))
PassError;
end
if ~MRS_struct.p.HERMES
error('Two target metabolites detected. MRS_struct.p.HERMES must be set to 1 in GannetPreInitialise.m.');
end
else
PassError
end
case '3'
if all(strcmp(MRS_struct.p.target,{'EtOH','GABA','GSH'}))
if ~MRS_struct.p.HERMES
error('Three target metabolites detected. MRS_struct.p.HERMES must be set to 1 in GannetPreInitialise.m.');
end
else
PassError;
end
end
end
function PassError
error('Incorrect targets entered in GannetPreInitialise.m. Check spelling/allowable options.');
end