Electrode Names

Channel Locations

Initialize NeuroAnalyzer
using NeuroAnalyzer
using CairoMakie
CairoMakie.activate!(type = "png")
# Quarto sets a default figure size (672 × 480 px), which overrides the sizes of
# NeuroAnalyzer figures: remove it
delete!(CairoMakie.Makie.CURRENT_DEFAULT_THEME, :resolution)
# remove the default figure size set by Quarto in the Makie theme:
# NeuroAnalyzer plots set their own size
set_theme!()
eeg = load_neuro("files/eeg/eeg.hdf")
# standard 10/5 positions (2-D layout)
std_locs = import_locs("files/locs/standard_1005_2D.tsv")

Brain Region

Each electrode label starts with one or two letters naming the brain region under the electrode:

  • Fp: pre-frontal (frontopolar)
  • F: frontal
  • T: temporal
  • C: central (over the sensorimotor cortex)
  • P: parietal
  • O: occipital

Midline Electrodes

  • z (“zero”): electrodes on the midline (sagittal plane) of the head, e.g. Fpz, Fz, Cz, Pz, Oz.
  • Midline electrodes are often used as reference or ground sites and for comparing the two hemispheres.

Left and Right Hemisphere

  • Odd numbers (1, 3, 5, 7, 9): electrodes over the left hemisphere.
  • Even numbers (2, 4, 6, 8, 10): electrodes over the right hemisphere.
  • Numbers increase with the distance from the midline (e.g. C1 is close to Cz, C5 is close to T7).
  • The same rule is used for EOG electrodes (e.g. EOG1 left, EOG2 right).

Other Electrodes

  • A1 and A2: on the earlobes (auricular).
  • M1 and M2: on the mastoid processes (the bone behind the ear).
  • Both pairs are used as reference electrodes; they also pick up mid-temporal activity of the ipsilateral hemisphere. The mastoid process is less prominent in children and some adults.
  • Chin (EMG) electrodes: usually labeled Left, Right and Reference/Common; they record muscle activity (e.g. in sleep studies).

The 10/20 System

  • Standard layout: 21 electrodes: 19 scalp electrodes and 2 earlobe reference electrodes (A1, A2).
  • 10/20 rule: electrodes are placed at 10% or 20% intervals of the distances between anatomical landmarks: nasion to inion (front to back) and left to right preauricular point (through the vertex).
  • Purpose: consistent, reproducible electrode placement across subjects, independent of the head size.

The 19 scalp electrodes of the 10/20 system (modern names, see below):

ch_1020 = ["Fp1", "Fp2",
           "F7", "F3", "Fz", "F4", "F8",
           "T7", "C3", "Cz", "C4", "T8",
           "P7", "P3", "Pz", "P4", "P8",
           "O1", "O2"]
locs_1020 = filter(:label => in(ch_1020), std_locs)
plot_locs(locs_1020; cart = true, gui = false)

Landmarks and Distances

Front to Back (Midline) Right to Left (Through Cz)
nasion right preauricular point
10% 10%
Fpz T8 (T4)
20% 20%
Fz C4
20% 20%
Cz Cz
20% 20%
Pz C3
20% 20%
Oz T7 (T3)
10% 10%
inion left preauricular point

Modified Combinatorial Nomenclature

The Modified Combinatorial Nomenclature (MCN) extends the 10/20 system with intermediate electrode sites and makes the electrode names consistent. It allows a higher spatial resolution of EEG recordings.

New Letter Codes

Intermediate rows between the 10/20 rows are named by combining the letters of the neighboring rows:

  • AF: between Fp and F
  • FC: between F and C
  • FT: between F and T
  • CP: between C and P
  • TP: between T and P
  • PO: between P and O

Numbers

Numbers give the position along a row, counted from the midline: in the 10/10 system, consecutive electrodes are 10% of the coronal (left-right) arc apart, e.g. C1, C3, C5 and T7 lie 10%, 20%, 30% and 40% to the left of Cz.

Renamed Electrodes

All electrodes of the same coronal line get the same letter, so four 10/20 electrodes are renamed:

  • T3 → T7
  • T4 → T8
  • T5 → P7
  • T6 → P8

Tip: In 19-channel systems, the old names (T3, T4, T5, T6) are still common.

High-Resolution Systems

