Define a curve in terms of (X,Y) values

Dear all,
I detected an artery borderline (Image B) on a grayscale image (image A). Now I would like to define the detected borderline in terms of (X,Y) values.
Would be much appreciated if any body could give me a hint. Ashkan

Answers (1)

I assume that B is in a single matrix. The light point should then correspond to matrix elements above some threshold. If this is the case, it should be sufficient to do this
[y x] = find(B>t);

5 Comments

Thanks for your response. How can I find t (threshold of the curve)?
Uh... you made the image. I thought you knew.
Black should correspond to the minimum value in B, so I'd try
t=min(B(:));
[y x] = find(B>t);
Probably a slightly larger value (as compared to the max) will give a sharper result.
This method gives me [x y] in terms of pixel. What would I need is to define the curve in terms of [x y] coordinate with the origin at the centre of the image. I mean I need the distance of each pint on the curve from the origin of the image in terms of mm.
Let me explain why I do this.
I have a bunch grayscale images representing cross sectional views of an artery. I need to first the detect the artery borderline on each image as like image B and then convert the detected curve into [x y] (mm) and then import the coordinates of all detected curves into a three-dimensional model design software to create a 3D geometry.
pfb
pfb on 15 Apr 2015
Edited: pfb on 16 Apr 2015
Well, that should not be that hard.
[Y,X] = size(B);
Gives you the size of the image in the vertical and horizontal direction (in pixels). You should know what that is in mm.
The "origin" is then
o = [X/2 Y/2];
Use round() if your matrix has odd dimensions and you want integer numbers.
Then
x = x-o;
y = y-o;
Again, these coordinates are "in pixels", but if you know the scale of the image it is easy to get the correct values. If Sx and Sy are the dimensions of the image in mms then
x = Sx/X*x;
y = Sy/Y*y;
Why your 3D model design software should care about where the origin of the axes is?
Thanks, I will try this and will let you know ...

Sign in to comment.

Categories

Community Treasure Hunt

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

Start Hunting!