forked from subangstrom/superAngle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
XY_display2_counts.m
170 lines (151 loc) · 5.26 KB
/
XY_display2_counts.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
function [ ] = XY_display2_counts( chk_print, A_map, B_map, ratio_map, tot_Det_num, angle_search, sample_para, search_Deg_2D, d_Deg_2D )
%Display 2D map for correction coefficient due to X-ray absorption and/or holder shadowing
%Weizong Xu, [email protected], April 2015
%check matlab version, if equal or newer than 2014a, use parula as colormap
%older version use jet as colormap
v_a = version('-release');
v_b = str2double(v_a(regexp(v_a,'\d')));
if (v_b>=2014)
maptype='parula';
else
maptype='jet';
end
if (sum(A_map(:))==0 && sum(B_map(:)) ==0)
return;
end
[ convert_factor_A,convert_factor_B, tempA,tempB ] = absolute_scale_factor( sample_para );
A_map_counts=A_map*convert_factor_A;
B_map_counts=B_map*convert_factor_B;
A_map_all=sum(A_map_counts,3);
B_map_all=sum(B_map_counts,3);
sym_A = get_element_name(sample_para(13),sample_para(14));
sym_B = get_element_name(sample_para(15),sample_para(16));
image_range=-search_Deg_2D:d_Deg_2D:search_Deg_2D;
for i=1:tot_Det_num
figure;
set(gca,'FontSize',15)
imagesc (image_range, -image_range, A_map_counts(:,:,i)), axis image;
title_name = ['Counts of ', sym_A, ' X-ray arriving at Detector ',num2str(i)];
title (title_name);
xlabel('Tilt X (degree)','FontSize',15)
ylabel('Tilt Y (degree)','FontSize',15)
axis xy;
h=colorbar;
set(h,'fontsize',15);
tot_solid_Angle=sum (angle_search(:,5,i)); %total solid angle
max_counts_A=tot_solid_Angle*convert_factor_A;
caxis([0,max_counts_A])
colormap (maptype);
hold on;
[C,h]=contour (image_range, -image_range, A_map_counts(:,:,i),'k');
clabel(C,h,'FontSize',20,'LabelSpacing',600);
hold off;
if (chk_print==1)
print(['map_2D_',title_name],'-dpng','-r300');
end
figure;
set(gca,'FontSize',15)
imagesc (image_range, -image_range, B_map_counts(:,:,i)), axis image;
title_name = ['Counts of ', sym_B, ' X-ray arriving at Detector ',num2str(i)];
title (title_name);
xlabel('Tilt X (degree)','FontSize',15)
ylabel('Tilt Y (degree)','FontSize',15)
axis xy;
h=colorbar;
set(h,'fontsize',15);
tot_solid_Angle=sum (angle_search(:,5,i)); %total solid angle
max_counts_B=tot_solid_Angle*convert_factor_B;
caxis([0,max_counts_B])
colormap (maptype);
hold on;
[C,h]=contour (image_range, -image_range, B_map_counts(:,:,i),'k');
clabel(C,h,'FontSize',20,'LabelSpacing',600);
hold off;
if (chk_print==1)
print(['map_2D_',title_name],'-dpng','-r300');
end
end
figure;
set(gca,'FontSize',15)
imagesc (image_range, -image_range, A_map_all), axis image;
title_name = ['Counts of ', sym_A, ' X-ray arriving at all detectors'];
title (title_name);
xlabel('Tilt X (degree)','FontSize',15)
ylabel('Tilt Y (degree)','FontSize',15)
axis xy;
h=colorbar;
set(h,'fontsize',15);
temp=sum(angle_search,3);
tot_solid_Angle=sum(temp(:,5)); %total solid angle
max_counts_A=tot_solid_Angle*convert_factor_A;
colormap (maptype);
hold on;
[C,h]=contour (image_range, -image_range, A_map_all,'k');
clabel(C,h,'FontSize',20,'LabelSpacing',600);
hold off;
if (chk_print==1)
print(['map_2D_',title_name],'-dpng','-r300');
end
figure;
set(gca,'FontSize',15)
imagesc (image_range, -image_range, B_map_all), axis image;
title_name = ['Counts of ', sym_B, ' X-ray arriving at all detectors'];
title (title_name);
xlabel('Tilt X (degree)','FontSize',15)
ylabel('Tilt Y (degree)','FontSize',15)
axis xy;
h=colorbar;
set(h,'fontsize',15);
temp=sum(angle_search,3);
tot_solid_Angle=sum(temp(:,5)); %total solid angle
max_counts_B=tot_solid_Angle*convert_factor_B;
colormap (maptype);
hold on;
[C,h]=contour (image_range, -image_range, B_map_all,'k');
clabel(C,h,'FontSize',20,'LabelSpacing',600);
hold off;
if (chk_print==1)
print(['map_2D_',title_name],'-dpng','-r300');
end
%figure
for i=1:tot_Det_num
figure;
set(gca,'FontSize',15)
imagesc (image_range, -image_range, A_map(:,:,i)./B_map(:,:,i)*convert_factor_A/convert_factor_B), axis image;
title_name = ['Calculated ', sym_A, ' vs ', sym_B, ' counts ratio at Detector ',num2str(i)];
title (title_name);
xlabel('Tilt X (degree)','FontSize',15)
ylabel('Tilt Y (degree)','FontSize',15)
axis xy;
h=colorbar;
set(h,'fontsize',15);
caxis([0,1*convert_factor_A/convert_factor_B])
colormap (maptype);
hold on;
[C,h]=contour (image_range, -image_range, A_map(:,:,i)./B_map(:,:,i)*convert_factor_A/convert_factor_B,'k');
clabel(C,h,'FontSize',20);
hold off;
if (chk_print==1)
print(['map_2D_',title_name],'-dpng','-r300');
end
end
figure
%imshow (ratio_map,[]);
set(gca,'FontSize',15)
imagesc (image_range, -image_range, ratio_map*convert_factor_A/convert_factor_B), axis image;
title_name =['Calculated ', sym_A, ' vs ', sym_B, ' counts ratio of all detectors'];
title (title_name);
xlabel('Tilt X (degree)','FontSize',15)
ylabel('Tilt Y (degree)','FontSize',15)
axis xy;
h=colorbar;
set(h,'fontsize',15);
colormap (maptype);
hold on;
[C,h]=contour (image_range, -image_range, ratio_map*convert_factor_A/convert_factor_B,'k');
clabel(C,h,'FontSize',20);
hold off;
if (chk_print==1)
print(['map_2D_',title_name],'-dpng','-r300');
end
end