cortex.polyutils.Surface.approx_geodesic_distance

Surface.approx_geodesic_distance(verts, m=0.1)[source]

Computes approximate geodesic distance (in mm) from each vertex in the surface to any vertex in the collection verts. This approximation is computed using Varadhan’s formula for geodesic distance based on the heat kernel. This is very fast (quite a bit faster than geodesic_distance) but very inaccurate. Use with care.

In short, we let heat diffuse across the surface from sources at verts, and then look at the resulting heat levels in every other vertex to approximate how far they are from the sources. In theory, this should be very accurate as the duration of heat diffusion goes to zero. In practice, short duration leads to numerical instability and error.

Parameters:
verts1D array-like of ints

Set of vertices to compute distance from. This function returns the shortest distance to any of these vertices from every vertex in the surface.

mfloat, optional

Scalar on the duration of heat propagation. Default 0.1.

Returns:
1D ndarray, shape (total_verts,)

Approximate geodesic distance (in mm) from each vertex in the surface to the closest vertex in verts.