NeuroAnalyzer tutorials: Loading electrode positions

The following electrode locations are supported:

Electrodes are positioned along X, Y and Z axes. The head center is at [0, 0, 0]. X axis is left-right, Y axis is back-front and Z axis is bottom-top.

Head dimensions are calculated on the basis of head circumference. Head is modeled as the perfect sphere with its center at the axes origin. Electrode positioning is based on 10-20 International system. In this system, electrode positions are based on the head and nasion-inion distance. Compared with the 10-20 standard, NeuroAnalyzer electrode positions are slightly tilted forward, making the horizontal plane at the Fpz/T7/Oz/T8 level perpendicular to the ground level and placing Cz channel at the head center.

(!) For the horizontal view the fiducial points are inion (IN), nasion (NAS), left and right preauricular area (LPA, RPA)

(!) For the coronal view the fiducial points are left and right preauricular area (LPA, RPA).

(!) For the sagittal view the fiducial points are inion (IN) and nasion (NAS).

(!) In 19-channel systems, T7/T8 channels are sometimes labeled as T3/T4.

The position of fiducial EEG electrodes are:

The position of fiducial head points are: - inion: [0, 1.1, 0] - nasion: [0, -1.1, 0] - RPLA: [-1.1, 0, 0] - LPA: [1.1, 0, 0]

Of course, as seen below, the spherical model is not the perfect representation of the head surface.

(!) Please note that in sagittal CT/MRI images, the nose is directed to the left. Due to the NeuroAnalyzer convention (nose points towards +Y), these images are always flipped horizontally, so that the nose is directed to the right.

Loading electrode positions

Load electrode positions:

# a wrapper function selecting proper import based on file extension
locs = import_locs("locs/standard-10-20-cap19-elmiko.ced")
# load LOCS format
locs = import_locs_ced("locs/standard-10-20-cap19-elmiko.ced")

Add electrode positions to EEG object:

add_locs!(eeg, locs=locs)

Load electrode positions directly into EEG object:

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

Plotting electrode positions

Preview electrodes:

p = plot_locs(locs, ch=1, grid=true)
plot_save(p, file_name="images/locs_1.png")

(!) Grid is useful for placing electrodes manually.

(!) IN: inion, NAS: nasion, RPA: right pre-auricular. LPA: left pre-auricular.

p = plot_locs(locs, ch=1:19, selected=1:2, head_labels=false, ch_labels=true)
plot_save(p, file_name="images/locs_19.png")

Also, electrodes loaded into EEG object may be previewed:

plot_locs(eeg, ch=1)

By default, for 2D plots, electrodes are placed using polar coordinates (planar theta and radius):

p = plot_locs(eeg, cart=false)
plot_save(p, file_name="images/locs_polar.png")

To use Cartesian (X, Y, Z) coordinates:

p = plot_locs(eeg, cart=true)
plot_save(p, file_name="images/locs_cartesian.png")

To plot a XZ plane (front, coronal):

p = plot_locs(eeg, plane=:xz)
plot_save(p, file_name="images/locs_xz.png")

To plot a YZ plane (side, sagittal):

p = plot_locs(eeg, plane=:yz)
plot_save(p, file_name="images/locs_yz.png")

To plot a small plot (e.g. to use it with another channels plot), use the large=false option:

p = plot_locs(eeg, large=false)
plot_save(p, file_name="images/locs_cartesian.png")

(!) Channel labels are not shown if large=false.

(!) Channel colors are consistent across various plot types.

Viewing and editing electrode positions

View electrode data:

locs_details(eeg, ch=1)

Edit electrode position:

edit_locs!(eeg, ch=1, x=-1.0)

Convert spherical to Cartesian coordinates:


Convert Cartesian to spherical coordinates:


Flip or swap axes (frontal channels should be at the top):


locs_flipy!(locs, planar=false)
locs_flipy!(locs, spherical=false)
locs_flipx!(locs, planar=false)
locs_flipx!(locs, spherical=false)



Rotate electrode locations:

locs_rotz(locs, a=10)           # rotate around z axis
locs_roty(locs, a=10)           # rotate around y axis
locs_rotx(locs, a=10)           # rotate around x axis

(!) a specifies angle of rotation (in degrees).

Sometimes electrode locations may require scaling (polar radius value is being multiplied by the scaling factor):

locs_scale!(locs, r=1.2)

Alternatively locations may be maximized to a unit circle:


Save electrode positions (CED, LOCS and TSV format are supported), format will be selected based on the file name extension:

locs_export(eeg, file_name="locs/standard-10-20-cap19-elmiko.locs")
locs_export(locs, file_name="locs/standard-10-20-cap19-elmiko.ced")
locs_export(locs, file_name="locs/standard-10-20-cap19-elmiko.tsv")

Preview electrodes in 3D:

p = plot_locs3d(locs, threed=true, interactive=false, selected=1:2)
p = plot_locs(eeg, selected=1:19, threed=true, interactive=false)
plot_save(p, file_name="images/locs3d.png")

(!) By default, for 3D plots, electrodes are placed using Cartesian coordinates (x, y and z).

To plot using spherical coordinates (radius, theta and phi):

p = plot_locs3d(locs, cart=false)

To use interactive plot:

plot_locs(eeg, selected=1:2, threed=true, interactive=true)
iplot_locs3d(locs, selected=1:2)

(!) Hold the left mouse button and move mouse to rotate the view.

(!) Press the right mouse button to reset the view.