 # Measuring distance between multiple lines

Hello,
I want to measure the distance between multiple black lines quicker. I know to set the scale from a reference, draw multiple lines and measure each. I am wondering if there is a faster way to do this.  . Pictures of what I am trying to measure.

Thanks.

There are several posibilities to do that. You can use the line profile tool to get the peaks and then use, e.g., the Find Peaks script to identify the peaks in the plot (you can smooth the plot with a filter):

The x-values of the peaks can be used to calculate the distances (x2-x1, etc.).

Another easier possibility in your special case is to threshold the white space between the lines (I inverted the image), make a particle analysis (use a rectangle selection to get a clean measurement and deselect ‘exlude on edges’) and measure the bounding rectangle which gives you the distance (width).

Macro:

``````run("8-bit");
run("Invert");
makeRectangle(0, 90, 647, 22);
setAutoThreshold("Default");
run("Set Measurements...", "area centroid center bounding shape display add redirect=None decimal=3");
run("Analyze Particles...", "  show=Outlines display clear");
``````

Here a result from the macro above (using your example image converted to 8-bit):

Just one thing to mention. Your lines are quite thick. So it would be useful to define if you measure the distances from the edge of the lines or the center (which also can be measured applying binary operators to thinning your lines or use method one!)

1 Like

Hello,
Thanks for the help. Using the 2nd method, How does it measure length between the lines? My results

The bounding rectangle Width gives you the distance from one line (edge) to another:

https://imagejdocu.tudor.lu/gui/analyze/set_measurements