forked from JaneliaSciComp/tmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_l75_rounded.m
67 lines (55 loc) · 1.67 KB
/
test_l75_rounded.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
% generate the full colormap
n=100;
x=linspace(0,1-1/n,n)';
l75_border_srgb=l75_border_of_theta(2*pi*(x-0.5)');
l75_border_lab=srgb2lab(l75_border_srgb);
% plot it in lab space
figure;
plot(l75_border_lab(:,2),l75_border_lab(:,3),'b.');
axis square;
xlim([-150,+150]);
ylim([-150,+150]);
% load in the rounded data
l75_rounded_srgb=load_tabular_data('l75_rounded_srgb.txt')';
l75_rounded_lab=srgb2lab(l75_rounded_srgb);
% plot it
hold on;
plot(l75_rounded_lab(:,2),l75_rounded_lab(:,3),'r.');
plot(l75_rounded_lab(1,2),l75_rounded_lab(1,3),'k.');
% make the rounded ring perceptually uniform
n=size(l75_rounded_lab,1);
[l75_rounded_lab_resamp,phase_resamp]=make_uniform(l75_rounded_lab,256);
% plot it
plot(l75_rounded_lab_resamp(:,2),l75_rounded_lab_resamp(:,3),'g.');
% make a colormap of it
cmap=max(0,min(1,lab2srgb(l75_rounded_lab_resamp)));
% show it
figure;
colormap(cmap);
colorbar;
colorbar_axes_h=findobj(gcf,'Tag','Colorbar');
colorbar_image_h=findobj(colorbar_axes_h,'Tag','TMW_COLORBAR');
set(colorbar_image_h,'YData',[-180 +180]);
set(colorbar_axes_h,'YLim',[-180 +180]);
set(colorbar_axes_h,'YTick',[-180 -90 0 +90 +180]);
% show the colormap a prettier way
theta=(-pi:pi/100:+pi)';
theta=repmat(theta,[1 2]);
r=repmat([0.8 1],[size(theta,1) 1]);
im_index=round(255*(((theta/pi)+1)/2))+1;
im_rgb=ind2rgb(im_index,cmap);
x=r.*cos(theta);
y=r.*sin(theta);
figure;
polar_grid_simple;
hold on;
surf(x,y,zeros(size(x)),...
im_rgb,...
'EdgeColor','none');
hold off;
text(0,0,'l75_rounded',...
'interpreter','none',...
'horizontalalignment','center',...
'verticalalignment','middle');
% this doesn't seem to make much difference -- think I'm going to
% punt on this one