-
Notifications
You must be signed in to change notification settings - Fork 2
/
PlotRadon.m
99 lines (94 loc) · 2.78 KB
/
PlotRadon.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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plot data, radon transform, and trajectories
%
% Arguments:
% fignum (int)
% data (struct)
% radout (struct)
% peak (struct)
% p_out (struct)
% trough (struct): optional
% t_out (struct): optional
% logscale (bool): optional, default false
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function PlotRadon(fignum, data, radout, peak, p_out, trough, t_out, logscale)
if fignum > 0
figure(fignum)
clf
end
if ~exist('logscale', 'var')
logscale = false;
end
trough_mode = exist('trough','var') && exist('t_out','var') ...
&& ~isempty(trough) && ~isempty(t_out);
blue = [0, 0.4470, 0.7410];
oran = [0.8500, 0.3250, 0.0980];
tiledlayout(3, 5, 'TileSpacing', 'tight', 'Padding', 'compact');
nexttile(1, [2, 2])
if ~isfield(data, 'mask')
imagesc(data.tMsec, data.xMm, data.data)
else
imagesc(data.tMsec, data.xMm, data.data, 'AlphaData', data.mask+0.5)
end
hold on
plot(p_out.times, data.xMm, 'k', 'LineWidth', 2)
if trough_mode
plot(t_out.times, data.xMm, 'w', 'LineWidth', 2)
end
xlabel('Time (ms)');
ylabel('Lateral (mm)');
colorbar
if ~trough_mode
title(sprintf('Speed = %.2f m/s', p_out.speed))
else
title(sprintf('Peak=%.2f m/s , Trough=%.2f m/s', p_out.speed, t_out.speed))
end
nexttile(3, [2, 2])
radout.theta = flip(radout.theta);
radout.txfm = fliplr(radout.txfm);
speed_list = data.dxdt .* cotd(radout.theta);
h = pcolor(speed_list, radout.rp, radout.txfm);
set(h, 'EdgeColor', 'none')
hold on
plot(p_out.speed, peak.rad_pos, '.k', 'MarkerSize', 12)
if trough_mode
plot(t_out.speed, trough.rad_pos, '.w', 'MarkerSize', 12)
end
title('Radon Transform')
ylabel('Radial Position')
xlabel('Speed (m/s)')
set(gca, 'YDir', 'reverse')
set(gca, 'YAxisLocation', 'right')
if logscale
set(gca, 'XScale', 'log')
end
nexttile(5, [2, 1])
max_line = max(radout.txfm, [], 2);
plot(max_line, radout.rp, 'Color',blue,'LineWidth',1)
hold on
plot([min(max_line), peak.max_val], [1,1].*peak.rad_pos, ':','Color',blue,'LineWidth',1.5)
if trough_mode
min_line = min(radout.txfm, [], 2);
plot(min_line, radout.rp, 'Color',oran,'LineWidth',1)
plot([-trough.max_val, max(min_line)], [1,1].*trough.rad_pos, ':','Color',oran,'LineWidth',1.5)
end
xlabel('Max Value')
ylim(radout.rp([1,end]))
set(gca, 'YDir', 'reverse')
nexttile(13, [1, 2])
max_line = max(radout.txfm, [], 1);
plot(speed_list, max_line,'Color',blue,'LineWidth',1)
hold on
plot([1,1].*p_out.speed, [min(max_line), peak.max_val], ':','Color',blue,'LineWidth',1.5)
if trough_mode
min_line = min(radout.txfm, [], 1);
plot(speed_list, min_line, 'Color',oran,'LineWidth',1)
plot([1,1].*t_out.speed, [-trough.max_val, max(min_line)], ':','Color',oran,'LineWidth',1.5)
end
ylabel('Max Value')
xlim(speed_list([1,end]))
set(gca, 'XAxisLocation', 'top')
if logscale
set(gca, 'XScale', 'log')
end
end