forked from richardedden/Gannet3.1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpecifyOnOffOrder.m
152 lines (126 loc) · 8.79 KB
/
SpecifyOnOffOrder.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
function MRS_struct = SpecifyOnOffOrder(MRS_struct)
% Determines the subexperiment order for MEGA-PRESS and HERMES.
%
% Author:
% Dr. Georg Oeltzschner (Johns Hopkins University, 2018-02-24)
%
% History:
% 2018-02-24: First version.
% 2018-11-19: Second version.
% [1 = ON, 0 = OFF]
switch MRS_struct.p.ONOFForder
case 'onfirst'
if MRS_struct.p.HERMES
switch MRS_struct.p.vendor
case 'GE'
if all(ismember(MRS_struct.p.target,{'GABAGlx','GSH'})) || all(ismember(MRS_struct.p.target,{'GABA','GSH'})) || all(ismember(MRS_struct.p.target,{'Glx','GSH'}))
% 1=ExpA, 2=ExpB, 3=ExpC, 4=ExpD (MM: 171120)
MRS_struct.fids.ON_OFF = repmat([1 1 0 0; 1 0 1 0], [1 size(MRS_struct.fids.data,2)/4]);
elseif all(ismember(MRS_struct.p.target,{'GSH','Lac'}))
MRS_struct.fids.ON_OFF = repmat([0 1 1 0; 0 1 0 1], [1 size(MRS_struct.fids.data,2)/4]);
end
case 'Philips'
if ~MRS_struct.p.HERCULES
if all(ismember(MRS_struct.p.target,{'GABAGlx','GSH'})) || all(ismember(MRS_struct.p.target,{'GABA','GSH'})) || all(ismember(MRS_struct.p.target,{'Glx','GSH'}))
% 1=ExpC, 2=ExpB, 3=ExpA, 4=ExpD
MRS_struct.fids.ON_OFF = repmat([0 1 1 0; 1 0 1 0], [1 size(MRS_struct.fids.data,2)/4]);
elseif all(ismember(MRS_struct.p.target,{'GSH','Lac'}))
% 1=ExpC, 2=ExpB, 3=ExpA, 4=ExpD
MRS_struct.fids.ON_OFF = repmat([0 1 1 0; 1 0 1 0], [1 size(MRS_struct.fids.data,2)/4]);
end
else
% 1=ExpC, 2=ExpD, 3=ExpA, 4=ExpB
MRS_struct.fids.ON_OFF = repmat([0 0 1 1; 1 0 1 0], [1 size(MRS_struct.fids.data,2)/4]);
end
case 'Siemens_twix'
if ~MRS_struct.p.HERCULES
if all(ismember(MRS_struct.p.target,{'GABAGlx','GSH'})) || all(ismember(MRS_struct.p.target,{'GABA','GSH'})) || all(ismember(MRS_struct.p.target,{'Glx','GSH'}))
% 1=ExpB, 2=ExpD, 3=ExpC, 4=ExpA (MM: 181210)
MRS_struct.fids.ON_OFF = repmat([1 0 0 1; 0 0 1 1], [1 size(MRS_struct.fids.data,2)/4]);
elseif all(ismember(MRS_struct.p.target,{'GSH','Lac'}))
% This has not been tested with universal sequence -- 03142018 MGSaleh
MRS_struct.fids.ON_OFF = repmat([0 1 1 0; 1 1 0 0], [1 size(MRS_struct.fids.data,2)/4]);
elseif all(ismember(MRS_struct.p.target,{'EtOH','GABA','GSH'}))
% 1=A, 2=D, 3=B, 4=?
MRS_struct.fids.ON_OFF = repmat([1 0 1 0; 1 0 0 1; 0 0 1 1], [1 size(MRS_struct.fids.data,2)/4]);
end
else
% 1=ExpA, 2=ExpB, 3=ExpC, 4=ExpD
MRS_struct.fids.ON_OFF = repmat([1 1 0 0; 1 0 1 0], [1 size(MRS_struct.fids.data,2)/4]);
end
end
else % MEGA-PRESS
if strcmpi(MRS_struct.p.vendor,'Philips') && strcmpi(MRS_struct.p.seqorig,'Philips')
MRS_struct.fids.ON_OFF = [ones(1,size(MRS_struct.fids.data,2)/2) zeros(1,size(MRS_struct.fids.data,2)/2)];
elseif strcmpi(MRS_struct.p.vendor,'Philips_data') % Hardcode for now. This repmat depends on the value entered for NSA
if ceil(MRS_struct.p.LarmorFreq(MRS_struct.ii)) > 290
MRS_struct.fids.ON_OFF = repmat([ones(1,(MRS_struct.p.Navg(MRS_struct.ii)/MRS_struct.p.nrows)) ...
zeros(1,(MRS_struct.p.Navg(MRS_struct.ii)/MRS_struct.p.nrows))], ...
[1 size(MRS_struct.fids.data,2)/((MRS_struct.p.Navg(MRS_struct.ii)/MRS_struct.p.nrows)*2)]); % GABA @ 7T % Changed by MGSaleh -- 2017
else
MRS_struct.fids.ON_OFF = repmat([1 1 0 0], [1 size(MRS_struct.fids.data,2)/4]);
%MRS_struct.fids.ON_OFF = repmat([1 0], [1 size(MRS_struct.fids.data,2)/2]); %This seems to work with the MR1 Philips_data
end
else
MRS_struct.fids.ON_OFF = repmat([1 0], [1 size(MRS_struct.fids.data,2)/2]);
end
end
case 'offfirst'
if MRS_struct.p.HERMES
switch MRS_struct.p.vendor
case 'GE'
if all(ismember(MRS_struct.p.target,{'GABAGlx','GSH'})) || all(ismember(MRS_struct.p.target,{'GABA','GSH'})) || all(ismember(MRS_struct.p.target,{'Glx','GSH'}))
% 1=ExpA, 2=ExpB, 3=ExpC, 4=ExpD (MM: 171120)
MRS_struct.fids.ON_OFF = repmat([1 1 0 0; 1 0 1 0], [1 size(MRS_struct.fids.data,2)/4]);
elseif all(ismember(MRS_struct.p.target,{'GSH','Lac'}))
MRS_struct.fids.ON_OFF = repmat([0 1 1 0; 0 1 0 1], [1 size(MRS_struct.fids.data,2)/4]);
end
case 'Philips'
if ~MRS_struct.p.HERCULES
if all(ismember(MRS_struct.p.target,{'GABAGlx','GSH'})) || all(ismember(MRS_struct.p.target,{'GABA','GSH'})) || all(ismember(MRS_struct.p.target,{'Glx','GSH'}))
% 1=ExpC, 2=ExpB, 3=ExpA, 4=ExpD
MRS_struct.fids.ON_OFF = repmat([0 1 1 0; 1 0 1 0], [1 size(MRS_struct.fids.data,2)/4]);
elseif all(ismember(MRS_struct.p.target,{'GSH','Lac'}))
MRS_struct.fids.ON_OFF = repmat([1 0 0 1; 1 0 1 0], [1 size(MRS_struct.fids.data,2)/4]);
end
else
% 1=ExpC, 2=ExpD, 3=ExpA, 4=ExpB
MRS_struct.fids.ON_OFF = repmat([0 0 1 1; 1 0 1 0], [1 size(MRS_struct.fids.data,2)/4]);
end
case 'Siemens_twix'
if ~MRS_struct.p.HERCULES
if all(ismember(MRS_struct.p.target,{'GABAGlx','GSH'})) || all(ismember(MRS_struct.p.target,{'GABA','GSH'})) || all(ismember(MRS_struct.p.target,{'Glx','GSH'}))
% 1=ExpB, 2=ExpD, 3=ExpC, 4=ExpA (MM: 181210)
MRS_struct.fids.ON_OFF = repmat([1 0 0 1; 0 0 1 1], [1 size(MRS_struct.fids.data,2)/4]);
elseif all(ismember(MRS_struct.p.target,{'GSH','Lac'}))
% This has not been tested with universal sequence -- 03142018 MGSaleh
MRS_struct.fids.ON_OFF = repmat([0 1 1 0], [1 size(MRS_struct.fids.data,2)/4]); % GSH
MRS_struct.fids.ON_OFF2 = repmat([0 1 0 1], [1 size(MRS_struct.fids.data,2)/4]); % Lac
elseif all(ismember(MRS_struct.p.target,{'EtOH','GABA','GSH'}))
% 1=?, 2=?, 3=?, 4=?
MRS_struct.fids.ON_OFF = repmat([1 0 1 0; 1 0 0 1; 0 0 1 1], [1 size(MRS_struct.fids.data,2)/4]);
end
else
% 1=ExpA, 2=ExpB, 3=ExpC, 4=ExpD
MRS_struct.fids.ON_OFF = repmat([1 1 0 0; 1 0 1 0], [1 size(MRS_struct.fids.data,2)/4]);
end
end
else % MEGA-PRESS
if strcmpi(MRS_struct.p.vendor,'Philips') && strcmpi(MRS_struct.p.seqorig,'Philips')
MRS_struct.fids.ON_OFF = [zeros(1,size(MRS_struct.fids.data,2)/2) ones(1,size(MRS_struct.fids.data,2)/2)];
elseif strcmpi(MRS_struct.p.vendor,'Philips_data') % Hardcode for now. This repmat depends on the value entered for NSA
if ceil(MRS_struct.p.LarmorFreq(MRS_struct.ii)) > 290
MRS_struct.fids.ON_OFF = repmat([zeros(1,(MRS_struct.p.Navg(MRS_struct.ii)/MRS_struct.p.nrows)) ...
ones(1,(MRS_struct.p.Navg(MRS_struct.ii)/MRS_struct.p.nrows))], ...
[1 size(MRS_struct.fids.data,2)/((MRS_struct.p.Navg(MRS_struct.ii)/MRS_struct.p.nrows)*2)]); % GABA @ 7T % Changed by MGSaleh -- 2017
else
%MRS_struct.fids.ON_OFF = repmat([0 0 1 1], [1 size(MRS_struct.fids.data,2)/4]);
MRS_struct.fids.ON_OFF = repmat([0 1], [1 size(MRS_struct.fids.data,2)/2]);
end
else
MRS_struct.fids.ON_OFF = repmat([0 1], [1 size(MRS_struct.fids.data,2)/2]);
end
end
end
end