NeuroAnalyzer tutorials: Process EEG (1)

Reference to channel(s) - if more than one channel is used as reference, the average of these channels is used:

reference_ce!(eeg, ch=[1, 2])
reference_ce!(eeg, ch=2:4)
reference_ce!(eeg, ch=18)

Reference to common average:

# do not include current electrode and Fp1, Fp2, O1 and O2 when calculating common average
reference_avg!(eeg, exclude_fpo=true, exclude_current=true)

Reference to ipsilateral auricular electrodes:

reference_a!(eeg, type=:i)

Reference to contralateral mastoid electrodes:

reference_m!(eeg, type=:c)

Reference using planar Laplacian:

eeg_avg = reference_avg(eeg)
p1 = plot_topo(eeg_avg, seg=(12, 14), title="AVG",)
eeg_wavg = reference_avg(eeg, weighted=true)
p2 = plot_topo(eeg_avg, seg=(12, 14), title="WAVG",)
eeg_lap = reference_plap(eeg, nn=4, weighted=false)
p3 = plot_topo(eeg_lap, seg=(12, 14), title="Laplacian (4)")
eeg_lap = reference_plap(eeg, nn=4, weighted=true)
p4 = plot_topo(eeg_lap, seg=(12, 14), title="weighted Laplacian (4)")
p = plot(p1, p2, p3, p4, layout=(2,2))
plot_save(p, file_name="images/lap4.png")

(!) Planar Laplacian referencing required electrode locations.

Custom referencing, e.g. bipolar longitudinal:

eeg_bipl = reference_custom(eeg, ref_list=["Fz-Cz", "Cz-Pz", "Fp1-F7", "Fp1-F3", "F7-T3", "T3-T5", "T5-O1", "F3-C3", "C3-P3", "P3-O1", "Fp2-F8", "Fp2-F4", "F8-T4", "T4-T6", "T6-O2", "F4-C4", "C4-P4", "P4-O2"], ref_name="longitudinal-BIP")


              Data type: EEG
            File format: EDF
            Source file: ~/.julia/artifacts/25cbd5d6479ab71d126b918e5b7eefa495dface0/test-files/eeg-test-edf.edf
         File size [MB]: 14.19
       Memory size [MB]: 59.09
              Recording: EEGDigiTrack EEG-1042 (42-channel EEG Amplifier) V0.5 Rev. 41
        Recording notes: 
         Recording date: 25.04.22
         Recording time: 09.31.41
     Sampling rate (Hz): 256
Signal length [samples]: 309760
Signal length [seconds]: 1210.0
     Number of channels: 23
       Number of epochs: 1
 Epoch length [samples]: 309760
 Epoch length [seconds]: 1210.0
         Reference type: longitudinal-BIP
                 Labels: yes
                Markers: no
      Channel locations: no
             Components: no
 ch     label           type        unit    
 1      Fz-Cz           EEG         μV      
 2      Cz-Pz           EEG         μV      
 3      Fp1-F7          EEG         μV      
 4      Fp1-F3          EEG         μV      
 5      F7-T3           EEG         μV      
 6      T3-T5           EEG         μV      
 7      T5-O1           EEG         μV      
 8      F3-C3           EEG         μV      
 9      C3-P3           EEG         μV      
 10     P3-O1           EEG         μV      
 11     Fp2-F8          EEG         μV      
 12     Fp2-F4          EEG         μV      
 13     F8-T4           EEG         μV      
 14     T4-T6           EEG         μV      
 15     T6-O2           EEG         μV      
 16     F4-C4           EEG         μV      
 17     C4-P4           EEG         μV      
 18     P4-O2           EEG         μV      
 19     A1              REF         μV      
 20     A2              REF         μV      
 21     EOG1            EOG         μV      
 22     EOG2            EOG         μV      
 23     ECG             ECG         mV

Examples of other montages:

Custom montages may be loaded from a file:

ref_l, ref_n = import_montage(joinpath(NeuroAnalyzer.PATH, "montages", "bip_long.mnt"))
reference_custom(eeg, ref_listref_l, ref_name=ref_n)

Example montage files are located in the montages/ folder.

(!) The structure of the montage file is:

Each channel/channel pair must be in a separate line

Edit already exiting montage:


(!) This will open the .mnt file in the OS editor.