Create multiple structure properties from a stack of 3D images

3 visualizaciones (últimos 30 días)
Mario
Mario el 22 de Mzo. de 2015
Comentada: Mario el 23 de Mzo. de 2015
Hello,
I have a stack of binary images(16 to be exact) in a 3D matrix that I named M2 and I wanted to extract centroids from each of those images inside that 3D matrix using regionprops using for loop, but without any success.
I labeled each of those images and stored them in a new 3D matrix called bw. I want to extract centroids of many labels contained by each image of that 3D matrix and store them in maybe separate structures. But I am not sure how to do that and use them later in my code. I want to be able to get perhaps separate sub-structures containing centroids of each labeled image so that I can access those centroids later on in my code.
I have done this so far:
numImages - is a number of images inside my 3D matrix
bw - is a 3D matrix of my labeled images
M2 - is a 3D matrix of my binary images
for i=1:numImages
s = regionprops(logical(bw(:,:,i)), M2(:,:,i), 'Centroid');
end
Here I am not sure how to get centroids stored in separate structures for each image of my 3D matrix. Any help would be much appreciated.
Thanks in advance!

Respuesta aceptada

Image Analyst
Image Analyst el 22 de Mzo. de 2015
In the loop, put this
strCentroids(i).Centroids = [s.Centroid];
  1 comentario
Mario
Mario el 23 de Mzo. de 2015
Thanks, that is working!
Now I have a 1x16 structure s containing all 16 labeled images with each of them having their regions centroids.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by