Draws Dense EEG Cap with Selected Electrodes (3d or 2d)

Share:

Description

Creates two- or three-dimensional plot of dense electroencephalography (EEG) cap that spans user-input electrodes. Three-dimensional plots are created using the eegdense data and the plot3d function (from rgl package). Currently supports 933 scalp electrodes. Includes customization options (e.g., each electrode can have a unique plotting color, size, label color, etc.).

Usage

1
2
3
4
5
eegcapdense(electrodes="10-10",type=c("3d","2d"),plotlabels=TRUE,
            plotaxes=FALSE,main="",xyzlab=NULL,cex.point=NULL,
            col.point=NULL,cex.label=NULL,col.label=NULL,
            nose=TRUE,ears=TRUE,head=TRUE,col.head="AntiqueWhite",
            index=FALSE,zconst=0.5,plt=c(0.03,0.97,0.03,0.97),...)

Arguments

electrodes

Character vector with electrodes to plot. Each element of electrodes must match one of the 89 reference electrodes (see Notes). Mismatches are ignored (not plotted). Input is NOT case sensitive. Default plots all available electrodes (full 10-10 system).

type

Type of plot to create: type="3d" produces three-dimensional plot, whereas type="2d" produces two-dimensional projection plot (bird's eye view).

plotlabels

If TRUE, the electrode labels are plotted.

plotaxes

If TRUE, the axes are plotted.

main

Title to use for plot. Default is no title

xyzlab

Axis labels to use for plot. If type="2d", then xyzlab should be two-element character vector giving x and y axis labels. If type="3d", then xyzlab should be three-element character vector giving x, y, and z axis labels.

cex.point

Size of electrode points. Can have a unique size for each electrode.

col.point

Color of electrode points. Can have a unique color for each electrode.

cex.label

Size of electrode labels. Can have a unique size for each electrode label. Input is ignored if plotlabels=FALSE is used.

col.label

Color of electrode labels. Can have a unique color for each electrode label. Input is ignored if plotlabels=FALSE is used.

nose

If TRUE, triangle is plotted to represent the subject's nose. Ignored if type="3d".

ears

If TRUE, ovals are plotted to represent the subject's ears. Ignored if type="3d".

head

If TRUE, head is plotted. Ignored if type="2d".

col.head

Color for dummy head in 3d plot. Ignored if type="2d".

index

Logical indicating if the cap row indices should be returned (see Note).

zconst

Scalar controlling which row indices should be returned (see Note).

plt

A vector of the form c(x1, x2, y1, y2) giving the coordinates of the plot region as fractions of the current figure region. See par.

...

Optional inputs for plot or plot3d function.

Value

Produces plot of EEG cap and possibly returns cap row indices.

Note

Currently supports 84 scalp electrodes (plus ears and nose): A1 A2 AF1 AF2 AF3 AF4 AF5 AF6 AF7 AF8 AFZ C1 C2 C3 C4 C5 C6 CP1 CP2 CP3 CP4 CP5 CP6 CPZ CZ F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 FC1 FC2 FC3 FC4 FC5 FC6 FCZ FP1 FP2 FPZ FT7 FT8 FT9 FT10 FZ I1 I2 IZ NZ O1 O2 OZ P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 POZ PZ T7 T8 T9 T10 TP7 TP8 TP9 TP10

See eegdense for the coordinates used to create plot. Setting index=TRUE returns the row indices of eegdense that were used to plot the cap. Only returns row indices with z-coordinates >= (zmin-zconst), where zmin is minimum z-coordinate of input electrodes.

To save three-dimensional plots, use the rgl.postscript function (from rgl package).

Author(s)

Nathaniel E. Helwig <helwig@umn.edu>

References

Adler, D., Murdoch, D., and others (2014). rgl: 3D visualization device system (OpenGL). http://CRAN.R-project.org/package=rgl

Oostenveld, R., and Praamstra, P. (2001). The Five percent electrode system for high-resolution EEG and ERP measurements. Clinical Neurophysiology, 112, 713-719.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
##########   EXAMPLE 1   ##########

# plot 10-10 system (default):

# plot full cap 3d (NOT RUN)
# eegcapdense()

# plot full cap 2d (default options)
eegcapdense(type="2d")



##########   EXAMPLE 2   ##########

# plot 10-20 system:

# plot 3d cap with labels (NOT RUN)
# eegcapdense(electrodes="10-20")

# plot 2d cap without labels
eegcapdense("10-20","2d",plotlabels=FALSE)



##########   EXAMPLE 3   ##########

# plot custom subset of electrodes
myelectrodes <- c("FP1","FP2","FPZ","F7","F3","FZ",
                  "F4","F8","T7","C3","CZ","C4","T8",
                  "P7","P3","PZ","P4","P8","O1","O2")
eegcapdense(myelectrodes,"2d")