Question

I have a volume (3D matrix) that has undergone a segmentation process. Most of the volume consist of NaNs (or zeros), except regions that have passed some criteria (see picture). I need to know how large each remaining segment is in number of voxels and how is their distribution on the 2D planes (xy, xz, yz). Is there anything in matlab that can help me do this in an efficient way rather than direct search? The volume can be rather large. For ex. in the attached picture there is one segment in yellowish/brownish colour of 7 voxels and extends more vertically than in xy. Thanks in advance.enter image description here

Was it helpful?

Solution

The most convenient solution is to use REGIONPROPS. In your example:

stats = regionprops(image, 'area', 'centroid')

For every feature, there is an entry in the structure stats with the area (i.e. # of voxels) and the centroid.

OTHER TIPS

I think that what you are looking for is called bwlabeln. It allows you to find blobs in 3D space, just like bwlabel does in 2D. Afterwards, you can use regionprops to find out the properties of the data.

Taken directly from help:

bwlabeln Label connected components in binary image. L = bwlabeln(BW) returns a label matrix, L, containing labels for the connected components in BW. BW can have any dimension; L is the same size as BW. The elements of L are integer values greater than or equal to 0. The pixels labeled 0 are the background. The pixels labeled 1 make up one object, the pixels labeled 2 make up a second object, and so on. The default connectivity is 8 for two dimensions, 26 for three dimensions, and CONNDEF(NDIMS(BW),'maximal') for higher dimensions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top