Matlab bwlabeln/bwconncomp connectivity issue

1 view (last 30 days)
I have a 3D array containing ones and zeros, and I'm using bwconncomp with a connectivity of 6 to group clusters of ones. From my understanding, a connectivity of 6 means that it checks for other objects in each of the 6 voxels adjacent to the face of one voxel. Does that mean it looks for voxels which have all 6 objects connected, or just atleast 1 within that boundary?
Regardless, for one of my data sets, some of the labeled objects only contain one voxel, which doesn't make sense to me. No objects are connected to any of its 6 faces.
I checked graphically, and checked the values of my original 3d array. I also see clusters of 2 or 3, which makes sense if it checks for atleast 1 object in the boundary. There are also stray objects of 1 voxel connected to a larger cluster of objects, when it would be better if that voxel were included in the larger cluster. Really only one of my data sets has this issue, the rest seem to group clusters correctly.
I've tried different connectivity values, but it still comes out strangely. I've attached an image, and circled some anomalies. The graph is of each cluster of objects, with each color denoting a different object (there are more objects than colors, so some of the objects have very similar colors).
  2 Comments
Juan Cadena
Juan Cadena on 11 Jan 2018
Alex or Image Analyst, do you know which is the script or function that Alex used in order to plot the 3D voxels as shown in the previous image. Thank you!
Image Analyst
Image Analyst on 11 Jan 2018
I don't know how he made that. My guess would be scatter3(). There is a volume viewer app (on the Apps tab of the tool ribbon) in MATLAB now so you may prefer that.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 19 Jun 2014
Those are detached voxels. Either completely isolated, or touching only along an edge, not along a face. The 'clean' option of bwmorph() won't help you since bwmorph() only works on 2D images. You can call regionprops() and then get the volumes with the 'Area' option and delete regions with a volume of less than 1 or 2 or whatever. See my Image Processing Tutorial to see how you can do this with find() and ismember(): http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!