10/10 System

  • Electrodes: about 70-80 positions (compared with 21 in the 10/20 system).
  • Placement: 10% divisions: intermediate sites halfway between the 10/20 electrodes (Chatrian et al., 1985; American Clinical Neurophysiology Society guidelines).

The 10/10 electrodes (without the inferior row: F9, FT9, T9, TP9, P9 and their right-side counterparts, placed below the level of T7/T8):

ch_1010 = ["Fp1", "Fpz", "Fp2",
           "AF7", "AF3", "AFz", "AF4", "AF8",
           "F7", "F5", "F3", "F1", "Fz", "F2", "F4", "F6", "F8",
           "FT7", "FC5", "FC3", "FC1", "FCz",
           "FC2", "FC4", "FC6", "FT8",
           "T7", "C5", "C3", "C1", "Cz", "C2", "C4", "C6", "T8",
           "TP7", "CP5", "CP3", "CP1", "CPz",
           "CP2", "CP4", "CP6", "TP8",
           "P7", "P5", "P3", "P1", "Pz", "P2", "P4", "P6", "P8",
           "PO7", "PO3", "POz", "PO4", "PO8",
           "O1", "Oz", "O2"]
locs_1010 = filter(:label => in(ch_1010), std_locs)
plot_locs(locs_1010; cart = true, gui = false)

10/5 System

  • Electrodes: more than 300 positions, placed at 5% intervals (Oostenveld and Praamstra, 2001).
  • Purpose: high-density EEG and more precise source localization.

EOG Electrodes

Placement

  • EOG1: left side of the face, near the outer canthus of the left eye.
  • EOG2: right side of the face, near the outer canthus of the right eye.
  • For vertical eye movements, an electrode above and/or below one eye is added.

Eye Movements

  • VEOG (vertical EOG): vertical eye movements (blinks, upward/downward gaze).
  • HEOG (horizontal EOG): horizontal eye movements (left/right gaze).

Purpose

  • Artifact detection: identifying and removing eye movement artifacts from the EEG, e.g. using ICA (see ICA): eye movement components have large, slow (< 4 Hz) deflections and a frontal topography (VEOG: Fp1, Fp2; HEOG: F7, F8 with opposite polarities).
  • Sleep studies: monitoring REM (rapid eye movement) sleep and scoring sleep stages.
  • Cognitive research: tracking eye movements during tasks involving visual attention or reading.

ECG Electrodes

Placement

ECG electrodes record the heart activity during EEG studies, e.g.:

  1. Under the right clavicle (just below the right collarbone).
  2. Left midclavicular line, slightly lower than the right clavicle electrode.
  3. 5th left intercostal space (between the 5th and 6th ribs).

Purpose

  • Heart rate monitoring: heart rate and rhythm.
  • Artifact detection: identifying and removing cardiac artifacts (e.g. pulse artifacts) from the EEG.
  • Integration with EEG: correlating heart rate variability (HRV) with brain activity.

Picks and Clusters

Electrode clusters are groups of electrodes analyzed together to study a brain region or function. Averaging over a cluster improves the signal-to-noise ratio and simplifies the functional interpretation.

Common Electrode Clusters

Cluster Electrodes (10/20 and 10/10) Brain Region / Function
Frontal Fp1, Fp2, F3, F4, F7, F8, Fz Frontal lobe: executive function, attention, decision-making, working memory
Temporal T7, T8, F7, F8, FT9, FT10 Temporal lobe: auditory processing, language, memory
Central C3, C4, Cz, FC1, FC2, FC5, FC6 Central region: motor cortex, sensorimotor processing
Parietal P3, P4, P7, P8, Pz, CP1, CP2, CP5, CP6 Parietal lobe: spatial orientation, sensory integration, attention
Occipital O1, O2, Oz, PO3, PO4, PO7, PO8 Occipital lobe: visual processing
Midline Fz, Cz, Pz, Oz Midline structures, global brain states
Fronto-central F3, F4, C3, C4, FC3, FC4 Motor planning, cognitive control
Parieto-occipital P3, P4, O1, O2, PO3, PO4 Visual-spatial integration, attention

Brain Regions (10/10 Electrodes)

