Extracting useful information from ultrasound image.

6 vues (au cours des 30 derniers jours)
Priscil23
Priscil23 le 14 Jan 2020
I have an ultrasound image of two cysts and I would like to extract information of just the two cysts from the image. Using BW is okay.
I used the code below:
%% Read Image
RGB = imread('US11.jpg');
%% Thresholding the Image
I = rgb2gray(RGB);
bw = imbinarize(I);
imshow(bw)
%% Removing the Noise
% remove all object containing fewer than 30 pixels
bw = bwareaopen(bw,350);
% fill a gap in the image
se = strel('disk',0.1);
bw = imclose(bw,se);
%% Finding the Boundaries
[B,L] = bwboundaries(bw,'noholes');
% Display the label matrix and draw each boundary
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
%% Determine which Objects are Round
stats = regionprops(L,'Area','Centroid');
threshold = 0.95;
% 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 perimeter
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 > threshold
centroid = stats(k).Centroid;
plot(centroid(1),centroid(2),'ko');
end
I have attached the image along with this this.
It will be helpful if someone could teach me.
US11.jpg

Réponses (0)

Catégories

En savoir plus sur Biomedical Imaging dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by