netneurotools.freesurfer.find_parcel_centroids

netneurotools.freesurfer.find_parcel_centroids(*, lhannot, rhannot, method='surface', version='fsaverage', surf='sphere', drop=None)[source]

Return vertex coords corresponding to centroids of parcels in annotations.

Note that using any other surf besides the default of ‘sphere’ may result in centroids that are not directly within the parcels themselves due to sulcal folding patterns.

Parameters:
  • {lh (str) – Path to .annot file containing labels of parcels on the {left,right} hemisphere. These must be specified as keyword arguments to avoid accidental order switching.

  • rh}annot (str) – Path to .annot file containing labels of parcels on the {left,right} hemisphere. These must be specified as keyword arguments to avoid accidental order switching.

  • method ({'average', 'surface', 'geodesic'}, optional) – Method for calculation of parcel centroid. See Notes for more information. Default: ‘surface’

  • version (str, optional) – Specifies which version of fsaverage provided annotation files correspond to. Must be one of {‘fsaverage’, ‘fsaverage3’, ‘fsaverage4’, ‘fsaverage5’, ‘fsaverage6’}. Default: ‘fsaverage’

  • surf (str, optional) – Specifies which surface projection of fsaverage to use for finding parcel centroids. Default: ‘sphere’

  • drop (list, optional) – Specifies regions in {lh,rh}annot for which the parcel centroid should not be calculated. If not specified, centroids for parcels defined in netneurotools.freesurfer.FSIGNORE are not calculated. Default: None

Returns:

  • centroids ((N, 3) numpy.ndarray) – xyz coordinates of vertices closest to the centroid of each parcel defined in lhannot and rhannot

  • hemiid ((N,) numpy.ndarray) – Array denoting hemisphere designation of coordinates in centroids, where hemiid=0 denotes the left and hemiid=1 the right hemisphere

Notes

The following methods can be used for finding parcel centroids:

  1. method='average'

    Uses the arithmetic mean of the coordinates for the vertices in each parcel. Note that in this case the calculated centroids will not act actually fall on the surface of surf.

  2. method='surface'

    Calculates the ‘average’ coordinates and then finds the closest vertex on surf, where closest is defined as the vertex with the minimum Euclidean distance.

  3. method='geodesic'

    Uses the coordinates of the vertex with the minimum average geodesic distance to all other vertices in the parcel. Note that this is slightly more time-consuming than the other two methods, especially for high-resolution meshes.