% find_sampling
% reverse engineering sampling pattern for in-vivo study

if ~isvar('s1')
	s1 = imread('ramani-11-pmi-fig3b.jpg')';
	s1 = 255 - s1;
	im(s1)
end

if ~isvar('s3')
	s2 = s1(14:(end-19),12:(end-22));
	s2 = single(s2) / 255.;
	plot(mean(s2,1), '.')
	%hist(s1(:),0:2:255)
	pr '[size(s2,2)/size(s2,1) 256/144 144/128]'
	im(s2)
	%im(s2(1:50,1:50))

	[n1 n2] = size(s2);
	up = 5;
	s3 = interp2(s2', 0.5+[0:(n1*up-1)]'/up, 0.5+[0:(n2*up-1)]/up)';
	im(s3)
end
	s3(isnan(s3)) = 0;

im plc 1 2
im(1, s3(1:100,1:100))

h = s3(30:56,74:98);
im(2, h)
h = h / norm(h(:));

s4 = conv2(s3, h, 'same');

clf
im(s4)

plot(s4(:,20:40))
im(s4 > 11)
