How to measure distance between two points?

Hello!

I am new to using FIJI, so if the answer to this question is extremely obvious I am very sorry. For a project I am doing, I have to measure to length of a wavy line. I am using the ‘segmented line’ command to help get a smooth curve. I understand how to get the length of this curvy line as well by using the ‘measure’ command.

However, I also need the length from one end of the line to the other. Is it possible to do this without having to draw a straight line through the curve?

I could also use the x and y coordinates for both ends of the curved line; I used the ‘list’ command to display coordinates, but that is just for the one side. Is it possible to receive the other x and y coordinates?

If it is easier to make a vector, that could also work and may be preferred if I receive the same information as previously mentioned.

Thank you for the help, and please let me know if you can think of anything.

As a quick measurement the Ferets Diameter could give you the smallest and the largest distance between any point in your segment. https://imagej.nih.gov/ij/docs/guide/146-30.html#sub:Set-Measurements
If the ends curl in however this might not work for you.

Here is a discussion about length measurements on points in the image using macros: How to batch measure distances between points

But I do not understand the problem with the extraction of the coordinates. Could you provide an example image with ROIs?

Thank you!

Do you mean how to get the coordinates of the first and last point in a wavy line selection?

Roi.getCoordinates(xpoints, ypoints);
x0=xpoints[0];
y0=ypoints[0];
x1=xpoints[xpoints.length-1];
y1=ypoints[ypoints.length-1];
...pythagorean (x0,y0,x1,y1)..

Thank you very much. This seems like it could work, but where are the values for the points displayed?

Sorry for any confusion; I am attaching an image of a curve-like segment I would be measuring. It is not a complete shape so I don’t believe Feret’s Diameter would work. When I click ‘measure’ I get the length of the segment, which is one thing that I need. I also need to know the length of the white-dashed line. I could go in and draw individual lines, but that would be extremely time consuming since the sample I am testing has so many of these lines. If it is also possible, I would like to obtain the coordinates of the two endpoints that I circled.

Thank you!18%20AM

Roi.getCoordinates(xpoints, ypoints);
x0=xpoints[0];
y0=ypoints[0];
x1=xpoints[xpoints.length-1];
y1=ypoints[ypoints.length-1];
print("x0 = "+x0+" y0 = "+y0+" x1 = "+x1+" y1 = "+y1);

Hi Talha_Lone,

ah ok, when you have a line ROI it does not give you the ferets diameter only the length. BUT you can get the Ferets diameter if you also select the Centroid option. Weird but seems to work. As you see in the below example for two line ROIs the ferets diameter of ROI 1 corresponds to the length of ROI 2:

This corresponds in your given example exactly to the dashed line. The only limitation to that measurement would be that if the end points curl in. Then the longest distance between any point is no longer the distance between the endpoints.

Just add your line ROIs to the ROI manager. Then select in the Set Measurements the Ferets option plus the Centroid and perform the measurement by pressing measure in the ROI manager. Bit hacky but works.

Cheers,
Christopher

I have made a tool called MTrack (https://imagej.net/MicrotubuleTracker), in which you can determine end points of filament shaped objects, If the problem you are mentioning is not just a one off problem, I can invest some time in making a general tool for measuring length of such objects by Gaussian polynomial fitting.

1 Like