I am a beginner of using matlab. I have a extracted ROI of lung CT scan. I want to remove the rod (stick) like structures from that binary image in order to left only the round objects ( nodules). Please, kindly advise me.

조회 수: 5(최근 30일)
%%Checking Round
% imshow(label2rgb(L, @jet, [.5 .5 .5]));
hold on
% for k = 1:length(B)
% boundary = B{k};
% plot(boundary(:,2), boundary(:,1), 'w', 'LineWidth', 2);
% end
stats= regionprops(L,'Area','Centroid');
% threshold= 0.94;
% loop over the boundaries
for k=1:length(B)
% obtain (X,Y) boundary coordinates corresponding to label 'k'
% compute a simple estimate of the object's perimeterd
delta_sq= diff(boundary).^2;
perimeter= sum(sqrt(sum(delta_sq,2)));
%obtain the area calculation corresponding to label 'k'
area = stats (k).Area;
%compute the roundness metric
metric = 4*pi*area/perimeter^2;
%display the results
metric_string = sprintf('%2.2f',metric);
% mark objects above the threshold with a black circle
if metric > 0.5
% text(boundary(1,2)-35,boundary(1,1)+13,metric_string,'Color','y',...
% 'FontSize',13,'FontWeight','bold');
% centroid = stats(k).Centroid;
% plot(centroid(1),centroid(2),'ko');
% text(boundary(1,2)-35,boundary(1,1)+13,metric_string,'Color','y',...
% 'FontSize',13,'FontWeight','bold');

채택된 답변

Takuji Fukumoto
Takuji Fukumoto 2017년 1월 26일
I recommend you to use regionprops function. You can measure properties of binary image with this.
stats = regionprops(BW,'Eccentricity')
The eccentricity is the ratio of the distance between the foci of the ellipse and its major axis length. The value is between 0 and 1. (0 and 1 are degenerate cases. An ellipse whose eccentricity is 0 is actually a circle, while an ellipse whose eccentricity is 1 is a line segment.)
You can identify the round objects if you choose the BWs whose eccentricity value is small.
  댓글 수: 2
Takuji Fukumoto
Takuji Fukumoto 2017년 1월 26일
Here is command.
I = imread('2.jpg');
BW = imbinarize(rgb2gray(I));
BW_out = bwpropfilt(BW, 'Eccentricity', [0.5, 1]);
figure ,imshow(BW_out);
I think eccentricity of all region is greater than 0.7.
Please set appropriate value.
And type this command on MATLAB.
This application make it easy to analyze and filter regions by properties.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by