My objective is 3D image segmentation, I am using 3D active snakes for the same. In order to find the initial segments, I am performing some operations and in the last steps finding the convexhull. Here is the code for the same:
% img is the input 3D image given as 3D stack
szey = size(img,1);
szex = size(img,2);
szez = size(img,3);
thres = adaptthresh(img);
b=imbinarize(img,thres);
Gbw=imdilate(b,strel('disk',4));
Gfl = reshape(imfill(reshape(Gbw,szey,szex*szez),'holes'),szey,szex,szez);
Gfl = bwareaopen(Gfl,5,4);
bwsml = imdilate(imerode(Gfl,strel('disk',4)),strel('disk',4));
%getting the boundary pixels
GX = circshift(bwsml,[1 0 0]);
GY = circshift(bwsml,[0 1 0]);
GZ = circshift(bwsml,[0 0 1]);
Xbound = abs(GX-bwsml); Ybound = abs(GY-bwsml); Zbound = abs(GZ-bwsml);
bnd = or(or(Xbound,Ybound),Zbound);
cmp = bwconncomp(bnd,18);
labeled = labelmatrix(cmp);
mx=1;
% Merging all the different components as one component
for nobj=2:cmp.NumObjects
labeled(labeled == nobj) = mx;
end
S = regionprops(labeled ,'PixelIdxList');
bnd = false(szey,szex,szez); bnd(S.PixelIdxList)=true;
[bndx,bndy,bndz]=ind2sub([szey szex szez],find(bnd));
% %starting surface: intial surface
conv = convhull(bndx,bndy,bndz);
For a small image stack of 170 x190x 17, I get size of bndx, bndy and bndz as 110500 x 1,
and conv of size 58192 x 3
Attached here is an image of the patch funtion of conv and [bndx, bndy, bndz]
We see that there is a lot of redundance, how do I decrease the size of convex hull?
I used simplify parameter, but it does not give desired results, it gives me conv hull of (32 x 3) size. Is there someway to reduce the redundancy but not this much?

2 Kommentare

Matt J
Matt J am 29 Mai 2021
How many facets is the hull supposed to have?
Anusha Devulapally
Anusha Devulapally am 29 Mai 2021
It should be around 10% of existing, around 5000 or so.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by