Commit 8c1a36bb authored by actb's avatar actb

added sensitivity param, updated cellboundaryefficiency to use adaptthresh

parent 3ca99164
......@@ -15,7 +15,13 @@ else
se=strel('disk',3);
end
imBG=imerode(im,se);
if isfield(segParams,'sensitivity')
sensitivity=segParams.sensitivity;
else
sensitivity=0.5;
end
T=adaptthresh(im,sensitivity,'NeighborhoodSize',4*floor(size(im)/16)+1,'statistic','gaussian');
T=imdilate(T,se);
for i=1:length(Cells)
if is3D(im)
verts=round(Cells(i).verts);
......@@ -26,8 +32,8 @@ for i=1:length(Cells)
idx=sub2ind(size(im),Cells(i).surface(:,2),Cells(i).surface(:,1));
end
idx(isnan(idx))=[];
imBGmu=mean(imBG(idx));
minFG=graythresh(im)*segParams.alpha(1);
imBGmu=median(imBG(idx));
minFG=max(T(idx));
imBGeff=1-imBGmu/minFG; %
imBGeff=min(imBGeff,1);
......
......@@ -8,13 +8,9 @@ segParams.wellRadius=-1;
segParams.useCuda=true;
segParams.nCores=feature('numcores'); % for ensemble seg only
segParams.storeEnsemble=true;
segParams.alpha=1.0;
segParams.sensitivity=0.5;
segParams.denoise=true;
segParams.bCytoplasmic=false;
segParams.bCircular=false;
segParams.brightLevels=-1;
segParams.clonalMotionComp=false;
% advanced params
%
% NLM: h,search_window_radius,neighborhood_radius,high_pass_filter
segParams.NLM=[0.1,12,1,false];
......@@ -5,6 +5,12 @@ function [bw,bwLog]=thresholdImagess(im,imLog,segParams, min_radius_pixels,min_a
imLog(imLog<0)=0;
imLog=mat2gray(imLog);
if isfield(segParams,'sensitivity')
sensitivity=segParams.sensitivity;
else
sensitivity=0.5;
end
if is3D(im)
nsz=2*floor(size(im)/16)+1;
......@@ -12,7 +18,7 @@ if is3D(im)
bwLog=imbinarize(imLog,T);
bwLog=bwareaopen(bwLog,4*min_area_pixels);
T=adaptthresh(im,0.4,'NeighborhoodSize',nsz,'statistic','gaussian');
T=adaptthresh(im,sensitivity,'NeighborhoodSize',nsz,'statistic','gaussian');
bw=imbinarize(im,T);
bw=bwareaopen(bw,min_area_pixels);
return;
......@@ -28,9 +34,9 @@ if segParams.isPhase
se=strel('disk',1);
se2=strel('disk',ceil(min_radius_pixels));
if segParams.isPhase>0
T=adaptthresh(im,0.5,'foregroundpolarity','dark','statistic','gaussian');
T=adaptthresh(im,sensitivity,'foregroundpolarity','dark','statistic','gaussian');
else
T=adaptthresh(im,0.5,'foregroundpolarity','bright','statistic','gaussian');
T=adaptthresh(im,sensitivity,'foregroundpolarity','bright','statistic','gaussian');
end
bw=imbinarize(im,T);
if segParams.isPhase>0
......@@ -49,7 +55,7 @@ if segParams.isPhase
bw=imfill(bw,'holes');
else
% use 2x the default nhood size
T=adaptthresh(im,0.5,'NeighborhoodSize',4*floor(size(im)/16)+1,'statistic','gaussian');
T=adaptthresh(im,sensitivity,'NeighborhoodSize',4*floor(size(im)/16)+1,'statistic','gaussian');
bw=imbinarize(im,T);
end
bw=bwareaopen(bw,min_area_pixels);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment