Determine the centroid and radius of the intervertebral disk

13 次查看(过去 30 天)
Hi everybody! I am currently working on a school project of medical image and i need your help please!
I have this medical image and i have to determine the centroid and radius of the intervertebral disk. How can i do it?
Thank you everyone in advance.

回答(2 个)

VINAYAK LUHA
VINAYAK LUHA 2024-7-19,11:53
Hi Leonardo,
You can use MATLAB "Image Segmenter App" to preprocess your medical image for segmenting the intervertebral disc and determining its centroid and radius
Here’s a streamlined approach you may follow:
  1. Convert the original image to a binary image.
  2. Apply Morphological Transformations such as dilation, erosion, hole filling etc.
  3. Next, use the MATLAB "regionprops" function to find properties of the obtained mask ROI, including the centroid location and diameter of circle whose area is equivalent to the obtained masked ROI.
  4. Note that you may need to repeat steps 2 and 3 multiple times, each time focussing on keeping the region of interest (ROI) and removing other elements.
The final result should resemble the following-
Further, If you want to cross-verify the results, I found the centroid at (124.73, 79.61) and the radius to be 93.08 pixels.
For more details on the functions you may use, refer to the following documentations:
Hope this gives you some guidance on how to proceed further.
Regards
Vinayak

Image Analyst
Image Analyst 2024-7-19,16:03
Try this:
% Demo by Image Analyst
% Initialization steps:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 16;
%--------------------------------------------------------------------------------------------------------
% READ IN TEST IMAGE
folder = pwd;
baseFileName = "vertebral disk.jpeg";
fullFileName = fullfile(folder, baseFileName);
% Check if file exists.
if ~isfile(fullFileName)
% The file doesn't exist -- didn't find it there in that folder.
% Check the entire search path (other folders) for the file by stripping off the folder.
fullFileNameOnSearchPath = baseFileName; % No path this time.
if ~exist(fullFileNameOnSearchPath, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
% Read in image file.
rgbImage = imread(fullFileName);
% Get size
[rows, columns, numberOfColorChannels] = size(rgbImage)
% Get gray scale version of it.
if numberOfColorChannels == 3
grayImage = rgb2gray(rgbImage);
else
grayImage = rgbImage;
end
% Display the image.
subplot(2, 2, 1);
imshow(grayImage);
axis('on', 'image');
impixelinfo;
title('Original Image', 'FontSize', fontSize, 'Interpreter', 'None');
% Maximize window.
g = gcf;
g.WindowState = 'maximized';
g.Name = 'Demo by Image Analyst';
g.NumberTitle = 'off';
drawnow;
%--------------------------------------------------------------------------------------------------------
% Show histogram
subplot(2, 2, 2);
imhist(grayImage);
title('Gray Scale Histogram', 'FontSize', fontSize, 'Interpreter', 'None');
%--------------------------------------------------------------------------------------------------------
% Threshold.
thresholdValue = 200;
xline(thresholdValue, 'Color', 'r');
% Create mask
mask = grayImage > thresholdValue;
subplot(2, 2, 3);
imshow(mask);
axis('on', 'image');
impixelinfo;
% Count blobs
[~, numberOfBlobs] = bwlabel(mask);
caption = sprintf('Initial Mask Image with %d blobs', numberOfBlobs);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
%--------------------------------------------------------------------------------------------------------
% CREATE MASK.
% Fill any holes.
mask = imfill(mask, 'holes');
% Take largest blob.
mask = bwareafilt(mask, 1);
subplot(2, 2, 4);
imshow(mask);
axis('on', 'image');
impixelinfo;
title('Final Mask Image', 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
%--------------------------------------------------------------------------------------------------------
% GET AREA(S)
blobMeasurements = regionprops(mask, 'Area', 'EquivDiameter');
numberOfBlobs = size(blobMeasurements, 1)
allAreas = [blobMeasurements.Area]
allDiameters = [blobMeasurements.EquivDiameter]
caption = sprintf('Final Mask Image with %d Blob', numberOfBlobs);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by