Blood vessel identification from an OCT image

조회 수: 7 (최근 30일)
shal_sn
shal_sn 2025년 6월 10일
댓글: Mathieu NOE 2025년 6월 16일
Hello,
I have an image that I want to identify blood vessels in (marked with arrows)
Does anyone have an idea how to do this? Basically, I need the borders of the blood vessels.
The original image:

답변 (1개)

Mathieu NOE
Mathieu NOE 2025년 6월 10일
let's try something with edge approach : nice but how do you then isolate the black thicker line as the identified blood vessel ?
% Read the input image
image = imread('image.jpg');
grayImage = rgb2gray(image); % Convert to grayscale if it's a color image
% Enhance contrast using adaptive histogram equalization
enhancedImage = adapthisteq(grayImage);
% Apply a median filter to reduce noise
filteredImage = medfilt2(enhancedImage, [3 3]);
% Use edge detection to highlight blood vessels
edges = edge(filteredImage, 'log');
% Perform morphological operations to refine the segmentation
se = strel('disk', 4); % Structuring element
dilatedEdges = imdilate(edges, se); % Dilate edges
cleanedEdges = imerode(dilatedEdges, se); % Erode to clean up
% Display the results
% figure, imshow(enhancedImage), title('Enhanced Image');
% figure, imshow(filteredImage), title('Filtered Image');
figure, imshow(edges), title('Edge Detection');
figure, imshow(cleanedEdges), title('Final Segmentation');
  댓글 수: 2
Mathieu NOE
Mathieu NOE 2025년 6월 10일
then this my suggestion, not anything fancy based on image processing tbx
as per my understanding the blood vessel is within the two magenta curves
% Read the input image
A = imread('image.jpg');
A = rgb2gray(A); % Convert to grayscale if it's a color image
A = double(A);
A = flipud(A); % to have image displayed with correct y direction
[y,x] = find(A>50);
[xtop,ytop,xbottom,ybottom,] = top_bottom_boundary(x,y);
figure(1)
imagesc(A);
colorbar('vert');
set(gca,'YDir','normal');
colormap('gray');
hold on
plot(xtop, ytop, '--r', xbottom, ybottom, '--g','linewidth',2)
% first find the blood vessel center line ("valey")
for k = 1:numel(xtop)
s = A(:,k);
[minS,ind] = min(s(ybottom(k):ytop(k)));
xline(k) = k;
yline(k) = ind+ybottom(k);
zline(k) = minS;
end
% smooth zline profile before moving on
zline = smoothdata(zline,'gaussian',50);
% smooth yline profile before moving on
yline = round(smoothdata(yline,'gaussian',50))'; % nb : must be rounded because after used as an index
% now find top and bottom envelope of blood vessel
for k = 1:numel(xtop)
s = A(:,k);
% find upper line with threshold factor with zline
thres = 1.25;
[valU,indU] = min(abs(s(yline(k):ytop(k))-thres*zline(k)));
yu(k) = yline(k)+indU;
% find lower line with threshold factor with zline
thres = 1.5;
[valL,indL] = min(abs(s(yline(k):-1:ybottom(k))-thres*zline(k)));
yl(k) = yline(k)-indL;
end
%smooth it a bit
N = 50;
yu = smoothdata(yu,'gaussian',N);
yl = smoothdata(yl,'gaussian',N);
% remove incorrect start and stop because of YTicks in image
n = 16;
yline(1:n) = NaN;
yline(end-n:end) = NaN;
yu(1:n) = NaN;
yu(end-n:end) = NaN;
yl(1:n) = NaN;
yl(end-n:end) = NaN;
% final plot
plot(xline,yline,'--c')
plot(xline,yu,'m')
plot(xline,yl,'m')
legend('top boundary','bottom boundary','bv center line','bv top','bv bottom');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [x3,y3,x4,y4] = top_bottom_boundary(x,y)
% based on FEX : https://fr.mathworks.com/matlabcentral/answers/299796-tight-boundary-around-a-set-of-points
%split data into classes and find max/min for each class
class_label = unique(x);
upper_boundary = zeros(size(class_label));
lower_boundary = zeros(size(class_label));
for idx = 1:numel(class_label)
class = y(x == class_label(idx));
upper_boundary(idx) = max(class);
lower_boundary(idx) = min(class);
end
% left_boundary = y(x == class_label(1));
% right_boundary = y(x == class_label(end));
%
% % left_boundary
% x1 = class_label(1)*ones(size(left_boundary));
% y1 = left_boundary;
%
% % right_boundary
% x2 = class_label(end)*ones(size(right_boundary));
% y2 = right_boundary;
% top boundary
x3 = class_label;
y3 = upper_boundary;
% bottom boundary
x4 = class_label;
y4 = lower_boundary;
end
Mathieu NOE
Mathieu NOE 2025년 6월 16일
hello
problem solved ?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Deep Learning for Image Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by