How to choose circular shape in image after segmentation ?

5 views (last 30 days)
I have a mammogram image,
I am applying segmentation process.
To remove pectoral muscle and tags, the code takes biggest area and they are gone(pectoral muscle and tags)
But sometimes pectoral muscle part is the biggest part and tumor area is smaller so tumor area is gone too.
Maybe if code detect circular shape and others remove it can be more succesfull
Codes are below . How can we do this ?
Image added. (tumor is circle shape)
(in this code below pectoral muscle is stay others gone .)
(The aim is detect tumor area , not pectoral muscle. )
clear all;
IM=imread('B1 (33).png');
title('Original Image', 'FontSize', fontSize);
% Maximize the figure window.
set(gcf, 'Position', get(0, 'ScreenSize'));
axis square;
%Using histogram to adjust the image
I_eq = adapthisteq(IM);
title('Equalized Image', 'FontSize', fontSize);
%Method #1: using a thresholding method.
%Above 200(>), will appear white; Below <200, will appear black
%Remove objects in the image that is less than 250 pixels
thresholdValue = 200;
binaryImage = I_eq > thresholdValue;
%clear the border
IM_cb = imclearborder(binaryImage);
BW2 = bwareaopen(IM_cb, 250);
BW_filled = imfill(BW2, 'holes');
title('Segmented Image', 'FontSize', fontSize);
labeledImage = bwlabel(BW_filled);
measurements = regionprops(labeledImage, 'Area');
% Get all the areas
allAreas = [measurements.Area];
[biggestArea, indexOfBiggest] = sort(allAreas, 'descend')
% Extract biggest
biggestBlob = ismember(labeledImage, indexOfBiggest(1));
% Convert to binary
biggestBlob = biggestBlob > 0;
subplot(2, 2, 4);

Answers (1)

Harikrishnan Balachandran Nair
From my understanding, you want to detect circular objects in your image. You can use 'imfindcircles' function in Matlab where circular hough transform is used to find circles in the image.
You may refer to the following documentation to get more information on the function:

Community Treasure Hunt

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

Start Hunting!