Skip to content
Snippets Groups Projects
Commit 204defad authored by ac_fx's avatar ac_fx
Browse files

SSF equiprobable quantization

parent 612a9740
Branches
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@ if ~exist('tClip','var')
end
p = ljsStartParallel();
kymoPixels = {};
clipLimits = {};
parfor ff=1:length(flist)
kp = {};
for c = 1:length(targetChannelNumbers)
......@@ -25,22 +26,27 @@ parfor ff=1:length(flist)
im_ff(im_ff>0)=0;
im_ff = abs(im_ff);
end
kp{c} = im_ff(find(im_ff));
kymoPixels{ff} = kp;
end
end
kymoPixels = vertcat(kymoPixels{:});
px = im_ff(find(im_ff));
kymoPixels{ff} = px;
clipLimits = [];
for c = 1:size(kymoPixels,2)
% anything other than [0,1] gets set to the corresponding percentile
idx = find(clipRange);
if ~isempty(idx)
px = kymoPixels{:,c};
clipLimits(c,idx) = [prctile(px,clipRange(idx))];
% clipLimits{ff} = [mean(px)-std(px),mean(px)+std(px)]; %prctile(kp{c},[0.5,99.5]);
clipLimits{ff} = prctile(px,100.*[1/255:1/255:1-1/255]);
end
clipLimits(c,find(clipRange==0)) = 0;
end
% kymoPixels = vertcat(kymoPixels{:});
% clipLimits = prctile(kymoPixels,100.*[1/255:1/255:1-1/255]);
4;
\ No newline at end of file
% clipLimits = [];
% for c = 1:size(kymoPixels,2)
% % anything other than [0,1] gets set to the corresponding percentile
% idx = find(clipRange);
% if ~isempty(idx)
% px = kymoPixels{:,c};
% clipLimits(c,idx) = [mean(px)-std(px),mean(px)+std(px)]; %[prctile(px,clipRange(idx))];
% end
% clipLimits(c,find(clipRange==0)) = 0;
% end
%
%
% 4;
\ No newline at end of file
......@@ -5,11 +5,15 @@ im = im_in;
if isa(im,'uint8')
return
end
for c = 1:size(im,4)
im(:,:,:,c) = max(im(:,:,:,c),clipLimits(c,1));
im(:,:,:,c) = min(im(:,:,:,c),clipLimits(c,2));
im(:,:,:,c) = (im(:,:,:,c) - clipLimits(c,1)) ./ (clipLimits(c,2) - clipLimits(c,1));
end
im = im2uint8(im);
im = uint8(imquantize(im,clipLimits));
%
% for c = 1:size(im,4)
% im(:,:,:,c) = max(im(:,:,:,c),clipLimits(c,1));
% im(:,:,:,c) = min(im(:,:,:,c),clipLimits(c,2));
% im(:,:,:,c) = (im(:,:,:,c) - clipLimits(c,1)) ./ (clipLimits(c,2) - clipLimits(c,1));
% end
% im = im2uint8(im);
im = max(im,1);
im(0 == im_in) = 0;
\ 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