Region Electrodes
Frontal Fp1, Fpz, Fp2, AF7, AF3, AF4, AF8, F7, F5, F3, F1, Fz, F2, F4, F6, F8
Motor FC5, FC3, FC1, FCz, FC2, FC4, FC6
Sensory C5, C3, C1, Cz, C2, C4, C6, CP5, CP3, CP1, CPz, CP2, CP4, CP6
Temporal FT7, T7, TP7 (left); FT8, T8, TP8 (right)
Parietal P7, P5, P3, P1, Pz, P2, P4, P6, P8
Occipital PO7, PO3, POz, PO4, PO8, O1, Oz, O2

NeuroAnalyzer Clusters

Clusters available in channel_cluster():

Cluster Electrodes
:f1 Fp1, AF7, AF3, F9, F7, F5, F3, F1
:f2 Fp2, AF8, AF4, F10, F8, F6, F4, F2
:t1 FT9, FT7, FC5, FC3, T9, T7, C5, C3
:t2 FT10, FT8, FC6, FC4, T10, T8, C6, C4
:c1 FC1, FCz, FC2, C1, Cz, C2
:c2 CP1, CPz, CP2, P1, Pz, P2
:p1 TP9, TP7, CP5, CP3, P9, P7, P5, P3
:p2 TP10, TP8, CP6, CP4, P10, P8, P6, P4
:o PO9, PO7, PO3, POz, PO4, PO8, PO10, O1, O2

Channel labels of a region (pick), e.g. left fronto-temporal channels:

channel_pick(eeg; pick = [:l, :f, :t])
5-element Vector{String}:
 "Fp1"
 "F3"
 "F7"
 "T3"
 "T5"

Tip: Available picks: :central (:c, midline), :left (:l), :right (:r), :frontal (:f), :temporal (:t), :parietal (:p), :occipital (:o).

Channel labels of a cluster:

channel_cluster(eeg; cluster = :f1)
3-element Vector{String}:
 "Fp1"
 "F3"
 "F7"

Tip: Available clusters: :f1, :f2, :t1, :t2, :c1, :c2, :p1, :p2, :o.

Purpose of Electrode Clusters

  • Regional analysis: localized functions (e.g. visual processing in the occipital cluster).
  • Functional networks: connectivity between brain regions (e.g. fronto-parietal networks of attention).
  • Noise reduction: combining signals of neighboring electrodes reduces noise.
  • Clinical applications: abnormal patterns in specific regions (e.g. epileptic activity in the temporal clusters).

Electrode Positions in NeuroAnalyzer

Coordinate System

Electrodes are positioned along the X, Y and Z axes (Cartesian coordinates). The head center is at [0, 0, 0]. The X axis runs from left to right, the Y axis from back to front (the nose points towards +Y) and the Z axis from bottom to top.

Electrode positions are stored in the OBJ.locs DataFrame, with the columns:

  • label: channel label
  • loc_theta: polar angle
  • loc_radius: polar radius
  • loc_x: Cartesian X
  • loc_y: Cartesian Y
  • loc_z: Cartesian Z
  • loc_radius_sph: spherical radius
  • loc_theta_sph: spherical horizontal angle
  • loc_phi_sph: spherical azimuth angle (elevation)
first(eeg.locs, 5)
5×9 DataFrame
Row label loc_radius loc_theta loc_x loc_y loc_z loc_radius_sph loc_theta_sph loc_phi_sph
String Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64
1 Fp1 1.0 108.0 -0.31 0.95 -0.03 1.0 108.02 -1.72
2 Fp2 1.0 72.0 0.31 0.95 -0.03 1.0 71.98 -1.72
3 F3 0.65 129.0 -0.55 0.67 0.5 1.0 129.0 30.0
4 F4 0.65 51.0 0.55 0.67 0.5 1.0 51.0 30.0
5 C3 0.51 180.0 -0.72 0.0 0.7 1.0 180.0 43.82

Tip: The example recording stores positions already scaled to the unit sphere.

By default, plots use the polar coordinates for the top (XY) view and the spherical coordinates for the front (XZ), side (YZ) and 3-D views (converted internally to X, Y and Z). With cart = true, the Cartesian coordinates are used for all views.

Units

Electrode positions are stored as they are in the source file, in its original units (e.g. mm, cm or m; FIFF positions are in meters). Importing only converts the axes orientation to the NeuroAnalyzer convention (nose towards +Y); it does not scale the coordinates. Positions are never modified by functions that only use them.

Functions that need positions on a unit sphere scale a temporary copy of the whole montage, so that the outermost electrode is at radius 1:

  • plots (plot_locs(), plot_locs3d(), plot_topo(), topographic layouts of plot_psd(), plot_erp(), etc.),
  • topographic interpolation (plinterpolate(), plot_topo()).

