Select Git revision
getClipLimits.m
getClipLimits.m 980 B
% map [-1,1] kymographs to color space [0,255]
%
function clipLimits = getClipLimits(flist,targetChannelNumbers,nKeep,tClip)
if ~exist('nKeep','var')
nKeep = 0;
end
if ~exist('tClip','var')
tClip = [];
end
p = ljsStartParallel();
kymoPixels = {};
clipLimits = {};
parfor ff=1:length(flist)
kp = {};
for c = 1:length(targetChannelNumbers)
strDB_ff = fullfile(flist(ff).folder,flist(ff).name);
im_ff = SSF.loadImage(strDB_ff,targetChannelNumbers(c), 0, tClip);
if nKeep>0
im_ff(im_ff<0)=0;
end
if nKeep<0
im_ff(im_ff>0)=0;
im_ff = abs(im_ff);
end
px = im_ff(find(im_ff));
kymoPixels{ff} = px;
end
end
kymoPixels = vertcat(kymoPixels{:});
clip_neg = SSF.getClipQuantiles(kymoPixels(kymoPixels<0),127);
clip_pos = SSF.getClipQuantiles(kymoPixels(kymoPixels>0),127);
clipLimits = [clip_neg,clip_pos];
clipLimits = repmat({clipLimits},length(flist),1);
4;