brainspace.mesh.mesh_operations.downsample_with_parcellation¶
-
brainspace.mesh.mesh_operations.
downsample_with_parcellation
(surf, labeling, name='parcel', check_connected=True)[source]¶ Downsample surface according to the labeling.
Such that, each parcel centroid is used as a point in the new donwsampled surface. Connectivity is based on neighboring parcels.
Parameters: - surf (vtkPolyData or BSPolyData) – Input surface.
- labeling (str or 1D ndarray) – Array of labels used to perform the downsampling. If str, it must be an array in the PointData attributes of surf.
- name (str, optional) – Name of the downsampled parcellation appended to the PointData of the new surface. Default is ‘parcel’.
- check_connected (bool, optional) – Whether to check if the points in each parcel are connected. Downsampling may produce inconsistent results if some parcels have more than one connected component. Default is True.
Returns: res (BSPolyData) – Downsampled surface.