Spherical splines (sphinterpolate(), csd()), the surface Laplacian reference (reference_slap()) and REST (reference_rest()) project the positions on the unit sphere themselves, so they also work with any units.

For example, the positions in this GEO file are in millimeters:

geo = import_locs("files/locs/EEG10-10_UI_Jurak_2007.geo")
r = sqrt.(geo.loc_x .^ 2 .+ geo.loc_y .^ 2 .+ geo.loc_z .^ 2)
println("Electrodes: ", size(geo, 1))
println("Largest distance from the origin: ", round(maximum(r); digits = 1))
Electrodes: 80
Largest distance from the origin: 119.5

They are plotted without any conversion:

plot_locs(geo; ch_labels = false, gui = false)

To scale the positions explicitly (polar, Cartesian and spherical radius equal to 1 for the outermost electrode), use locs_normalize():

geo_n = locs_normalize(geo)
r = sqrt.(geo_n.loc_x .^ 2 .+ geo_n.loc_y .^ 2 .+ geo_n.loc_z .^ 2)
println("Largest distance from the origin: ", round(maximum(r); digits = 1))
Largest distance from the origin: 1.0

Tip: Keep the original units if physical distances are needed: e.g. od2conc() (with partial path length factors ≠ 1) uses the source-detector distances in mm and dipole_fit() expects positions in mm (loc_scale = 1e-3). Normalized positions give wrong results in such computations.

Head Dimensions

The head is modeled as a sphere with its center at the axes origin. Electrode positions follow the 10-20 International system, based on the nasion-inion and the left-right preauricular distances. Compared with the 10-20 standard, NeuroAnalyzer electrode positions are slightly tilted forward: the horizontal plane at the Fpz/T7/Oz/T8 level is parallel to the ground and the Cz electrode is at the top of the head.

Tip: For the horizontal (top) view, the fiducial points are the inion (IN), nasion (NAS), left and right preauricular points (LPA, RPA).

Tip: For the coronal (front) view, the fiducial points are the left and right preauricular points (LPA, RPA).

Tip: For the sagittal (side) view, the fiducial points are the inion (IN) and nasion (NAS).

On the unit sphere, the landmark electrodes are at:

  • Cz: [0, 0, 1]
  • Fpz: [0, 1, 0]
  • T7: [-1, 0, 0]
  • T8: [1, 0, 0]
  • Oz: [0, -1, 0]

The fiducial head points used in plots are:

NeuroAnalyzer.fiducial_points
(nasion = (0.0, 1.03, -0.2), inion = (0.0, -1.03, -0.2), lpa = (-1.04, 0.2, -0.2), rpa = (1.04, 0.2, -0.2))

Spherical Head Model

Limitations

  • The spherical model is a simplified representation of the head and does not perfectly match the real head shape, which is asymmetrical and non-spherical.
  • Electrode positions based on the spherical model may deviate slightly from the real positions on the scalp.
  • Despite this, the spherical model is widely used for standardization and ease of computation.

Views

Top view (XY plane): the distribution of electrodes on the top of the head, their symmetry and spatial arrangement.

Front view (XZ plane, coronal): electrodes over the frontal region and both hemispheres.

Side view (YZ plane, sagittal): electrodes over the frontal, central, parietal and occipital regions along the midline.

Imaging Convention

  • In standard sagittal CT/MRI images, the nose is directed to the left.
  • In NeuroAnalyzer, the nose points towards +Y, so sagittal images are flipped horizontally (the nose is directed to the right).

Supported File Formats

import_locs() selects the importing function based on the file extension:

Extension Function Source Coordinates
.ced import_locs_ced() EEGLAB polar, Cartesian and spherical
.locs import_locs_locs() EEGLAB polar
.elc import_locs_elc() ASA / ANT Neuro, EETrak Cartesian
.tsv import_locs_tsv() BIDS electrodes.tsv (name, x, y, z) Cartesian
.sfp import_locs_sfp() BESA / EGI Cartesian
.csd import_locs_csd() CSD toolbox spherical and Cartesian
.geo import_locs_geo() EGI GeoScan Cartesian
.mat import_locs_mat() MATLAB 2-D layout (Cpos, Cnames) 2-D Cartesian
.txt import_locs_txt() spherical theta/phi list (e.g. BioSemi) spherical
.dat import_locs_dat() Neuroscan Cartesian
.asc import_locs_asc() Neuroscan Cartesian
.csv import_locs_csv() NeuroAnalyzer all
.fif import_locs_fiff() MNE / Elekta (MEG and EEG) Cartesian (m)

