Skip to content
Snippets Groups Projects
Commit 74c97f24 authored by ac_fx's avatar ac_fx
Browse files

SSF clipLimits

parent ae780dd7
No related branches found
No related tags found
No related merge requests found
......@@ -27,9 +27,8 @@ end
xClasses = unique(classList);
nKeep = 0;
clipRange = [2.5,97.5];
% clipRange = [0.5,99.5];
clipLimits = SSF.getClipLimits(flist,targetChannels,clipRange,nKeep);
clipLimits = SSF.getClipLimits(flist,targetChannels,nKeep);
xyim = []; % one per flist
xticks = [];
......@@ -40,7 +39,7 @@ for cc = 1:length(xClasses)
clf;imCC = {};
for ff = 1:length(flistCC)
fname = fullfile(flistCC(ff).folder,flistCC(ff).name);
imq = SSF.draw_ssf_kymo(fname,targetChannels,clipLimits,nKeep);
imq = SSF.draw_ssf_kymo(fname,targetChannels,clipLimits{ff},nKeep);
szim(ff,:) = size(imq);
imq(:,1) = 0; imq(:,end) = 0;
imq(1:2,:) = 0; imq(end-1:end,:) = 0;
......@@ -79,6 +78,14 @@ for cc = 1:length(xClasses)
plot([x,x+szim(ff,2)],[y,y],'-k');
plot([x,x+szim(ff,2)],[y+szim(ff,1),y+szim(ff,1)],'-k');
plot([x,x],[y,y+szim(ff,1)],'-k')
tPulseOn = regexp(flistCC(ff).name,'(\d)hNoPulse','tokens');
tPulseOn = str2double(tPulseOn{1}{1});
tPulseOff = regexp(flistCC(ff).name,'(\d)hPulse','tokens');
tPulseOff = tPulseOn + str2double(tPulseOff{1}{1});
plot([x+12*tPulseOn,x+12*tPulseOn], [y,y+szim(ff,1)], ':r')
plot([x+12*tPulseOff,x+12*tPulseOff], [y,y+szim(ff,1)], ':k')
% don't draw to your right...
% plot([x+szim(ff,2),x+szim(ff,2)],[y,y+szim(ff,1)],'-k')
text(x,y,ccLabels{ff},'Interpreter','none','FontSize',6,'BackgroundColor',[0.9,0.5,0.7,0.5],...
......@@ -117,8 +124,10 @@ for cc = 1:length(xClasses)
fx = strfind(flist(ff).name,'.LEVER');
fx = fx(1)-1;
% title(xClasses{cc},'Interpreter','none');
tick_labels = round(linspace(clipLimits(1),clipLimits(2),5),2,'significant');
cb = colorbar('Ticks',[1,64,128,192,255],'TickLabels',tick_labels);
c1 = clipLimits{1};
tick_targets = [1,64,128,192,254];
tick_labels = round(c1(tick_targets),2,'significant');
cb = colorbar('Ticks',tick_targets,'TickLabels',tick_labels);
cb.Label.String = cbLabel;
if 1 == cc
exportgraphics(gcf,outfile);
......
% nKeep : 0 -- return whole kymo. 1 return +. -1 return -.
function imq = draw_ssf_kymo(strKymoFile, targetChannels, clipLimits, nKeep)
if ~exist('nKeep','var')
nKeep = 0;
end
imKymo = SSF.loadImage(strKymoFile,targetChannels);
if nKeep>0
imKymo(imKymo<0) = 0;
......
......@@ -51,6 +51,6 @@ if ~isempty(idxWT)
classUnique{idxWT} = 'WILD TYPE';
end
legend(hx(find(hx)),classUnique(find(hx)),'interpreter','none');
tstr = ['CSF^6_{Erk} = ' mat2str([csf_mean, csf_std],2)];
tstr = ['CSF^6_{Erk} = ' jsonencode(round([csf_mean,csf_std],2,'significant'))];
title(tstr)
% map [-1,1] kymographs to color space [0,255]
%
function clipLimits = getClipLimits(flist,targetChannelNumbers,clipRange,nKeep,tClip)
function clipLimits = getClipLimits(flist,targetChannelNumbers,nKeep,tClip)
if ~exist('clipRange','var')
clipRange= [2.5,97.5];
end
if ~exist('nKeep','var')
nKeep = 0;
end
......@@ -28,25 +25,14 @@ parfor ff=1:length(flist)
end
px = im_ff(find(im_ff));
kymoPixels{ff} = px;
% 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
end
% kymoPixels = vertcat(kymoPixels{:});
% clipLimits = prctile(kymoPixels,100.*[1/255:1/255:1-1/255]);
% 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
kymoPixels = vertcat(kymoPixels{:});
cl = [mean(kymoPixels)-std(kymoPixels), mean(kymoPixels)+std(kymoPixels)];
q1 = length(find(kymoPixels<cl(1)))./length(kymoPixels);
q2 = 1 - length(find(kymoPixels>cl(2)))./length(kymoPixels);
pxTarget = linspace(q1,q2,254);
clipLimits = quantile(kymoPixels,pxTarget);
clipLimits = repmat({clipLimits},length(flist),1);
4;
......@@ -4,18 +4,13 @@
% AKT_CHANNEL = 2;
% H2B_CHANNEL = 3;
% targetChannels = [ERK_CHANNEL,AKT_CHANNEL];
function d=go_ssf_ncd(kROOT,targetChannels,clipRange, nKeep, tClip)
function d=go_ssf_ncd(kROOT,targetChannels, clipLimits, nKeep, tClip)
tStart = tic();
if ~exist('nKeep','var')
nKeep = 0;
end
if ~exist('clipRange','var')
clipRange = [2.5,97.5];
end
if ~exist('tClip','var')
tClip = [];
end
......@@ -29,10 +24,8 @@ kymoPixels = {};
p = ljsStartParallel();
%
if iscell(clipRange)
clipLimits = clipRange;
else
clipLimits = SSF.getClipLimits(flist,targetChannels,clipRange,nKeep,tClip);
if ~exist('clipLimits','var')
clipLimits = SSF.getClipLimits(flist,targetChannels,nKeep,tClip);
end
%
cmdList = NCD.dParallelCommandList(ones(length(flist)),p.NumWorkers);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment