# Measuring average distance between two lines in an OCT Image

12 Ansichten (letzte 30 Tage)
Mohammad Mehdi am 10 Mär. 2023
Kommentiert: Mohammad Mehdi am 13 Mär. 2023
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
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Image Analyst am 11 Mär. 2023
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);
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).
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Mohammad Mehdi am 13 Mär. 2023
Thank you very much for the promot reply,
Actually I am trying to get the measurment of different layers of retina:
and I am quite new with matlab, so it would be great if you could help me, please.
I have attached the raw image, too.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Image Arithmetic finden Sie in Help Center und File Exchange

R2020b

### Community Treasure Hunt

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

Start Hunting!

Translated by