Tip: FIFF locations are read using import_locs_fiff() (not via import_locs()); import_fiff() loads them together with the data.

If a file contains one coordinate set only, the other sets are calculated from it (e.g. polar and spherical from Cartesian).

Typical Workflow

  1. Import the locations file: locs = import_locs(file_name).
  2. Check the orientation: plot_locs(locs) should show the frontal electrodes at the top (nose) and the left hemisphere on the left.
  3. If needed, fix the orientation: flip (locs_flipx!(), locs_flipy!()), swap the axes (locs_swapxy!()) or rotate (locs_rotz!()).
  4. Add the positions to the recording: add_locs!(eeg; locs = locs) (matched by channel labels).
  5. Check the result: plot_locs(eeg; ch = "eeg"), or open the interactive editor: edit_locs!(eeg).

Loading Electrode Positions

import_locs() reads a locations file:

locs = import_locs("files/locs/standard-10-20-cap19-elmiko.ced")
19×9 DataFrame
Row label loc_radius loc_theta loc_x loc_y loc_z loc_radius_sph loc_theta_sph loc_phi_sph
String Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64
1 Fp1 0.511 108.0 -0.309 0.95 -0.0349 1.0 108.0 -2.0
2 Fp2 0.511 72.0 0.309 0.95 -0.0349 1.0 72.0 -2.0
3 F7 0.511 144.0 -0.809 0.587 -0.0349 1.0 144.0 -2.0
4 F3 0.333 129.0 -0.545 0.673 0.5 1.0 129.0 30.0
5 Fz 0.256 90.0 0.0 0.719 0.695 1.0 90.0 44.0
6 F4 0.333 51.0 0.545 0.673 0.5 1.0 51.0 30.0
7 F8 0.511 36.0 0.809 0.587 -0.0349 1.0 36.0 -2.0
8 T3 0.511 180.0 -0.999 6.12e-17 -0.0349 1.0 -180.0 -2.0
9 C3 0.256 180.0 -0.719 4.4e-17 0.695 1.0 -180.0 44.0
10 Cz 0.0 0.0 6.12e-17 3.75e-33 1.0 1.0 0.0 90.0
11 C4 0.256 0.0 0.719 4.4e-17 0.695 1.0 0.0 44.0
12 T4 0.511 0.0 0.999 6.12e-17 -0.0349 1.0 0.0 -2.0
13 T5 0.511 216.0 -0.809 -0.587 -0.0349 1.0 -144.0 -2.0
14 P3 0.333 231.0 -0.545 -0.673 0.5 1.0 -129.0 30.0
15 Pz 0.256 270.0 8.81e-17 -0.719 0.695 1.0 -90.0 44.0
16 P4 0.333 309.0 0.545 -0.673 0.5 1.0 -51.0 30.0
17 T6 0.511 324.0 0.809 -0.587 -0.0349 1.0 -36.0 -2.0
18 O1 0.511 252.0 -0.309 -0.95 -0.0349 1.0 -108.0 -2.0
19 O2 0.511 288.0 0.309 -0.95 -0.0349 1.0 -72.0 -2.0

Format-specific functions can also be used directly:

locs = import_locs_ced("files/locs/standard-10-20-cap19-elmiko.ced")

Adding electrode positions to a NEURO object (positions are matched to channels by label):

add_locs!(eeg; locs = locs)

Alternatively, loading a locations file directly into a NEURO object:

load_locs!(eeg; file_name = "files/locs/standard-10-20-cap19-elmiko.ced")

Plotting Electrode Positions

Preview electrodes:

plot_locs(locs; ch = 1:19, grid = true, gui = false)

Tip: The grid is useful for placing electrodes manually.

Tip: IN: inion, NAS: nasion, LPA: left preauricular point, RPA: right preauricular point.

To highlight channels, use the sch argument:

plot_locs(locs;
          ch = 1:19,
          sch = [1, 2],
          head_labels = false,
          ch_labels = true,
          gui = false)

Previewing electrodes of a NEURO object:

