フィルターのクリア

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.

1 回表示 (過去 30 日間)
%%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
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
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
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.
imageRegionAnalyzer
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