Centroid calculation for connected component in 3D volume
Mostrar comentarios más antiguos
I am trying to implement brain tumor segmentation on 3D brain MRI(.mha data type). After preliminary segmentation, I am applying 26-neighbor connected component algorithm(using bwconncomp) to obtain the largest connected component with maximum volume, following which I need to calculate the centroid of this connected component.
I am not sure if my method of calculating the largest connected component and the centroid is correct, because the centroid value obtained and its nearby voxels all have value 0. Also I dont know how 3D index is represented. For eg. if centroid=(x,y,z), does it correspond to x=row,y=column and z=2D slice?
Any help would be appreciated. Below is my code with the relevant part.
CC=bwconncomp(Ibin,26); %Input Black & White 3D data of size 240x240x155
Pixelid=regionprops(CC,'PixelIdxList');
[prow pcol]=size(Pixelid);
maxval=Pixelid(1).PixelIdxList;
index=1;
for i=1:prow
number=numel([Pixelid(i).PixelIdxList]); %calculating the component with max number of voxels
if(number>maxval)
maxval=number;
index=i;
end
end
for i=1:prow
if i~=index
Ibin(Pixelid(i).PixelIdxList)=0;
end
end
CC1=bwconncomp(Ibin,26);
Cent=regionprops(CC1,'Centroid');
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Region and Image Properties en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!