Finding total displacement of a track

Hi world.
I have an image with white of various intensities, thicknesses, lengths and shapes on it. I am interested in finding the total displacement from the beginning to the end of each track. I have manually drawn on each track using the line tool to create regions of interest.
Is it now possible to find the total displacement from the beginning of each track , not the total length of the track. It might have already been done before. Can someone please point me to any solutions.
(the image is attached)

image.tiff (649.5 KB) image.jpeg.tiff (649.5 KB)
One of the tracks I am interested in
image
Thanks
Bilal

Hi Bilal, you could use in a macro the command:

Roi.getCoordinates(xpoints, ypoints);

Then take the first and last elements of the arrays xpoints and ypoints to calculate the displacement.
Hope this helps,
best,
Rocco

HI Rocco
Thanks for response.
I am a novice to Macro writing. Can I just paste this into new Macro and run it.
Thanks
Bilal

Hi
@bilalrmalik

“Is it now possible to find the total displacement from the beginning of each track , not the total length of the track.”
20200414_Fissures-3
Do you want the trajectory with its different positions (x, y)?
You don’t want the length.

Is this the image you want to get?
Use the PlugIn “Ridge Detection”.
Greetings

HI Mathew,
Could write me the steps I need to follow.
Thanks
Bilal

Know your basics, know your math.

Use the Pythagorean theorem on points
xpoints[0],ypoints[0] and xpoints[xpoints.length-1],ypoints[ypoints.length-1], which is the macro language notation of the first and last elements of the ROI as @RoccoDAntuono already pointed out.

1 Like

The following Error was obtained obtained:

Error: Unrecognized command: “Enhance Local Contrast” in line 3:
run ( “Enhance Local Contrast” , “blocksize=127 histogram=256 maximum=3” <)> ;

Hi
@bilalrmalik
This is the filter: “enhance local contrast”.
I use ImageJ (version 1.52u) and not FIJI.
Greetings

Thanks Mathew for your help.
B