-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuhfbold_plot_acq_duration_epi_spiral.m
207 lines (173 loc) · 5.98 KB
/
uhfbold_plot_acq_duration_epi_spiral.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
% Script uhfbold_plot_acq_duration_epi_spiral
% plots acquisition time dependence on trajectory, gradient system and
% undersampling for different resolutions
%
% uhfbold_plot_acq_duration_epi_spiral
%
%
% See also
% Author: Lars Kasper
% Created: 2022-01-10
% Copyright (C) 2022 BRAIN-TO Lab, Techna Institute, UHN Toronto, Canada
%
% Please see LICENSE file for how to use items in this repository.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% User Paramter settings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
doSavePlots = true;
% if true, plot spiral data with x-axis corresponding to Cartesian
% resolution equivalent (same k-space area rectangle/circle => dx_spiral =
% sqrt(pi/4)*dx_epi
useKspaceAreaEqualityForResolution = true;
idSubject = 'FEINBERGATRON'; % see ufbpld_create_epi_spiral_trajectories for other options
paths = uhfbold_get_paths(idSubject);
%from:
% save(fullfile(paths.export,'acqDurationEPISpiral_msArray'), ...
% 'acqDuration_msArray', 'maxGArray', 'maxSrArray', 'rPArray', 'dxMArray', ...
% 'iEpiTrajArray', 'iSpiralTrajArray', 'GmaxArray', 'SRmaxArray',
% 'resArray');
load(fullfile(paths.export, 'acqDurationEPISpiral_msArray.mat'));
if ~exist('GmaxArray', 'var')
GmaxArray = [40 80 100 200]*1e-3;
SRmaxArray = [200 200 1200 600];
end
% set(0, 'DefaultFigureWindowStyle', 'docked')
fhArray = [];
%% Plot EPI spiral durations for different gradient systems
stringLegend = {};
for idGradSystem = 1
Gmax = GmaxArray(idGradSystem);
SRmax = SRmaxArray(idGradSystem);
%% plot for EPIs
idxArrayTraj = iEpiTrajArray;
x = 1000*unique(dxMArray(idxArrayTraj));
y = [];
for R = 1:4
idxArray = intersect(find(rPArray(:)==R & maxGArray(:)==Gmax & maxSrArray(:)==SRmax), idxArrayTraj);
y(:,R) = acqDuration_msArray(idxArray);
stringLegend{R} = sprintf('EPI R = %d', R);
end
y = y(end:-1:1,:); % highest resolution first
% set up figure
fh = figure;
set(fh, 'DefaultAxesFontsize', 16);
hp = plot(x,y);
set(hp, 'LineWidth', 2);
ylim([0 200]);
xlabel('Resolution (mm)');
ylabel('Readout duration (ms)');
grid on
%% Spiral
idxArrayTraj = iSpiralTrajArray;
x2 = 1000*unique(dxMArray(idxArrayTraj));
y2 = [];
for R = 1:4
idxArray = intersect(find(rPArray(:)==R & maxGArray(:)==Gmax & maxSrArray(:)==SRmax), idxArrayTraj);
y2(:,R) = acqDuration_msArray(idxArray); % highest resolution first
stringLegend{R+4} = sprintf('Spiral R = %d', R);
end
y2 = y2(end:-1:1,:); % highest resolution first
hold on;
if useKspaceAreaEqualityForResolution
hp2 = plot(x,y2);
else
hp2 = plot(x2,y2);
end
set(hp2, 'LineWidth', 2, 'LineStyle', '--');
for R = 1:4
hp2(R).Color = hp(R).Color;
end
legend(stringLegend);
stringTitle = sprintf('G_{max} = %2.0f mT/m, SR_{max} = %4.0f mT/m/ms', Gmax*1000, SRmax);
title(stringTitle)
set(fh, 'Name', ['Readout Durations Gradient ' stringTitle]);
fhArray(idGradSystem) = fh;
end
%% Plot Summary EPI/Spiral R=1 &4 for all gradient systems
gradSystemPlotArray = [2 4 5];%[1 2 4 5];
RPlotArray = [1 4];
trajPlotArray = [1 2];
trajPlotNames = {'EPI', 'Spiral'};
gradSystemNames = {
'Standard Whole Body Gradient', ...
'Performance Whole Body Gradient', 'Commercial (Synaptive) Head Gradient', ...
'Performance Head Gradient (max slew rate)', ...
'Performance Head Gradient (max gradient)'
};
colorArray = [
0 0.4470 0.7410
0 0 0
0.9290 0.6940 0.1250
0 0.4470 0.7410
0.8500 0.3250 0.0980
0.3010 0.7450 0.9330
0.6350 0.0780 0.1840
];
lineStyleArray = {
'-'
'--'
};
markerArray = {
'none'
'd'
'+'
'x'
'o'
};
iPlot = 0;
% set up figure
fh = figure;
set(fh, 'DefaultAxesFontsize', 16);
clear x y x2 hp stringLegend
for idGradSystem = gradSystemPlotArray
for R = RPlotArray
for idTraj = trajPlotArray
iPlot = iPlot+1;
Gmax = GmaxArray(idGradSystem);
SRmax = SRmaxArray(idGradSystem);
switch idTraj
case 1
idxArrayTraj = iEpiTrajArray;
case 2
idxArrayTraj = iSpiralTrajArray;
end
if useKspaceAreaEqualityForResolution
x(:,iPlot) = 1000*unique(dxMArray(iEpiTrajArray));
else
x(:,iPlot) = 1000*unique(dxMArray(idxArrayTraj));
end
idxArray = intersect(find(rPArray(:)==R & maxGArray(:)==Gmax & maxSrArray(:)==SRmax), idxArrayTraj);
y(:,iPlot) = fliplr(acqDuration_msArray(idxArray)); % highest resolution first
switch idTraj
case 1
stringLegend{iPlot} = sprintf('%s', ...
trajPlotNames{idTraj})
case 2
stringLegend{iPlot} = sprintf('%s R = %d (Gradient %3d / %4d)', ...
trajPlotNames{idTraj}, R, ...
1000*Gmax, SRmax);
end
hp(iPlot) = plot(x(:,iPlot),y(:,iPlot));
hp(iPlot).Marker = markerArray{R};
hp(iPlot).MarkerSize = 12;
hp(iPlot).Color = colorArray(idGradSystem,:);
hp(iPlot).LineStyle = lineStyleArray{idTraj};
hold on;
end
end
end
set(hp, 'LineWidth', 2);
ylim([0 200]);
xlabel('Resolution (mm)');
ylabel('Readout duration (ms)');
grid on
legend([hp(1:2:end), hp(2:2:end)], stringLegend([1:2:end, 2:2:end]), 'NumColumns', 2);
stringTitle = sprintf('Single Plane EPI/Spiral Duration on Different Gradient Systems');
title(stringTitle)
set(fh, 'Name', ['Readout Durations ' stringTitle]);
fh.Position = [680 357 927 741];
fhArray(end+1) = fh;
%% save Plots
if doSavePlots
save_plot_publication(fhArray, paths.figures, [1]);
end