bwconncomp reports only one connected component when there are obviously many hundreds
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Michael
el 11 de Sept. de 2023
Comentada: Michael
el 11 de Sept. de 2023
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 comentarios
DGM
el 11 de Sept. de 2023
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')
Respuesta aceptada
Image Analyst
el 11 de Sept. de 2023
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)
Más respuestas (1)
Walter Roberson
el 11 de Sept. de 2023
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.
Ver también
Categorías
Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!