How can I extract each connected object in a 3D array?

1 visualizzazione (ultimi 30 giorni)
I have a 3D array (attached as Y.mat) and I find the connected components using bwconncomp. I used the following coding to extract each component but X is a zero array with the same size as Y. Please, help me to solve this problem.
Thanks
May
CC = bwconncomp(Y, 26); % Y is the 3D array
L = labelmatrix(CC);
for i=1:length(CC.PixelIdxList)
X = (L==i);
imshow3D(a); % use existing function to show 3D
end

Risposta accettata

Image Analyst
Image Analyst il 1 Mar 2017
Use ismember
oneBlobOnly = ismember(L, i);
  2 Commenti
May
May il 2 Mar 2017
Thanks Image Analyst,I tried it but the result is not change. Please kindly help me , where I made wrong. Thank you so much again.
load Y;
CC = bwconncomp(Y, 26); % Y is the 3D array
L = labelmatrix(CC);
oneBlobOnly = ismember(L,2);
map = hsv(90);
XR = oneBlobOnly; %%If I show "Y", it can show.
Ds = smooth3(XR);
hiso = patch(isosurface(Ds,5),'FaceColor','blue','EdgeColor','none');
hcap = patch(isocaps(XR,5),'FaceColor','interp','EdgeColor','none');
colormap(map)
daspect(gca,[1,1,.4])
lightangle(305,30);
fig = gcf;
fig.Renderer = 'zbuffer';
lighting phong
isonormals(Ds,hiso)
hcap.AmbientStrength = .6;
hiso.SpecularColorReflectance = 0;
hiso.SpecularExponent = 50;
ax = gca;
ax.View = [215,30];
ax.Box = 'On';
axis tight
title('One Blob');

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Particle & Nuclear Physics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by