nispace.nulls.find_surf_parc_centroids

nispace.nulls.find_surf_parc_centroids(parc, parc_space='fsaverage', parc_hemi=None, parc_density=None, snap=True)[source]

Compute per-parcel mean vertex coordinates on a standard cortical surface.

Plain numpy/nibabel/neuromaps (no numba). Surface counterpart of find_vol_parc_centroids(). Used internally by get_distance_matrix() (surf_euclidean=True path) and directly by generate_spins() for the single-hemisphere spin-index code path.

Parameters:
  • parc (str, nib.GiftiImage, or tuple/list of two) – Surface parcellation: a single GiftiImage/path (one hemisphere) or a 2-tuple/list (lh, rh).

  • parc_space (str, default="fsaverage") – Standard surface space to fetch coordinates from ("fsaverage" or "fsLR").

  • parc_hemi (str or list of str, optional) – Which hemisphere(s) parc represents. Required (as a 1-element list) for single-hemisphere input; forced to ["L", "R"] (with an info message) for 2-tuple input.

  • parc_density (str, optional) – Surface density (e.g. "32k"). Guessed from parc’s vertex count if not given.

  • snap (bool, default=True) – Snap the mean coordinate to the nearest vertex actually inside the parcel (the raw mean of surface coordinates is generally not itself a vertex on the mesh). If False, the raw mean is returned.

Returns:

Centroid coordinates, shape (n_parcels_total, 3), concatenated across hemispheres in the order given by parc/parc_hemi.

Return type:

np.ndarray

Raises:

TypeError – If parc is not a supported type.