pycortex icon indicating copy to clipboard operation
pycortex copied to clipboard

compute sulcal depth

Open alexhuth opened this issue 12 years ago • 1 comments

We should be able to compute sulcal depth from the surfaces without relying on freesurfer. This is the only surface property that we are still relying on freesurfer for.

alexhuth avatar Nov 11 '13 22:11 alexhuth

Ugh freesurfer computes it based on the inflation process, that's not gonna work for us. But we can compute a reasonable facsimile just by taking the distance to the convex hull. This is ridiculously simple, and looks pretty good:

import scipy.spatial
import cortex
pts, polys = cortex.db.surfs.getSurf("S1", "fiducial", "left")
lsurf = cortex.polyutils.Surface(pts, polys)

# Find convex hull
lsurf_tess = scipy.spatial.Delaunay(lsurf.pts)
lsurf_hullpts = np.unique(lsurf_tess.convex_hull)

# Find euclidean distance from each vertex to closest vertex in convex hull
kdt = scipy.spatial.cKDTree(lsurf.pts[lsurf_hullpts])
dist,idx = kdt.query(lsurf.pts)

alexhuth avatar Nov 12 '13 02:11 alexhuth