roiextract.pipeline.CentroidAggregation#

class roiextract.pipeline.CentroidAggregation(surf='sphere')#

Centroid-based aggregation of reconstructed source time courses within the ROI. The time course of the source that is the closest to the center of mass of the ROI is selected as the representative time course of the ROI.

Parameters:
surfstr, default=”sphere”

The surface to use for computing the center of mass. The provided value is forwarded to mne.Label.center_of_mass() without modification.

Methods

fit(data, src, labels[, subject, subjects_dir])

Fit the aggregation step to the provided data, source space, and labels.

fit_transform(data, src, labels[, subject, ...])

Fit the aggregation step to the provided data, source space, and labels, and apply the aggregation to extract the ROI time courses.

get_names()

Label names are used as names for rows of the weight matrix.

get_params()

Get the single surf parameter of the aggregation step as a dictionary.

get_weights()

The weight matrix corresponding to the resulting aggregation transformation.

transform(data)

Apply centroid-based aggregation to the provided data.

fit(data, src, labels, subject=None, subjects_dir=None)#

Fit the aggregation step to the provided data, source space, and labels.

Parameters:
dataSourceEstimate

The source estimate containing the reconstructed source time courses.

srcSourceSpaces

The definition of the considered source space for inverse modeling.

labelsLabel | list of Label

The label or list of labels defining the ROIs for which time courses should be extracted.

subjectstr | None

The subject name. If None, it will be inferred from the source space.

subjects_dirstr | None

The directory containing the subjects’ MRI data. If None, it will be inferred from the environment by MNE-Python. Set the path explicitly in case of errors.

Returns:
selfCentroidAggregation

The fitted aggregation step.

fit_transform(data, src, labels, subject=None, subjects_dir=None)#

Fit the aggregation step to the provided data, source space, and labels, and apply the aggregation to extract the ROI time courses. See fit() and transform() for details on the parameters and return values, respectively.

get_names()#

Label names are used as names for rows of the weight matrix.

Returns:
nameslist of str

The names of the rows / labels.

get_params()#

Get the single surf parameter of the aggregation step as a dictionary.

Returns:
paramsdict

The parameters of the aggregation step.

get_weights()#

The weight matrix corresponding to the resulting aggregation transformation.

Returns:
weightsarray

The weight matrix that contains one non-zero entry per row corresponding to the selected centroid source for each label.

transform(data)#

Apply centroid-based aggregation to the provided data.

Parameters:
dataSourceEstimate

The source estimate containing the reconstructed source time courses.

Returns:
label_tcarray, shape (n_labels, n_times)

The extracted time courses for each label.