tedana.selection.component_selector.ComponentSelector
- class ComponentSelector(tree, component_table, cross_component_metrics={}, status_table=None)[source]
Load and classify components based on a specified
tree
.- __init__(tree, component_table, cross_component_metrics={}, status_table=None)[source]
Initialize the class using the info specified in the json file
tree
.- Parameters:
tree (
str
) – The named tree or path to a JSON file that defines one.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
Initializing the
ComponentSelector
confirms tree is valid and loads all information in the tree json file intoComponentSelector
.Adds to the
ComponentSelector
:component_status_table: empty dataframe or contents of inputted status_table
cross_component_metrics: empty dict or contents of inputed values
used_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 kundu and minimal trees
- n_vols
int
Number of volumes (time points) in the fMRI data Required for kundu tree
An example initialization with these options would look like
selector = ComponentSelector(tree, comptable, n_echos=n_echos, n_vols=n_vols)
Methods
add_manual
(indices, classification)Add nodes that will manually classify components.
After the tree has finished executing, check if all component classifications are either "accepted" or "rejected".
Check if all metrics that are declared as necessary are actually used and if any used_metrics weren't explicitly declared necessary.
check_null
(params, fcn)Checks that all required parameters for selection node functions are attributes in the class.
select
()Apply the decision tree to data.
to_files
(io_generator)Convert this selector into component files.
Attributes
A boolean
pandas.Series
of components that are accepted.A boolean
pandas.Series
of components that are tagged "Likely BOLD".The number of components that are accepted.
The number of components in the component table.
The number of components that are tagged "Likely BOLD".
A boolean
pandas.Series
of components that are rejected.