macro_eeg_model.config.nodes_processor#
Classes#
A class to process given brain regions into their corresponding indices in |
Module Contents#
- class macro_eeg_model.config.nodes_processor.NodesProcessor(given_nodes, relay_station)[source]#
A class to process given brain regions into their corresponding indices in the Julich brain parcellation by finding the final generation children of the given nodes.
- given_nodes#
List of nodes to be processed.
- Type:
list
- relay_station#
The relay station node, if any, that connects different brain regions.
- Type:
str
- _areas_dict#
A dictionary mapping brain areas to their hierarchical structure using
src.data_prep.areas_terminology_parser.AreasTerminologyParser.parse_into_dict().- Type:
dict
- __init__(given_nodes, relay_station)[source]#
Initializes the NodesProcessor with the provided nodes, relay station, and whether to separate left and right brain nodes.
- Parameters:
given_nodes (list) – List of nodes to be processed.
relay_station (str) – The relay station node, if any.
- get_nodes_indices()[source]#
Processes the nodes and the relay station, if any, and retrieves their corresponding indices using
_process_nodes().- Returns:
A tuple containing relay nodes, relay nodes indices, interaction nodes, and interaction nodes indices.
- Return type:
tuple
- _process_nodes(nodes)[source]#
Processes a list of nodes and retrieves their corresponding indices using
_get_nodes_and_indices().- Parameters:
nodes (list) – List of nodes to be processed.
- Returns:
A tuple containing the processed nodes and their indices.
- Return type:
tuple
- _get_nodes_and_indices(node)[source]#
Retrieves the final generation nodes and their corresponding indices for a given brain region (node). Uses
_initialize_nodes_and_indices()to set up initial structures,_find_final_generation_children()to locate the final generation nodes, and_populate_nodes_indices()to assign indices based on the Julich brain parcellation.- Parameters:
node (str) – The name of the brain region (node) to retrieve indices for.
- Returns:
A tuple containing:
nodes: list of nodes corresponding to the brain region.
nodes_indices: dictionary mapping each node to its corresponding indices.
- Return type:
tuple
- _initialize_nodes_and_indices(node)[source]#
Initializes the nodes and their corresponding indices, considering left and right brain separation.
- Parameters:
node (str) – The node to initialize.
- Returns:
A tuple containing the initialized nodes and their indices.
- Return type:
tuple
- _find_final_generation_children(dictionary, target, found=False)[source]#
Recursively finds the final generation children of a target node in the areas dictionary.
- Parameters:
dictionary (dict) – The dictionary containing hierarchical brain area mappings (initially
_areas_dict).target (str) – The target node to find children for.
found (bool, optional) – Whether the target node has been found (default is False).
- Returns:
A list of final generation children nodes.
- Return type:
list
- _populate_nodes_indices(nodes_indices, children, node)[source]#
Populates the nodes indices with the corresponding Julich labels.
- Parameters:
nodes_indices (dict) – The dictionary to populate with node indices.
children (list) – The list of child nodes to process.
node (str) – The original node being processed.
- Returns:
The populated nodes indices.
- Return type:
dict