The differences between geodesic distance vs euclidean distance

What is the differences between geodesic distance vs euclidean distance. With the FreeSurfer-derived surf files, can i calculate the geodesic distance for both hemispheres?

If -yes, what software can i use to calculate the bilateral geodesic distance matrix?

Geodesic distance is the length of the shortest path between two points that can be followed while remaining on a surface. Euclidean distance is the shortest path in 3D space, which is the norm of the difference vector of the two points (the familiar |x-y| = sqrt(sum((x - y) ** 2)). (These can be generalized, but this works for a 2D surface embedded in 3D space.)

You can calculate geodesic distances on each surface, but not between surfaces, as they are not connected. You can construct a distance matrix by starting with a weighted graph and using Dijkstra’s algorithm to compute all of the pairwise shortest path lengths. One implementation is in NetworkX: all_pairs_dijkstra_path_length — NetworkX 3.1 documentation.

2 Likes

One situation that highlights the difference and may be familiar is the flight path of planes (e.g., Why Are Great Circles the Shortest Flight Path? - GIS Geography). The shortest path in the Euclidean sense would involve going through the earth. Being unable to do that (i.e., tunnel) but still wanting to talk about the shortest path is one motivation for a geodesic distance. Another is when wanting to talk about the distance between locations on the cortical sheet (given the constraint that the path cannot leave the cortex).

1 Like

AFNI includes SurfDist to compute geodesic distance between pairs of nodes on a surface. There is a short tutorial linked below.

There is also the similarly named surfdist (.py) from Daniel Margulies that attempts to fine tune that with the curvature of the edges.

https://afni.nimh.nih.gov/pub/dist/doc/program_help/SurfDist.html

1 Like