map_electrodes
tit.tools.map_electrodes ¶
Electrode mapping utilities for TI-Toolbox.
Maps optimized electrode positions to the nearest available positions in an EEG net using the Hungarian algorithm (linear sum assignment) for optimal matching.
read_csv_positions ¶
Read electrode positions from a CSV file using SimNIBS utilities.
Parameters¶
csv_path : str Path to the file containing electrode positions.
Returns¶
positions : np.ndarray Array of electrode positions (Nx3). labels : list List of electrode labels/names.
Source code in tit/tools/map_electrodes.py
load_electrode_positions_json ¶
Load optimized electrode positions from electrode_positions.json.
Parameters¶
json_path : str Path to the electrode_positions.json file.
Returns¶
positions : np.ndarray Array of optimized electrode positions (Nx3). channel_array_indices : list List of [channel, array] indices for each electrode.
Source code in tit/tools/map_electrodes.py
map_electrodes_to_net ¶
Map optimized electrode positions to nearest EEG net positions using the Hungarian algorithm for optimal assignment.
Parameters¶
optimized_positions : np.ndarray Array of optimized electrode positions (Nx3). net_positions : np.ndarray Array of EEG net electrode positions (Mx3). net_labels : list List of EEG net electrode labels. channel_array_indices : list List of [channel, array] indices for each optimized electrode.
Returns¶
mapping_result : dict Dictionary containing: - optimized_positions: Original optimized positions - mapped_positions: Corresponding net positions - mapped_labels: Labels of mapped net electrodes - distances: Distances between optimized and mapped positions - channel_array_indices: Channel and array indices
Source code in tit/tools/map_electrodes.py
save_mapping_result ¶
Save mapping result to a JSON file.
Parameters¶
mapping_result : dict Dictionary containing mapping information. output_path : str Path where to save the JSON file. eeg_net_name : str, optional Name of the EEG net file used.
Source code in tit/tools/map_electrodes.py
log_mapping_summary ¶
Log a summary of the electrode mapping results.
Parameters¶
mapping_result : dict Dictionary containing mapping information.