horizontal and points on an image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

horizontal and points on an image

celowsky
List,

I dropped this on the ImageJ Forum, with 22 view and no answers thus far, I'm trying here.  I do apologize for cross listing for those who follow both.

My example image is here:

http://forum.imagej.net/uploads/default/optimized/1X/6b4ec6a517a0eb7d65bee3398aacaaf63f280a42_1_666x500.jpg

I'm trying to place landmarks or beacons on a .tif (maximum intensity projections) (12 blue crosses in image) and either get locations (x,y) of those beacons or be able to measure multiple coordinates between them. Furthermore, I'm trying to find the angle of the line formed from each pair (yellow line and bracket) and a set 180 degree line (green dashed).

In short, I need three things:

1) Set what horizontal or 180 degrees is.
2) Place markers and output (x,y) or be able to measure many lines between all those 12 markers
3) Find the angles of the 6 lines in relation to the preset horizontal

I'm happy to bounce in and out of various plugins or even programs and have about 300 images to measure. I do have the original .nd2 files from a Nikon A1, but doubt those will help in anyway.

Thank you for any assistance.

Christian

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: horizontal and points on an image

Brandon Hurr
Are you hand drawing the horizontal and identifying the points?

If so, you just need to tell imageJ to do the math:
// User selection horizon
// 4 = Line selection
run("Select None"); //Selecting nothing just in case
setTool(4);                     //Line Tool

message= "Line Selection Required\n Please create a Horizon line";
waitForUser(message);

// get horizon information
getLine(x1, y1, x2, y2, lineWidth);

if (x1==-1) // if x1 is less than 0 then it is not a proper line
  exit("This macro requires a straight line selection");


dx = x2-x1; // change in x
dy = y2-y1; // change in y

slopehoriz = dy / dx;

length = sqrt(dx*dx+dy*dy);
print("Length of horizon:", length);
print("slope of horizon:", slopehoriz);


// only selecting one object, need looping structure for more
run("Select None"); //Selecting nothing just in case
setTool(4);                     //Line Tool

message= "Line Selection Required\n Please create a line for the object of
interest";
waitForUser(message);

// get horizon information
getLine(x3, y3, x4, y4, lineWidth1);

if (x3==-1) // if x3 is less than 0 then it is not a proper line
  exit("This macro requires a straight line selection");

dxO = x4-x3; // change in x
dyO = y4-y3; // change in y

slopeobject = dyO / dxO;

lengthobject = sqrt(dxO*dxO+dyO*dyO);
print("Length of object:", lengthobject);
print("slope of object:", slopeobject);


angleofobjecthoriz = 180/PI * (PI - atan(slopehoriz) - atan(slopeobject));

print("angle of object from horizon:", angleofobjecthoriz);


If I've done my math right, that should allow you to select a horizon line.
Then hit OK. Then it will ask you to select an object line. Then hit OK.
In the log window it will output the slopes and lengths and then the angle
between them.

At least it worked when I played with it. Put this code inside of an image
loop and then if your objects are standard enough (are there always 6 of
them?) you could make an object loop and get all the angles.

B

On Mon, Jan 4, 2016 at 9:40 AM, Christian Elowsky <[hidden email]> wrote:

> List,
>
> I dropped this on the ImageJ Forum, with 22 view and no answers thus far,
> I'm trying here.  I do apologize for cross listing for those who follow
> both.
>
> My example image is here:
>
>
> http://forum.imagej.net/uploads/default/optimized/1X/6b4ec6a517a0eb7d65bee3398aacaaf63f280a42_1_666x500.jpg
>
> I'm trying to place landmarks or beacons on a .tif (maximum intensity
> projections) (12 blue crosses in image) and either get locations (x,y) of
> those beacons or be able to measure multiple coordinates between them.
> Furthermore, I'm trying to find the angle of the line formed from each pair
> (yellow line and bracket) and a set 180 degree line (green dashed).
>
> In short, I need three things:
>
> 1) Set what horizontal or 180 degrees is.
> 2) Place markers and output (x,y) or be able to measure many lines between
> all those 12 markers
> 3) Find the angles of the 6 lines in relation to the preset horizontal
>
> I'm happy to bounce in and out of various plugins or even programs and
> have about 300 images to measure. I do have the original .nd2 files from a
> Nikon A1, but doubt those will help in anyway.
>
> Thank you for any assistance.
>
> Christian
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html