Measuring average distance between two lines in an OCT Image
7 次查看(过去 30 天)
显示 更早的评论
Greetings,
I am working on a project and my aim is to calculate average thickness of different retinal layers. Is there anyway I could calculate the averaged, min and max distance between these two lines using MATLAB?
Thanks
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1320920/image.jpeg)
0 个评论
回答(1 个)
Image Analyst
2023-3-11
Just scan across the thresholded image finding the first and last rows where you have a pixel. Then you might have to get rid of outliers, maybe with a median filter. Then compute the area and divide by the width. Something like (untested):
[rows, columns, numberOfColorChannels] = size(grayImage);
mask = grayImage > someThreshold.
topRows = zeros(1, columns);
bottomRows = zeros(1, columns);
for col = 1 : columns
t = find(mask(:, col), 1, 'first');
if ~isempty(t)
topRows(col) = t;
bottomRows(col) = find(mask(:, col), 1, 'last');
end
end
x = 1 : columns;
hold on;
plot(x, topRows, 'r-', 'LineWidth', 2);
plot(x, bottomRows, 'r-', 'LineWidth', 2);
% Get heights as function of column.
heights = bottomRows - topRows;
% That is the area of each column.
% Divide by the number of columns to get the mean height.
meanHeight = sum(heights) / columns;
If you still need help, attach the original image (without any lines or annotations).
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!