brainspace.mesh.array_operations.propagate_labeling¶
-
brainspace.mesh.array_operations.
propagate_labeling
(surf, labeling, no_label=nan, mask=None, alpha=0.99, n_iter=30, tol=0.001, n_ring=1, mode='connectivity', append=False, key='propagated')[source]¶ Propagate labeling on surface points.
Parameters: - surf (vtkPolyData or BSPolyData) – Input surface.
- labeling (str, 1D ndarray) – Array with initial labels. If str, it must be in the point data attributes of surf. If ndarray, use this array as the initial labeling.
- no_label (int or np.nan, optional) – Value for unlabeled points. Default is np.nan.
- mask (1D ndarray, optional) – Binary mask. If specified, propagation is only performed on points within the mask. Default is None.
- alpha (float, optional) – Clamping factor such that
0 < aplha < 1
. Deault is 0.99. - n_iter (int, optional) – Maximum number of propagation iterations. Default is 30.
- tol (float, optional) – Convergence tolerance. Default is 0.001.
- n_ring (positive int, optional) – Consider points in the n-th ring to label the unlabeled points. Default is 1.
- mode ({'connectivity', 'distance'}, optional) – Propagation based on connectivity or geodesic distance. Default is ‘connectivity’.
- 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 ‘propagated’.
Returns: output (vtkPolyData, BSPolyData or ndarray) – A 1D array with the propagated labeling. Return array if
append == False
. Otherwise, return input surface with the new array.References
- Zhou, D., Bousquet, O., Lal, T. N., Weston, J., & Schölkopf, B. (2004). Learning with local and global consistency. Advances in neural information processing systems, 16(16), 321-328.