tedana.selection.component_selector.ComponentSelector.select
- ComponentSelector.select(component_table, cross_component_metrics={}, status_table=None)[source]
Apply the decision tree to data.
Using the validated tree in
ComponentSelector
to run the decision tree functions to calculate cross_component metrics and classify each component as accepted or rejected.- Parameters:
component_table ((C x M)
pandas.DataFrame
) – Component metric table. One row for each component, with a column for each metric; the index should be the component number.cross_component_metrics (
dict
) – Metrics that are each a single value calculated across components. Default is empty dictionary.status_table (
pandas.DataFrame
) – A table tracking the status of each component at each step. Pass a status table if running additional steps on a decision tree that was already executed. Default=None.
Notes
Adds to the
ComponentSelector
:component_status_table_
: empty dataframe or contents of inputted status_tablecross_component_metrics_
: empty dict or contents of inputed valuesused_metrics: empty set
Any parameter that is used by a decision tree node function can be passed as a parameter in the
ComponentSelector
initialization or can be included in the json file that defines the decision tree. If a parameter is set in the json file, that will take precedence. As a style rule, a parameter that is the same regardless of the inputted data should be defined in the decision tree json file. A parameter that is dataset-specific should be passed through the initialization function. Dataset-specific parameters that may need to be passed during initialization include:- n_echos
int
Number of echos in multi-echo fMRI data. Required for tedana_orig, meica, and minimal trees
- n_vols
int
Number of volumes (time points) in the fMRI data Required for tedana_orig and meica trees
An example initialization with these options would look like
selector = selector.select(comptable, n_echos=n_echos, n_vols=n_vols)
The selection process uses previously calculated parameters stored in component_table for each ICA component such as Kappa (a T2* weighting metric), Rho (an S0 weighting metric), and variance explained. If a necessary metric is not calculated, this will not run. See tedana.metrics for more detail on the calculated metrics
This can be used on a component_table with no component classifications or to alter classifications on a component_table that was already run (i.e. for manual classificaiton changes after visual inspection)
When this is run, multiple elements in ComponentSelector will change including:
component_table_
:classification
column withaccepted
orrejected
labels andclassification_tags
column with can hold multiple comma-separated labels explaining why a classification happenedcross_component_metrics_
: Any values that were calculated based on the metric values across components or by direct user inputcomponent_status_table_
: Contains the classification statuses at each node in the decision treeused_metrics: A list of metrics used in the selection process
nodes: The original tree definition with an added
outputs
key listing everything that changed in each nodecurrent_node_idx_
: The total number of nodes run inComponentSelector