Skip to content
Snippets Groups Projects
Commit ae7c78bf authored by Andrew Cohen's avatar Andrew Cohen
Browse files

phaseReduce, updated matlabpolldb.exe

parent 11078c7e
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
function bwOut=segReduce(bw,bwLog,bPhaseReduce,min_area_pixels,min_radius_pixels) function bwOut=segReduce(bw,bwLog,bPhaseReduce,min_area_pixels,min_radius_pixels)
if bPhaseReduce if bPhaseReduce
bw=phaseReduce(bw,bwLog,min_radius_pixels); bwOut=phaseReduce(bw,bwLog,min_radius_pixels);
return; return;
end end
...@@ -51,92 +51,18 @@ end ...@@ -51,92 +51,18 @@ end
4; 4;
% function bwReduce=phaseReduce(bw,bwLog,min_radius_pixels)
% % min_radius_pixels=min_radius_pixels(1);
% [origL,num]=bwlabeln(bw); % se=strel('disk',ceil(min_radius_pixels/2));
% % bwLogHoles=imclose(bwLog,se);
% bwDilate=bwLog; bwLogHoles=bwLog;
% qL=origL; bwLogHoles=imfill(bwLogHoles,'holes')&~bwLogHoles;
% % nDimension is 2 for 2-D, 3 for 3-D used for concat'ing bwReduce=bw&bwLogHoles;
% nDimension=length(size(bw)); [L,num]=bwlabeln(bw);
% for n=1:num
% minKernelArea=ceil(min_area_pixels/4); % idx=find(L==n);
% if is3D(bw) if all(bwReduce(idx)==0)
% se=strel('sphere',1); bwReduce(idx)=1;
% else end
% se=strel('disk',1); end
% end 4;
% % \ No newline at end of file
% if prod(size(bw))>1e9
% nIter=2*min(min_radius_pixels);
% else
% nIter=2*max(min_radius_pixels);
% end
% for nDilate=1:nIter
% bwKernels=bw&~bwDilate;
% bwKernels=bwareaopen(bwKernels,minKernelArea);
% if isempty(find(bwKernels, 1))
% break;
% end
% L=bwlabeln(bwKernels);
% qL=cat(nDimension+1,qL,L);
% bwDilate=imdilate(bwDilate,se);
% end
%
% if nDimension==2
% L=qL(:,:,end);
% niq=size(qL,3);
% else
% L=qL(:,:,:,end);
% niq=size(qL,4);
% end
% L=0*origL;
% bw=logical(L>0);
%
% for iq=niq:-1:1
% if nDimension==2
% newL=qL(:,:,iq);
% else
% newL=qL(:,:,:,iq);
% end
% % bwd=bwdist(~newL);
% % ccL=bwconncomp(newL);
% % rpdist=cellfun(@(x) max(bwd(x)),ccL.PixelIdxList);
% % for each newL component, how many components from L are there?
% for n=1:max(newL(:))
% idx=find(n==newL);
% nc=numComponents(L,idx);
% if nc<=1
% % keep this component from newL -- there are 0 or 1 children
% bw(idx)=1;
% else
% % there are > 1 children in this component -- it's a split
% % don't add this since that would fuse the children
% end
% end
%
% L=bwlabeln(bw);
% end
% 4;
%
% function nc=numComponents(L,idx)
% labels=unique(L(idx));
% labels(0==labels)=[];
% nc=length(labels);
%
%
% function bwReduce=phaseReduce(bw,bwLog,min_radius_pixels)
% % min_radius_pixels=min_radius_pixels(1);
% % se=strel('disk',ceil(min_radius_pixels/2));
% % bwLogHoles=imclose(bwLog,se);
% bwLogHoles=bwLog;
% bwLogHoles=imfill(bwLogHoles,'holes')&~bwLogHoles;
% bwReduce=bw&bwLogHoles;
% [L,num]=bwlabeln(bw);
% for n=1:num
% idx=find(L==n);
% if all(bwReduce(idx)==0)
% bwReduce(idx)=1;
% end
% end
% 4;
\ No newline at end of file
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment