I want to extract the skeleton of the image I attached so that I can use it as a mask on that image. A simple threshold does not do it because I need every part of bone region to be filled. This is what I've done so far. With this code there are some parts of the skeleton that are not filled (and should be) and some parts that do not belong to the skeleton that are included in the mask (and should be). Any suggestions?
Thanks in advance.
imgGray = readdicom(imgPath); %a function I made to read the image
imgAdjust = imadjust(imgGray); %, [0 0.2]
BW = imgAdjust > 0.17; %threhold
BW2 = medfilt2(BW, [5 5]);se = strel('disk',3);close = imclose(BW2,se);closeFill = imfill(close,'holes');src = imgAdjust;mask=closeFill;masked = bsxfun(@times, src, cast(mask,class(src)));imshow(masked)subplot(131), imshow(src), title('Original');subplot(132), imshow(mask), title('Mask');subplot(133), imshow(masked), title('Masked');
Best Answer