Commit b6d4aea0 authored by actb's avatar actb

aiAreaOpen

parent 8b7c8e45
function bw=aiAreaOpen(bw,min_radius_pixels)
if ~is3D(bw)
% 2d - use pi*r^2 approximation
radius=min_radius_pixels(1);
area = radius^2 * pi;
bw=bwareaopen(bw,area);
return;
end
maskRadius=0.5*min_radius_pixels;
maskRadius=max(maskRadius,[1,1,1]);
ee=HIP.MakeEllipsoidMask(maskRadius);
bwSeeds=imerode(bw,ee);
bw=imreconstruct(bwSeeds,bw);
......@@ -88,7 +88,7 @@ end
% of those pixels will be discarded in resolving the underlying cells.
% allocateShake (below) assigns each discarded pixel to it's closest
% touching segmentation using a morphological region fill
bw=bwareaopen(bw,min_area_pixels);
bw=Segment.aiAreaOpen(bw,min_radius_pixels);
bw2=bw;
bPhaseReduce=segParams.isPhase || segParams.bCytoplasmic;
% if prod(size(im))>1e9
......
......@@ -6,7 +6,6 @@ if bPhaseReduce
return;
end
minKernelArea=ceil(0.25*min_area_pixels); %
if is3D(bw)
se=strel('sphere',1);
else
......@@ -14,11 +13,11 @@ else
end
%
bwOut=bw;
nIter=100; %10*max(min_radius_pixels);
for nDilate=1:nIter
bwKernels=bwOut&~bwLog;
bwKernels=bwareaopen(bwKernels,minKernelArea);
bwKernels=Segment.aiAreaOpen(bwKernels,0.5*min_radius_pixels);
L=bwlabeln(bwKernels);
CC=bwconncomp(bwOut);
workingL=double(labelmatrix(CC));
......
......@@ -14,10 +14,10 @@ end
if sensitivity>1 && round(sensitivity)==sensitivity
lm=multithresh(imLog,sensitivity)
bwLog=logical(imLog>lm(end));
bwLog=bwareaopen(bwLog,4*min_area_pixels);
bwLog=Segment.aiAreaOpen(bwLog,2*min_radius_pixels);
lm=multithresh(im,sensitivity)
bw=logical(im>lm(end));
bw=bwareaopen(bw,min_area_pixels);
bw=Segment.aiAreaOpen(bw,min_radius_pixels);
return;
end
......@@ -25,12 +25,12 @@ if is3D(im)
nsz=2*floor(size(im)/16)+1;
T=adaptthresh(imLog,0.5,'NeighborhoodSize',nsz,'statistic','gaussian');
bwLog=imbinarize(imLog,T);
bwLog=bwareaopen(bwLog,4*min_area_pixels);
bwLog=Segment.aiAreaOpen(bwLog,2*min_radius_pixels);
nsz=4*floor(size(im)/16)+1;
T=adaptthresh(im,sensitivity,'NeighborhoodSize',nsz,'statistic','gaussian');
bw=imbinarize(im,T);
bw=bwareaopen(bw,min_area_pixels);
bw=Segment.aiAreaOpen(bw,min_radius_pixels);
return;
end
......@@ -38,7 +38,7 @@ end
nsz=4*floor(size(im)/16)+1;
T=adaptthresh(imLog,0.5,'NeighborhoodSize',nsz,'statistic','gaussian');
bwLog=imbinarize(imLog,T);
bwLog=bwareaopen(bwLog,4*min_area_pixels);
bwLog=Segment.aiAreaOpen(bwLog,2*min_radius_pixels);
if segParams.isPhase
[bw,bwLog]=phaseThreshold(im,bwLog,min_radius_pixels,segParams,...
......@@ -49,7 +49,7 @@ else
T=adaptthresh(im,sensitivity,'NeighborhoodSize',4*floor(size(im)/16)+1,'statistic','gaussian');
bw=imbinarize(im,T);
end
bw=bwareaopen(bw,min_area_pixels);
bw=Segment.aiAreaOpen(bw,min_radius_pixels);
4;
function [bw,bwLog]=phaseThreshold(im,bwLog,min_radius_pixels,segParams,...
......
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