roiextract.pipeline.ExtractionPipeline#
- class roiextract.pipeline.ExtractionPipeline(steps)#
This class represents a pipeline for extracting ROI time courses. The pipeline should consist of one or more linear transformation steps.
- Parameters:
- steps
listofPipelineStep The list of pipeline steps (instances of
PipelineStepor its subclasses) that define the transformations to be applied to the data. The steps are applied in the order they appear in the provided list.
- steps
- Attributes:
- preparedbool
Indicates whether the pipeline has been fit to the data.
Methods
fit(data, src, labels[, subject, subjects_dir])Fit the pipeline to the provided data.
fit_transform(data, src, labels[, subject, ...])Fit the pipeline to the provided data and then apply the transformation.
Get the list of spatial filters that represent the final data transformation for each considered ROI.
Returns the names for rows of the resulting weight matrix.
The weight matrix corresponding to the linear transformation defined by the entire pipeline.
transform(data)Transform the provided data using the fitted pipeline.
- fit(data, src, labels, subject=None, subjects_dir=None, **kwargs)#
Fit the pipeline to the provided data. This method should be called before calling
transform().- Parameters:
- data
Raw The raw data to fit the pipeline on.
- src
SourceSpaces The definition of the considered source space for inverse modeling.
- labels
listofLabel The list of ROIs for which time courses should be extracted.
- subject
str, optional The subject for which the pipeline is being fit. Currently, this argument is only used by centroid-based aggregation to compute the center of mass of the ROIs.
- subjects_dir
str, optional The directory containing the subjects’ MRI data. Currently, this argument is only used by centroid-based aggregation to compute the center of mass of the ROIs.
- **kwargs
Additional keyword arguments that may be required for fitting the pipeline.
- data
- Returns:
- self
ExtractionPipeline The fitted pipeline.
- self
Notes
Each step in the pipeline receives only a subset of the provided arguments, depending on the specific requirements of the step. Custom steps can request specific arguments by overriding the
PipelineStep._request_args()method.
- fit_transform(data, src, labels, subject=None, subjects_dir=None, **kwargs)#
Fit the pipeline to the provided data and then apply the transformation. For the parameters and return values, see
fit()andtransform(), respectively.
- get_filters()#
Get the list of spatial filters that represent the final data transformation for each considered ROI. The filters are generated using the values of
get_weights()andget_names()methods of the pipeline, as well asget_params()method of each step.- Returns:
- filters
listofSpatialFilter The resulting list of spatial filters.
- filters
- get_names()#
Returns the names for rows of the resulting weight matrix. The names are taken from the last step in the pipeline.
- get_weights()#
The weight matrix corresponding to the linear transformation defined by the entire pipeline. It is obtained by multiplying the weight matrices of the individual steps in the pipeline.
- Returns:
- weights
array The weight matrix corresponding to the linear transformation defined by the entire pipeline.
- weights
- transform(data)#
Transform the provided data using the fitted pipeline. For built-in steps, the transformation either executes the corresponding function in MNE-Python directly or matches it as closely as possible.
- Parameters:
- data
Raw The raw data to transform.
- data
- Returns:
transformed_dataThe transformed data obtained by applying the pipeline to the input data.