brainspace.mesh.array_operations.get_parcellation_centroids

brainspace.mesh.array_operations.get_parcellation_centroids(surf, labeling, non_centroid=0, mask=None, append=False, key='centroids')[source]

Compute parcels centroids.

Parameters:
  • surf (vtkPolyData or BSPolyData) – Input surface.
  • labeling (str, 1D ndarray) – Array with labels. If str, it must be in the point data attributes of surf. If ndarray, use this array as the labeling.
  • non_centroid (int, optional) – Label assigned to non-centroid points. Default is 0.
  • mask (1D ndarray, optional) – Binary mask. If specified, only consider points within the mask. Default is None.
  • append (bool, optional) – If True, append array to point data attributes of input surface and return surface. Otherwise, only return array. Default is False.
  • key (str, optional) – Array name to append to surface’s point data attributes. Only used if append == True. Default is ‘centroids’.
Returns:

output (vtkPolyData, BSPolyData or ndarray) – A 1D array with the centroids assigned to their corresponding labels and the rest of points assigned non_centroid. Return array if append == False. Otherwise, return input surface with the new array.