How can fill holes in 3D binary matrix?
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Erfaneh
el 15 de Ag. de 2014
I have a huge 3D binary matrix. To process it, I need to fill some holes but imfill(BW,'holes') does not work on 3D binary matrix and I just use it for one element in the matrix. I want to fill holes in all elements of the matrix not element by element. Can some one help me?
2 comentarios
Image Analyst
el 15 de Ag. de 2014
What do you mean by "I just use it for one element"? How are you using it? If you pass in the whole array, it will fill the whole array - all holes that are there, even for a 3D or higher dimension array.
Image Analyst
el 16 de Ag. de 2014
Thanks for clearing up your non-standard terminology. What you call an "element" is what everyone else in the world calls a "slice", or sometimes "plane". An element is just one voxel - one single value of the 3D array.
Respuesta aceptada
Matt J
el 15 de Ag. de 2014
Editada: Matt J
el 15 de Ag. de 2014
What version of MATLAB are you using? IN R2013b, using imfill(BW,'holes') for 3D BW works fine for me, e.g.,
>> BW=ones(3,3,3); BW(2,2,2)=0; BW=imfill(BW,'holes')
BW(:,:,1) =
1 1 1
1 1 1
1 1 1
BW(:,:,2) =
1 1 1
1 1 1
1 1 1
BW(:,:,3) =
1 1 1
1 1 1
1 1 1
6 comentarios
Image Analyst
el 16 de Ag. de 2014
OK, just as long as you know that imclose is not guaranteed to fill all holes, and it changes the shape of the region by smoothing it out. It can do some hole filling but it's not the same as imfill.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!