Question

I want to extract centreline pixels in vessel. At first I have seleted a seed point close to a vessel edge using ginput(1) command. This provides the starting point and specifies the region of interest (ROI) on a vessel segment where the analysis needs to be performed.

figure; imshow(Igreen_eq); % Main green channel Image
p = ginput(1); 

Then the selected seed point is served as centre of a circle with diameter less than the expected diameter of the vessel, in order for the circle not to intersect with the opposite edge.

t = 0:pi/20:2*pi;
d = 0.8*15; %d=80% of minwidthOfVessel so that it wont intesect with opposite edge;
R0=d/2;%radius
xi = R0*cos(t)+p(1);
yi = R0*sin(t)+p(2);
line(xi,yi,'LineWidth',2,'Color',[0 1 0]);
roimask = poly2mask(double(xi), double(yi), size(Igreen_eq,1), size(Igreen_eq,2));
figure; imshow(roimask) % Binary image of region selected
Itry = Igreen_eq; 
Itry(~roimask ) = 0;  
imshow(Itry);
Itry = im2double(Itry);
line(xi, yi,'LineWidth', 2, 'Color', [0 1 0]);
hold on; plot(p(1), p(2),'*r') 

Problem: Hessian matrix is to be computed for the light intensity on the circumference of this circle and the eigenvectors has to be obtained. I have calculated Dxx,Dyy,Dxy using:

[Dxx,Dxy,Dyy] = Hessian2D(Itry,2); %(sigma=2)

I need to write a code in MATLAB for following problem" For a point inside the vessel, the eigenvectors corresponding to the largest eigenvalues are normal to the edges and those corresponding to the smallest eigenvalues point to the direction along the vessels.

The first two consecutive vectors on the circle with maximum change in direction are considered as the pixels reflecting the vessel boundaries. The points on the tracking direction are considered as the centers for the subsequent circles. Repetition of this process gives an estimate of the vessel boundary.

How will I calculate largest eigen values and its correspoinding eigen vector of Hessian matrix to select new seed point as discussed above.


Thanks for your reply . I have used eig2image.m to find the eigen vectors at each point on the image (in my image, there is grey values on the concentric circular region and background is black ).

[Lambda1,Lambda2,Ix,Iy]=eig2image(Dxx,Dxy,Dyy)

where Ix and Iy are largest eigen vectors.
But when I try to plot eigen vectors using :

quiver(Ix, Iy)

I can also see the vectors on the black background which should be zero !!

Can you please reply how can I plot eigen vector on the top of the image.

Was it helpful?

Solution

Assuming Dxx, Dyy, Dxy are matrices of second-order partial derivatives of dimensions size(Itry) then for a given point (m,n) in Itry you can do:

H = [Dxx(m,n) Dxy(m,n); Dxy(m,n) Dyy(m,n)];
[V,D] = eig(H); % check by H*V = V*D;
eigenVal1 = D(1,1); 
eigenVal2 = D(2,2);
eigenVec1 = V(1,:); 
eigenVec2 = V(2,:);

This local eigen-decomposition will give you eigenvalues (and corresponding eigenvectors) which you can sort according to magnitude. You can loop across image points or for a more compact solution see eig2image.m in FileExchange.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top