plot_locs(eeg; ch = "eeg", gui = false)

By default, 2-D plots use the polar coordinates (planar theta and radius). To use the Cartesian (X, Y, Z) coordinates:

plot_locs(eeg; ch = "eeg", cart = true, gui = false)

Front view (XZ plane, coronal):

plot_locs(eeg; ch = "eeg", plane = :xz, gui = false)

Side view (YZ plane, sagittal):

plot_locs(eeg; ch = "eeg", plane = :yz, gui = false)

Tip: For legibility, channel labels may be disabled using ch_labels = false.

Smaller plots (e.g. to be used together with another plot) are drawn with ps = :m or ps = :s:

plot_locs(eeg; ch = "eeg", sch = "eeg", ps = :m, gui = false)

Tip: Channel labels are not shown if ps = :m or ps = :s.

Tip: Channel colors are consistent across plot types.

A locations plot can be added to another plot using add_inset():

ch = ["Fp1", "Fp2", "F3", "F4"]
p = plot_psd(eeg; ch = ch, seg = (20, 30), flim = (0, 40), gui = false)
pl = plot_locs(eeg; ch = ch, sch = ch, ps = :s, gui = false)
add_inset(p, pl; pos = :outside)

Tip: ERP/ERF, PSD and phase plots draw the locations of the plotted channels themselves when ch_locs = true (ch_locs_pos sets the inset position).

Editing Electrode Positions

Viewing electrode details:

locs_details(eeg; ch = "Fp1")
  Label: Fp1
  Theta: 108.0 (polar)
 Radius: 1.0 (polar)
      X: -0.31 (Cartesian)
      Y: 0.95 (Cartesian)
      Z: -0.03 (Cartesian)
 Radius: 1.0 (spherical)
  Theta: 108.02 (spherical)
    Phi: -1.72 (spherical)
(label = "Fp1", theta_pl = 108.0, radius_pl = 1.0, x = -0.31, y = 0.95, z = -0.03, theta_sph = 108.02, radius_sph = 1.0, phi_sph = -1.72)

Editing the position (and optionally the label and type) of one channel:

edit_locs!(eeg; ch = "Fp1", x = -0.3, y = 0.95)

Tip: Only the given coordinates are changed; update the other coordinate sets using the conversion functions below.

Converting between coordinate sets:

# spherical → Cartesian
locs_sph2cart!(locs)
# Cartesian → spherical
locs_cart2sph!(locs)
# Cartesian → polar
locs_cart2pol!(locs)
# polar → Cartesian
locs_pol2cart!(locs)
# spherical → polar
locs_sph2pol!(locs)
# polar → spherical
locs_pol2sph!(locs)

Flipping and swapping axes (e.g. if the frontal channels are not at the top of the plot):

locs_flipx!(locs)
locs_flipy!(locs)
locs_flipz!(locs)
locs_swapxy!(locs)

Tip: The polar, cart and spherical arguments select the coordinate sets that are modified, e.g. locs_flipy!(locs; polar = false) keeps the polar coordinates.

Rotating electrode locations:

# rotate around the Z axis
locs_rotz!(locs; a = 10)
# rotate around the Y axis, keep the Cartesian coordinates
locs_roty!(locs; a = 10, cart = false)
# rotate around the X axis, keep the polar coordinates
locs_rotx!(locs; a = 10, polar = false)

Tip: a is the rotation angle in degrees; a positive angle rotates anti-clockwise around the X and Z axes and clockwise around the Y axis.

Scaling (radius multiplied by the scaling factor):

locs_scale!(locs; r = 1.2)

Normalizing the positions to the unit sphere:

locs_normalize!(locs)

Centering the positions at the origin, or moving the origin (the shift is in the units of the positions):

locs_center!(locs)
locs_origin!(locs; z = -0.1)

Generating standard 10/10 positions for channels with known labels:

locs_generate!(locs)

Saving electrode positions (CED, LOCS and TSV formats; CSV for NEURO objects only); the format is selected by the file name extension:

export_locs(eeg; file_name = "eeg.locs")
export_locs(locs; file_name = "locs.ced")
export_locs(locs; file_name = "locs.tsv")

3-D Preview

Previewing electrodes in 3-D:

p = plot_locs3d(eeg; ch = "eeg", sch = ["Fp1", "Fp2"], gui = false)
plot_save(p; file_name = "images/plot_locs3d.png")

