Commit 6d4d3078 authored by actb's avatar actb

thresholdimages changes for dark center phase

parent b4882735
......@@ -24,7 +24,6 @@ im=denoise(im,segParams);
if 1==nargout
return
end
if is3D(im)
% 3D
if 1==nargout
......@@ -106,7 +105,7 @@ else
imx=medfilt2(im)-imgaussfilt(im,szFilter(1:2));
end
end
imx=max(imx,0);
im=mat2gray(imx);
......
......@@ -17,15 +17,25 @@ if is3D(im)
return;
end
if segParams.isPhase
if segParams.isPhase~=0
% bright interior phase
se=strel('disk',1);
se2=strel('disk',ceil(min_radius_pixels/2));
T=adaptthresh(im,0.5,'foregroundpolarity','dark','statistic','gaussian');
se2=strel('disk',ceil(min_radius_pixels));
if segParams.isPhase>0
T=adaptthresh(im,0.5,'foregroundpolarity','dark','statistic','gaussian');
else
T=adaptthresh(im,0.5,'foregroundpolarity','bright','statistic','gaussian');
end
bw=imbinarize(im,T);
bw=imcomplement(bw);
if segParams.isPhase>0
bw=imcomplement(bw);
end
bw=imclose(bw,se2);
bw=imfill(bw,'holes');
if segParams.wellRadius
bw=imopen(bw,se2);
if true==segParams.wellRadius
bwMask=imbinarize(medianMask,adaptthresh(medianMask,'statistic','gaussian'));
bwMask=imdilate(bwMask,se2);
bw=bw&~bwMask;
......
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