bwconncomp reports only one connected component when there are obviously many hundreds
4 ビュー (過去 30 日間)
古いコメントを表示
I have the 3D binary image shown below and I am trying to extract the largest connected component
As you can see there are many separate components but when I use the function
bwconncomp
it tells me there is only one connected component like this
> cc=bwconncomp(imt2,6)
cc =
struct with fields:
Connectivity: 6
ImageSize: [176 256 20]
NumObjects: 1
PixelIdxList: {[432548×1 double]}
Where imt2 is my image. The same thing happens if I use 26 for connectivity.
I have attached the imt2 data.
Is this a matlab bug or am I misunderstanding something?
2 件のコメント
DGM
2023 年 9 月 11 日
I think you're being confused by the way you're visualizng the data. You're looking at the surface of a solid volume:
load imt2.mat
isosurface(imt2)
axis equal
All those things that look like isolated points are the interior surfaces of voids in the solid. We can just take the average on Z and see that the object is solid and there aren't any stray pixels that are isolated (at least as far as this single projection can tell).
A = mean(double(imt2),3);
imshow(A,'border','tight')
採用された回答
Image Analyst
2023 年 9 月 11 日
There is just one connected, semi-porous blob as you can see from the screenshot below:
s = load('imt2.mat')
imt2 = s.imt2;
props = regionprops3(s.imt2, 'Volume')
volshow(imt2)
その他の回答 (1 件)
Walter Roberson
2023 年 9 月 11 日
load imt2
M = false(size(imt2));
M(end/2,end/2,end/2) = true;
OUT = bwdistgeodesic(imt2, M, 'cityblock');
MMM=(isnan(OUT) & imt2);
nnz(MMM)
This tells you that if you mark the center of the matrix, and ask bwdistgeodesic to traverse only through city block operations, that every location in the matrix that cannot be reached from the centre, is also a false pixel.
To flip that around: every pixel that is true can reach the center pixel using only cityblock operations -- moving up / down / left / right / forward / back without diagonals.
参考
カテゴリ
Help Center および File Exchange で 3-D Volumetric Image Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!