| 1 |
/* manual_EEG.cpp |
| 2 |
* |
| 3 |
* Copyright (C) 2012,2015,2016,2018,2019,2023,2025 Paul Boersma |
| 4 |
* |
| 5 |
* This code is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 3 of the License, or (at |
| 8 |
* your option) any later version. |
| 9 |
* |
| 10 |
* This code is distributed in the hope that it will be useful, but |
| 11 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
* See the GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
#include "ManPagesM.h" |
| 20 |
|
| 21 |
void manual_EEG_init (ManPages me); |
| 22 |
void manual_EEG_init (ManPages me) { |
| 23 |
|
| 24 |
MAN_BEGIN (U"EEG", U"ppgb", 20180329) |
| 25 |
INTRO (U"EEG means electro-encephalography: brain potentials recorded via e.g. 32 or 64 electrodes on the scalp. " |
| 26 |
"In Praat, an EEG object looks like a combination of a Sound object with e.g. 32 or 64 channels " |
| 27 |
"and a TextGrid object that marks the events.") |
| 28 |
ENTRY (U"1. How to get an EEG object in Praat") |
| 29 |
NORMAL (U"You typically create an EEG object in Praat by opening a BDF/EDF file with @@Read from file...@. " |
| 30 |
"Praat tries to read the whole file into memory, so you may want to work with a 64-bit edition of Praat " |
| 31 |
"if you want to avoid “out of memory” messages.") |
| 32 |
NORMAL (U"After you do ##Read from file...#, an EEG object will appear in the list of objects.") |
| 33 |
ENTRY (U"2. How to look into an EEG object") |
| 34 |
NORMAL (U"Once you have an EEG object in the list, you can click ##View & Edit# to look into it. " |
| 35 |
"You will typically see the first 8 channels, but you scroll to the other channels by clicking on the up and down arrows. " |
| 36 |
"You can scroll and zoom in the same way as in a Sound window.") |
| 37 |
NORMAL (U"The channel names that you see are often A1, A2, ... A32, B1, B2, ... B32, C1, C2, ... C32, and so on. These represent the cap electrodes. " |
| 38 |
"If the number of cap electrodes is 32, though, the channel names are Fp1, AF3, ... Cz, " |
| 39 |
"and if it is 64, the channel names are Fp1, AF7, ... O2. You can change these names with " |
| 40 |
"##Set channel name...# from the #Modify menu.") |
| 41 |
NORMAL (U"Below the cap electrodes you may see a number of channels for the external electrodes. " |
| 42 |
"These are typically named EXG1, EXG2, ... EXG8, but you can change these names with ##Edit external electrode names...# " |
| 43 |
"from the Modify menu.") |
| 44 |
NORMAL (U"Below the external electrodes you may see a number of special channels, " |
| 45 |
"perhaps named GSR1, GSR2, Erg1, Erg2, Resp, Plet, Temp, and Status. " |
| 46 |
"These represent recordings from other sensors than the electrodes.") |
| 47 |
NORMAL (U"The Status channel is special. It is the 8-bit digital signal that you fed to your EEG apparatus. " |
| 48 |
"When reading the BDF file, Praat extracts all 8 bits from this status signal, " |
| 49 |
"and these 8 bits are shown in the EEG window as TextGrid interval tiers named S1, S2, ... S8. " |
| 50 |
"These bits are the place to mark events. For instance, in our lab we use S8 to mark any event, " |
| 51 |
"S5 to mark a “standard” event, and S4 to mark a “deviant” event.") |
| 52 |
ENTRY (U"3. What to do to an EEG object") |
| 53 |
NORMAL (U"The raw EEG signal that you have read from a file is typically quite noisy and may have a very large " |
| 54 |
"DC (direct-current) component as compared to the small vibrations that you are interested in. " |
| 55 |
"There are several ways to clean it up.") |
| 56 |
NORMAL (U"##Subtracting a reference signal.# The voltage on the whole scalp may rise and fall in time. " |
| 57 |
"You are unlikely to be interested in these global movements; instead, you are likely to be interested only " |
| 58 |
"in the voltage movements on the brain-influenced part of the scalp (the cap electrodes) " |
| 59 |
"with respect to the voltage movements on the non-brain-influenced part of the scalp (the external electrodes). " |
| 60 |
"If you have external electrode recordings that include the left and right mastoids, you can use these channels as a %%reference signal%, i.e., " |
| 61 |
"you can use ##Subtract reference...# to subtract the average of the two mastoid channels from all electrode channels (including the external electrodes themselves). " |
| 62 |
"If you have no such recordings, you can still regard the average of a range of electrode channels as a reference signal, " |
| 63 |
"and use ##Subtract mean channel...# to subtract this from each electrode channel.") |
| 64 |
NORMAL (U"##Detrending.# With #Detrend, you subtract from each electrode channel a line in such a way that the first sample and the last sample become zero. " |
| 65 |
"Detrending and reference subtraction can be performed in either order.") |
| 66 |
NORMAL (U"##Filtering.# With ##Filter...#, you band-pass filter each electrode channel. Filtering should be done after detrending, but " |
| 67 |
"filtering and reference subtraction can be performed in either order.") |
| 68 |
ENTRY (U"4. How to do an ERP analysis") |
| 69 |
NORMAL (U"An ERP is an Event-Related Potential. Events are marked somewhere in S1, S2, ... S8. In the above example, " |
| 70 |
"we extract all the “deviant” events by doing ##To ERPTier...#, setting ##From time# to -0.11 seconds, " |
| 71 |
"##To Time# to 0.39 seconds, and ##Marker bit# to 4. This way, an ERPTier object appears in the list, containing " |
| 72 |
"the parts of the EEG signal that lie in a time window of [-0.11, 0.39] seconds around each event on the S4 (deviant) tier. " |
| 73 |
"Thus, if S4 contains 150 events, the resulting ERPTier will contain 150 pieces of the original EEG signal (without the extra sensors).") |
| 74 |
NORMAL (U"You are typically interested in the part of each ERP in the ERPTier after the event. " |
| 75 |
"That is, you are probably interested in how this part compares to the part not influenced by the event, " |
| 76 |
"i.e. the part before the event. To make this comparison easier, you can do ##Subtract baseline...#: " |
| 77 |
"the waveform of the ERP will be moved up or down in such a way that the average amplitude of the part between the specified times becomes zero; " |
| 78 |
"the times you will typically fill in here are the starting time of the ERP (a negative number) and the time of the event (0.0).") |
| 79 |
NORMAL (U"After you subtract the baseline, the part after the event contains the interesting part of the ERP: " |
| 80 |
"even its sign (positive or negative) is meaningful now. Some ERPs, however, will contain very large positive or negative peaks " |
| 81 |
"because of eye movements and other disturbing signals. To remove those ERPs from the ERPTier, " |
| 82 |
"do ##Reject artefacts...#, while specifying the amount by which you allow the amplitude of an ERP to go above or below zero.") |
| 83 |
NORMAL (U"Once you have an ERPTier, you can extract each of the 150 ERPs from it with ##Extract ERP...#. " |
| 84 |
"It is perhaps more interesting to compute the average of all those 150 ERPs with ##To ERP (mean)#. " |
| 85 |
"These commands put a new ERP object in the list.") |
| 86 |
NORMAL (U"Once you have an ERP object, you can look into it with ##View & Edit#. " |
| 87 |
"If you want to see in the ERP window the scalp distribution at the time of the cursor, or the average scalp distribution in the selected time stretch, " |
| 88 |
"you have to switch on ##Show selection viewer# in the #Preferences window (available from the File menu).") |
| 89 |
ENTRY (U"See also") |
| 90 |
LIST_ITEM (U"\\bu @@Independent Component Analysis on EEG@") |
| 91 |
MAN_END |
| 92 |
|
| 93 |
MAN_BEGIN (U"Independent Component Analysis on EEG", U"ppgb", 20180502) |
| 94 |
INTRO (U"Independent Component Analysis (ICA) is often used to improve @EEG signals. " |
| 95 |
"See @@blind source separation@ for the algorithm.") |
| 96 |
ENTRY (U"1. Selecting your channels") |
| 97 |
NORMAL (U"You typically will not want to do ICA on all 80 channels of your signal, " |
| 98 |
"some of which may not even be EEG channels. To create a smaller EEG with e.g. only the 64 scalp channels, " |
| 99 |
"use ##EEG: Extract channels...#. From here on we will assume that your reduced EEG has 64 channels.") |
| 100 |
ENTRY (U"2. How to get a MixingMatrix") |
| 101 |
NORMAL (U"Once you have your reduced EEG, you can start to do ICA on it. " |
| 102 |
"This starts by creating a @MixingMatrix: select your EEG object and choose ##To MixingMatrix...#. " |
| 103 |
"The resulting MixingMatrix has one row for each of your 64 EEG channels, and columns called “ic1” through “ic64”.") |
| 104 |
ENTRY (U"3. How to see the independent components") |
| 105 |
NORMAL (U"Select your EEG and your MixingMatrix together and choose ##Unmix#. " |
| 106 |
"The resulting ICA-EEG will have 64 channels called “ic1” through “ic64”.") |
| 107 |
ENTRY (U"4. Just checking back") |
| 108 |
NORMAL (U"If you select your ICA-EEG together with your MixingMatrix and choose ##Mix#, " |
| 109 |
"the resulting EEG should be very similar to your original 64-channel EEG.") |
| 110 |
MAN_END |
| 111 |
|
| 112 |
} |
| 113 |
|
| 114 |
/* End of file manual_EEG.cpp */ |