enigmatoolbox.utils.parcellation.parcel_to_surface

enigmatoolbox.utils.parcellation.parcel_to_surface(source_val, target_lab, mask=None, fill=0, source_lab=None)[source]

Map data in source to target according to their labels (authors: @OualidBenkarim, @saratheriver)

Target labels are sorted in ascending order, such that the smallest label indexes the value at position 0 in source_val. If source_lab is specified, any label in target_lab must be in source_lab.

Parameters:
  • source_val (ndarray, shape = (n_val,)) – Source array of values.
  • target_lab (can be a string (e.g., aparc_fsa5) or an ndarray, shape = (n_lab,)) – Target labels.
  • mask (ndarray, shape = (n_lab,), optional) – If mask is not None, only consider target labels in mask. Default is None.
  • fill (float, optional) – Value used to fill elements outside the mask. Default is 0.
  • source_lab (ndarray, shape = (n_val,), optional) – Source labels for source values. If None, use unique labels in target_lab in ascending order. Default is None.
Returns:

target_val – Target array with corresponding source values.

Return type:

ndarray, shape = (n_lab,)