enigmatoolbox.utils.parcellation.surface_to_parcel

enigmatoolbox.utils.parcellation.surface_to_parcel(values, labels, weights=None, target_labels=None, red_op='mean', axis=0, dtype=<class 'float'>)[source]

Summarize data in values according to labels (author: @OualidBenkarim)

Parameters:
  • values (1D or 2D ndarray) – Array of values.
  • labels (name of parcellation or 1D ndarray, shape = (n_lab,)) – Labels used summarize values.
  • weights (1D ndarray, shape = (n_lab,), optional) – Weights associated with labels. Only used when red_op is ‘average’, ‘mean’, ‘sum’ or ‘mode’. Weights are not normalized. Default is None.
  • target_labels (1D ndarray, optional) – Target labels. Arrange new array following the ordering of labels in the target_labels. When None, new array is arranged in ascending order of labels. Default is None.
  • red_op (str or callable, optional) – How to summarize data. If str, options are: {‘min’, ‘max’, ‘sum’, ‘mean’, ‘median’, ‘mode’, ‘average’}. If callable, it should receive a 1D array of values, array of weights (or None) and return a scalar value. Default is ‘mean’.
  • dtype (dtype, optional) – Data type of output array. Default is float.
  • axis ({0, 1}, optional) – If axis == 0, apply to each row (reduce number of columns per row). Otherwise, apply to each column (reduce number of rows per column). Default is 0.
Returns:

target_values – Summarized target values.

Return type:

ndarray