-
Notifications
You must be signed in to change notification settings - Fork 13
/
CheckTargets.m
61 lines (55 loc) · 2.58 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
46
47
48
49
50
51
52
53
54
55
56
57
58
function CheckTargets(MRS_struct)
filepath = fullfile(fileparts(which(mfilename('fullpath'))), 'GannetPreInitialise.m');
msg = 'Incorrect targets entered in GannetPreInitialise.m. Check spelling, allowable options, and order of targets.';
msg = hyperlink(['matlab: opentoline(''' filepath ''', 4, 0)'], 'Incorrect targets entered in GannetPreInitialise.m', msg);
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')
fprintf('\n');
error(msg);
end
if MRS_struct.p.HERMES
msg = 'MRS_struct.p.HERMES is set to 1 in GannetPreInitialise.m. Add a second target metabolite or set flag to 0.';
msg = hyperlink(['matlab: opentoline(''' filepath ''', 4, 0)'], 'Add a second target metabolite', msg);
msg = hyperlink(['matlab: opentoline(''' filepath ''', 33, 0)'], 'set flag to 0', msg);
fprintf('\n');
error(msg);
end
else
fprintf('\n');
error(msg);
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, {'Glx', 'GSH'})) ...
all(strcmp(MRS_struct.p.target, {'Lac', 'GSH'}))])
if MRS_struct.p.phantom && any(strcmp(MRS_struct.p.target, 'GABAGlx'))
fprintf('\n');
error(msg);
end
if ~MRS_struct.p.HERMES
msg = 'Two target metabolites detected. MRS_struct.p.HERMES must be set to 1 in GannetPreInitialise.m.';
msg = hyperlink(['matlab: opentoline(''' filepath ''', 33, 0)'], 'MRS_struct.p.HERMES must be set to 1', msg);
fprintf('\n');
error(msg);
end
else
fprintf('\n');
error(msg);
end
case '3'
if all(strcmp(MRS_struct.p.target, {'EtOH', 'GABA', 'GSH'}))
if ~MRS_struct.p.HERMES
msg = 'Three target metabolites detected. MRS_struct.p.HERMES must be set to 1 in GannetPreInitialise.m.';
msg = hyperlink(['matlab: opentoline(''' filepath ''', 33, 0)'], 'MRS_struct.p.HERMES must be set to 1', msg);
fprintf('\n');
error(msg);
end
else
fprintf('\n');
error(msg);
end
end
end