Skip to content
Snippets Groups Projects
Commit 8aff3893 authored by ac's avatar ac
Browse files

quantizePair, stupid eigenvector

parent e8f906fe
Branches
No related tags found
No related merge requests found
......@@ -67,8 +67,7 @@ L=D^(-.5)*A*D^(-.5);
L=Cluster.Regularize(L); % remove the miniscule asymmetry from L
[eVec eVal]=eig(L);
% ACK CONTROVERSY! WHY STUPID \lambda=1 vector?
% X=[eVec(:,end) eVec(:,1:k-1)];
% eg PCA: first k eigenvectors == optimal embedding
X=[eVec(:,1:k)];
if 1 == k
Y = X ./ max(X);
......
......@@ -3,7 +3,7 @@
% package to cell array by t and then pass to in memory FLI%F compressor
function ncd = ncd_ssf_volume(i1,i2)
[i1,i2] = RSF.quantizePair(i1,i2);
[i1,i2] = NCD.quantizePair(i1,i2);
im12 = NCD.catKymographs(i1,i2,1);
im12 = squeeze(num2cell(im12,[1,2,4]));
......
% clip image pairs and quantize, per channel (x,y,z,c)
function [i1q,i2q] = quantizePair(i1,i2,clipLimits)
if isa(i1,'uint8') && isa(i2,'uint8')
return
end
if ~exist('clipLimits','var')
clipLimits = [0,100];
end
if size(i1,4) ~= size(i2,4)
fprintf(2,'WARNING : quantizePair : input images of different color channel dimension\n');
end
for c = 1 : size(i1,4)
ic1 = i1(:,:,:,c); ic2 = i2(:,:,:,c);
pix = [ic1(find(ic1));ic2(find(ic2))];
cl = prctile(pix,clipLimits);
i1q(:,:,:,c) = applyClip(ic1,cl);
i2q(:,:,:,c) = applyClip(ic2,cl);
end
4;
function im = applyClip(im,clipLimits)
im_in = im; % remember the zeros!
im = max(im,clipLimits(1));
im = min(im,clipLimits(end));
im = (im - clipLimits(1)) ./ (clipLimits(end) - clipLimits(1));
im = uint8(254 * im + 1); % 8 bit quantization [0,1]->[1,255]
im(0 == im_in) = 0;
4;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment