# 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일)
May 2017년 1월 26일
댓글: Takuji Fukumoto 2017년 1월 26일
%%Checking Round
[B,L]=bwboundaries(bw,'noholes');
imshow(L);
% 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'
boundary=B{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');
end
% text(boundary(1,2)-35,boundary(1,1)+13,metric_string,'Color','y',...
% 'FontSize',13,'FontWeight','bold');
end

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

### 채택된 답변

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없음 표시없음 숨기기
May 2017년 1월 26일
Thanks you for your kind recommendation. It is helpful for me. I can find the eccentricity but I don't know how to remove the objects that are grater than the specified eccentricity (for example 0.5).
Takuji Fukumoto 2017년 1월 26일
Here is command.
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.
And type this command on MATLAB.
imageRegionAnalyzer
This application make it easy to analyze and filter regions by properties.

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

### 카테고리

Help CenterFile Exchange에서 DICOM Format에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by