Extraction of tumour, Dilation and Drawing a boundary around tumour
1 view (last 30 days)
Show older comments
I have attached the image of a slice in which tumour is visible. I want to dilate the image and extract the tumour. After extracting the tumour I have to draw boundary around the tumour using 8 point connected components. This is the code I have tried but I am not able to get the desired output. Please help me with this problem and if possible with the proper code.
g1=double(g1);
g2 = im2bw(g1);
s=strel('square',2);
xt=imdilate(g2,s); %%%dilating to get the edge region filled properly
xd=double(xt);
x1=edge(xd,'canny'); %%%%finding edge so as to get 1 single line for contour extraction. figure imshow(x1) sz=size(x1);
x1=double(x1);
Answers (1)
Arun Mathamkode
on 1 Feb 2018
When you are binarizing the image using the im2bw function, it uses a level value to determine the threshold. The default value of the level is 0.5. Hence all the pixels with values above 0.5 will be assigned 1. Since the pixel values in your image are between 0 and 255, the threshold of 0.5 is too small and will assign almost all pixels other than black with 1. This is why you are not getting the desired results.
If you want to use im2bw function please consider normalizing the input pixel values between 0 and 1. Also, tune the level value to get the desired output. For example, you can modify the second line as,
g2 = im2bw(g1/255,0.3);
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!