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.
    8 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    May
 am 26 Jan. 2017
  
    
    
    
    
    Kommentiert: Takuji Fukumoto
    
 am 26 Jan. 2017
                %%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
0 Kommentare
Akzeptierte Antwort
  Takuji Fukumoto
    
 am 26 Jan. 2017
        I recommend you to use regionprops function. You can measure properties of binary image with this.
https://www.mathworks.com/help/images/ref/regionprops.html?s_tid=srchtitle#input_argument_properties
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 Kommentare
  Takuji Fukumoto
    
 am 26 Jan. 2017
				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.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!