RAVE reads the file electrodes.csv to store information about each electrode, one row per electrode. Because electrode locations are different in every subject, each subject has a different electrodes.csv file, located in the directory tree
Here is the contents of a sample electrodes.csv file:
Electrode Coord_x Coord_y Coord_z Label 13 -68.86721 7.1108970 15.57871 G13 14 -70.83457 -0.7146498 17.87189 G14 15 -71.80737 -9.9609583 22.41152 G15
There are five required columns in each electrodes.csv file. The first column must be labelled "Electrode" and lists a unique number for each electrode (typically, the clinical channel number used to record data from that electrode). The second column must be labelled "Coord_x" and contains the x-coordinate of the electrode in the tk-RAS (FreeSurfer) coordinate system. The third column and fourth columns are the y and z co-ordinates. The fifth column must be called "Label" and contains the name of electrode. Additional columns may also be present in the file. For instance, the cortical surface vertex closest to the electrode; the anatomical location of the electrode; and so on. If there are additional columns, RAVE will read them and allow you to filter electrodes accordingly (e.g. "only electrodes with label = superior temporal").
There are many solutions for localizing electrodes. For more information, see
- Beauchamp:Electrode Localization and Naming
- Creating a Surface Model and Electrode Localization (by Muge Ozker Sertel)
- Electrode Localization using iELVis (by Buffy Nesbitt)
- Electrode Localization using steps from the ALICE package
- Electrode Localization using steps from the img_pipe package
RAVE contains experimental tools for electrode localization, access with
Automatic Label Generation
RAVE provides tools to generate additional electrode labels automatically if FreeSurfer or SUMA files are provided. The following script calculates MNI305 coordinates and nearest hemisphere etc. Simply replace `project_name` and `subject_code` before executing.
project_name <- "demo" subject_code <- "YAB" brain <- rave::rave_brain2(sprintf('%s/%s', project_name, subject_code)) brain$electrodes$raw_table$SurfaceElectrode <- TRUE tbl <- brain$calculate_template_coordinates() rave::save_meta(data = tbl, meta_type = 'electrodes', project_name, subject_code)
The fully expanded electrodes.csv with optional columns looks like this.
Electrode Coord_x Coord_y Coord_z Label MNI305_x MNI305_y MNI305_z SurfaceElectrode SurfaceType Radius VertexNumber Hemisphere 13 -68.86721 7.1108970 15.57871 G13 -75.58190 -11.96114 -7.205155 TRUE pial 2 139280 left 14 -70.83457 -0.7146498 17.87189 G14 -77.13832 -21.71118 -2.563521 TRUE pial 2 144135 left 15 -71.80737 -9.9609583 22.41152 G15 -77.52183 -33.03184 5.295971 TRUE pial 2 144936 left
Columns MNI305_x, MNI305_y, MNI305_z are MNI305 coordinates. Column SurfaceElectrode is logical TRUE/FALSE indicating whether the electrode is grid electrode floating on the surface (TRUE) or depth electrode inserted (FALSE). Column SurfaceType is for surface electrodes only, indicating the nearest surface structure. Column Radius will affect electrode render sizes. Column Hemisphere is the nearest hemisphere (left/right). If SUMA standard 141 brain is used, column VertexNumber will be the vertex number of corresponding hemisphere that is closest to the electrode. If SUMA standard 141 brain is missing, or the electrode is marked as depth electrode, VertexNumber will be -1.