Commit 2a519e86 authored by ac32's avatar ac32

thresholdImages sensitivity>1 use multithresh

parent c82440fa
......@@ -20,8 +20,13 @@ if isfield(segParams,'sensitivity')
else
sensitivity=0.5;
end
T=adaptthresh(im,sensitivity,'NeighborhoodSize',4*floor(size(im)/16)+1,'statistic','gaussian');
T=imdilate(T,se);
if sensitivity>1
lm=multithresh(im,sensitivity);
T=lm(end);
else
T=adaptthresh(im,sensitivity,'NeighborhoodSize',4*floor(size(im)/16)+1,'statistic','gaussian');
T=imdilate(T,se);
end
for i=1:length(Cells)
if is3D(im)
verts=round(Cells(i).verts);
......@@ -34,7 +39,11 @@ for i=1:length(Cells)
end
idx(isnan(idx))=[];
imBGmu=median(imBG(idx));
minFG=max(T(idx));
if sensitivity>1
minFG=T;
else
minFG=max(T(idx));
end
imBGeff=1-imBGmu/minFG; %
imBGeff=min(imBGeff,1);
......
......@@ -86,6 +86,7 @@ end
if is3D(im)
% 3D
if bUseCuda
im=mat2gray(im);
imx=HIP.Cuda.NLMeans(im,nlm_h,nlm_sw_radius,nlm_nh_radius,[]);
if nlm_hpf
imx=imx-HIP.Cuda.Gaussian(im,szFilter,1,[]);
......
......@@ -11,6 +11,16 @@ else
sensitivity=0.5;
end
if sensitivity>1 && round(sensitivity)==sensitivity
lm=multithresh(imLog,sensitivity)
bwLog=logical(imLog>lm(end));
bwLog=bwareaopen(bwLog,4*min_area_pixels);
lm=multithresh(im,sensitivity)
bw=logical(im>lm(end));
bw=bwareaopen(bw,min_area_pixels);
return;
end
if is3D(im)
nsz=2*floor(size(im)/16)+1;
T=adaptthresh(imLog,0.5,'NeighborhoodSize',nsz,'statistic','gaussian');
......
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