segmentation algorithm by region growth
Show older comments
Hi I need to complete the following assignement and im having issues. For a reason I don't understand my code is currently drawing the backgroup instead of the region i clicked on..
here is what i need to do : The goal of this practical work is to develop a semi-automatic segmentation algorithm by region growth of a medical image and to extract anatomical measurements of the segmented region.
I have attached a video of what my code should be doing and the image im working with.
img = imread('images\vertebre.png');
imshow(img);
[x, y] = ginput(1);
x = uint16(x);
y = uint16(y);
imgf = medfilt2(img, [7 7]);
imshow(imgf);
elemd2 = strel('disk', 2, 0);
seg = zeros(510,628,'logical');
seg(y,x)=1 ;
seg_precedent = zeros(510,628,'logical');
dispMat = zeros(size(img));
while (~isequal(seg, seg_precedent))
seg_precedent = seg;
intensite_region = sum(seg(:) == 1);
m_region = mean(intensite_region);
std_region = std(intensite_region);
seg_dilate = imdilate(seg, elemd2);
contour = seg - seg_dilate;
ind = find(contour==1);
delta = 12;
binf = m_region - (std_region + delta);
bsup = m_region + (std_region + delta);
contour = seg_dilate - seg;
inf_seg = binf < imgf;
sup_seg = imgf < bsup;
candidats = inf_seg & sup_seg;
seg = candidats;
dispMat = img;
dispMat(seg) = 0;
RGB = cat(3,uint8(seg)*255+dispMat,dispMat,dispMat);
imshow(RGB, [])
drawnow
end
2 Comments
Image Analyst
on 18 Oct 2021
What about simply thresholding?
Julien Roussel
on 19 Oct 2021
Answers (0)
Categories
Find more on Modify Image Colors in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!