in matlab, find 3D neighbourhood

丶灬走出姿态 提交于 2019-12-10 19:22:54

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/12958969/in-matlab-find-3d-neighbourhood

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!