Tip: With gui = true, the plot window is interactive; otherwise the rendered plot is returned.

In the interactive window, rotate the view by left-clicking and dragging, move the view by right-clicking and dragging and zoom using the mouse wheel.

Keyboard shortcuts:

  • t: top view
  • r: right view
  • l: left view
  • f: front view
  • b: back view
  • Home: reset the view
  • s: save the view as a PNG image

Tip: By default, 3-D plots use the spherical coordinates; use cart = true for the Cartesian coordinates.

Drawing a brain mesh together with the electrode positions:

p = plot_locs3d(eeg;
                ch = "eeg",
                sch = ["Fp1", "Fp2"],
                mesh_type = :brain,
                gui = false)
plot_save(p; file_name = "images/locs_brain.png")

Drawing a head mesh:

p = plot_locs3d(eeg;
                ch = "eeg",
                sch = ["Fp1", "Fp2"],
                mesh_type = :head,
                gui = false)
plot_save(p; file_name = "images/locs_head.png")

Tip: The mesh opacity is set using the mesh_alpha argument, from 1 (opaque) to 0 (transparent).

Tip: The cam argument sets the initial camera position: elevation and azimuth (in degrees).

Interactive Channels and Locations Editor

Called without ch, edit_locs() opens the interactive editor (EEG and MEG objects):

# edit in-place: changes are written to eeg after clicking "Apply"
edit_locs!(eeg)
# or edit a copy: returns the edited object (unchanged if cancelled)
eeg_new = edit_locs(eeg)

The window opens maximized. The current channel is shown in red in 4 views: top (X-Y), front (X-Z), side (Y-Z) and 3-D.

Selecting a channel: choose it from the list, step through the channels using the ◄ / ► buttons, or click its electrode in one of the 2-D views.

Channel properties: the label, type (e.g. “eeg”) and unit (e.g. “μV”) of the current channel. Changing the type sets the default unit of that type.

Coordinates: the Cartesian (X, Y, Z), spherical (radius, θ, φ) and polar (radius, θ) coordinates of the current channel are shown and edited as stored, in their original units. A typed value is applied after pressing Enter or leaving the field. A channel without a location gets one when any of its coordinates is entered.

Transformations of all locations: flip over the X/Y/Z axis, swap the X and Y axes, center, rotate around the X/Y/Z axis (angle in degrees), scale by a factor, normalize to the unit sphere, move the origin along the X/Y/Z axis, convert between the coordinate sets and generate standard 10/10 positions. The “Apply to” check boxes select the coordinate sets (polar, Cartesian, spherical) modified by flipping, swapping, centering, rotating, scaling and normalizing.

Tip: ref and eog channels are usually placed at fixed positions, so they are not affected by the transformations (except for the conversions and generating the 10/10 positions).

Undo: every change of the locations can be undone (up to 50 steps).

File: enter a file path to load locations from a file (any supported format) or to save them (CED, LOCS, TSV or CSV; saving over an existing file requires a second click).

View: the “Cartesian coordinates” switch selects the coordinates used for plotting: when on, the Cartesian coordinates are used for all views; when off, the polar coordinates are used for the top view and the spherical coordinates for the front, side and 3-D views. Channel labels may be shown in all views.

Delete channel removes the current channel (a second click confirms); deleting clears the undo history.

All changes are made to a copy of the object: click “Apply” to keep them, or “Cancel” (or close the window) to discard them.

Tip: Numeric fields accept numbers only.

10/20 Channels on a Grid

A simplified layout of the 10/20 channels on a grid:

fig = plot_gridlocs()

It is possible to draw over that template:

CairoMakie.scatter!(fig[1, 1],
                    0, 0;
                    markersize = 50,
                    color = :red,
                    alpha = 0.5)
fig

0, 0 is the location of the added marker.

Grid positions (X, Y) of the channels:

Row Channels X Y
frontopolar Fp1, Fpz, Fp2 -0.5, 0, 0.5 1.0
frontal F7, F3, Fz, F4, F8 -1.0, -0.5, 0, 0.5, 1.0 0.5
central T3, C3, Cz, C4, T4 -1.0, -0.5, 0, 0.5, 1.0 0.0
parietal T5, P3, Pz, P4, T6 -1.0, -0.5, 0, 0.5, 1.0 -0.5
occipital O1, Oz, O2 -0.5, 0, 0.5 -1.0