top of page

Search Results

49 items found

  • Head Plots

    Headplots allow us to spatially visualize the neural activity for a given time range. We look at these to make sure the plots look like neural activity and not noise. These are examples of good headplots. The time range is shown in seconds. time = [0.22 0.28] means that the plot is the average headplot from 0.22 seconds to 0.28 seconds is shown. Method 1 Use FieldTrip again for the headplots. There are two ways to do this. The first is to use the the ft_topoplotER function. Example Code: % Load the datasets into the workspace (You may have more or less datasets.) load '013A.mat' dataA = timelock; load '013F.mat' dataF = timelock; load '013J.mat' dataJ = timelock; load '013N.mat' dataN = timelock; % Average the datasets of interest together (For example, all the scene stimuli for a subject) cfg = []; grandavg = ft_timelockgrandaverage(cfg, dataA, dataF, dataJ, dataN); % Plot the headplot cfg = [];                                       % clear the cfg structure load lay.mat;                                   % load the saved GSN256 layout structure (contains channel locations) cfg.layout = lay;                               % set the layout to the one that was just loaded cfg.xlim = [0.150 0.200];                       % set the time window to 0.150 to 0.200 seconds cfg.fontsize = 14;                              % set the font size on the plot to be size 14 figure; ft_topoplotER(cfg,grandavg); colorbar;  % plot the headplot saveas(gcf, 'yourfilename.png');                % save the image to the Matlab folder with the filename                                                  %numberScenesN170.png (example: '012ScenesN170.png') This code is from the automation5fxn.m. Replace variables/file names/values with your own. See Averaging Trials for info on how to save the layout structure. Method 2 The second method is better if you want to see the headplots for various time ranges. Here, you use the ft_singleplotER function. Use this code: % Load the datasets into the workspace (You may have more or less datasets.) load '013A.mat' dataA = timelock; load '013F.mat' dataF = timelock; load '013J.mat' dataJ = timelock; load '013N.mat' dataN = timelock; % Average the datasets of interest together (For example, all the scene stimuli for a subject) cfg = []; grandavg = ft_timelockgrandaverage(cfg, dataA, dataF, dataJ, dataN); % Plot a single ERP waveform figure cfg = []; load 'lay.mat'; cfg.layout = lay; % Set the layout. The layout will always be loaded into the "lay" variable no matter what % you save the variable as. cfg.layout = lay256 will not work. clf; ft_singleplotER(cfg,grandavg); This code will give you a waveform plot. Click and drag the mouse while continuing to click in order to select a time range. Then, click the selected time range and the headplot of that time range will pop up. Alternate Quick Method You can also do a quick check using EEGLAB. This will only give you the plot for a single timepoint instead of a window. Click Plot → Channel ERPs → With scalp maps Click ok You can click on the waveforms at any time to see the headplot at that time. You have to click on the waveforms. It won’t work if you click on white space.

  • Averaging Trials

    For each stimulus type for each person, we want to average all of the trials together. We now switch from using EEGLAB to using FieldTrip. Conveniently, there is a function that allows us to easily switch from EEGLAB to FieldTrip, eeglab2fieldtrip. There is also one that helps you go the other way, fieldtrip2eeglab. Here’s how to use some functions to convert your data to the FieldTrip format and average the trials together. Open your data in EEGLAB and make sure the dataset of interest is the current one. To do this, click Datasets, and then click the dataset you want. For each stimulus type for each person, we want to average all of the trials together. We now switch from using EEGLAB to using FieldTrip. Conveniently, there is a function that allows us to easily switch from EEGLAB to FieldTrip, eeglab2fieldtrip. There is also one that helps you go the other way, fieldtrip2eeglab. Here’s how to use some functions to convert your data to the FieldTrip format and average the trials together. Open your data in EEGLAB and make sure the dataset of interest is the current one. To do this, click Datasets, and then click the dataset you want. Then, run the following code, either in a script or in the command window. Also, make sure you have set the channel locations in EEGLAB. Example Code: % EEGlab to Field Trip data = eeglab2fieldtrip( EEG, 'preprocessing', 'none' ); % Add code to save the layout structure here if needed % average all trials together cfg = []; [timelock] = ft_timelockanalysis(cfg, data); % save timelock with the filename of the input file save('yourfilename.mat','timelock') This code is from the automation4fxn.m. Saving the Layout Structure for FieldTrip You only need to do this once for each net (the 256 or 65 electrode net). I’ve already saved the layout for the GSN256 Net as “lay.mat” in the Matlab Folder. Just after using the eeglab2fieldtrip function, use the ft_prepare_layout function to prepare the layout structure: Example Code: % Prepare electrode layout cfg = []; cfg.elec = data.elec; cfg.rotate = 90;%  lay = ft_prepare_layout(cfg); Then, find the ‘lay’ variable in your workspace. Right click lay and select “Save As” Save it with a descriptive title, such as “lay256” or “lay64.” (I previously saved the 256 net’s layout as “lay”, so you you might see that around the website.) To use this saved layout, use the following code: Replace “lay.mat” with the filename you saved the structure with (ex: “lay256.mat”) load lay.mat;       % load the saved GSN256 layout structure  cfg.layout = lay;   % set the layout to the one that was just loaded

  • FieldTrip

    FieldTrip doesn’t have a graphic user interface (menus you can click). It is instead a set of functions. Most of these functions have “ft_” at the beginning to indicate that they are FieldTrip functions. Here is the FieldTrip Toolbox’s website. This is a good introduction to FieldTrip and its structure. I would highly recommend reading through this page in order to gain a basic understanding of how FieldTrip works. Yeah, I know you think you can just go for it, but you’ll save yourself a lot of time by reading through it, at least until the Artifact Rejection section. cfg structure For most of the functions, you set the parameters you want using a structure labeled cfg. For example, for the ft_topoplotER function, you would set your desired parameters like this: cfg = [];                    % create an empty cfg structure cfg.xlim = [0.400 0.800];    % set the time limits to be 400 tp 800 ms cfg.fontsize = 14;           % set the font size on the plot to 14 ft_topoplotER(cfg, data)     % actually execute the function Tutorials Once you’ve read the introduction, you should read through the tutorials that are specific to what you want to do. Functions For more information on specific functions, either look at the documentation for that specific function, or look at the header of the function file in Matlab. They contain the same information. This is where to find out how to specify the inputs and other parameters.

  • Sorting by Stimulus Type

    Now, you should separate out each different stimulus type into its own file, and save that file. I give these file names with the subject number followed by the stimulus type. For example: “003Ff.set” or “017A.set.” I highly recommend running this step as a batch script. Batching will greatly reduce the amount of time this step takes. See the ‘Sorting by Event Type & Saving’ section of the automation3fxn.m for an example.

  • Example Components

    There are several things to look at when determining whether or not to reject a component. None of these are hard-and-fast rules; they are guidelines. You need to look at all of these plots together and make a decision. For more examples of good components and for more specific examples of non-neural components, look at the SASICA powerpoint. HEADMAPS ACTIVITY & WAVEFORM PLOTS POWER SPECTRUM SASICA PLOTS Headmaps These are a few good headmaps. Look at the SASICA paper and powerpoint for more information. Power Spectra A peak around 10 Hz is good. Activity and Waveform Plots Look for vertical stripes in the activity plot that correspond to the waveform plot. Red is positive, blue is negative. Also look at the units on the color scale. These can serve as a guideline. Neural components are around 4 to 8. Good components can be up to 12 or 20. Anything in the 35 to 70 range is probably noise. EXCELLENT EXAMPLES: GOOD EXAMPLES MIXED NEURAL & NOIsE SASICA Plots

  • Component Rejection

    Once we run ICA, we can remove the noise components. This section explains how to use the SASICA plugin to identify and reject noise components. This powerpoint explains the different tests SASICA performs on the data and contains example neural and nose components. Quick Reference: EOG Channels Also, copy the list of components you rejected and paste it into an update post on the website, and make sure you write which dataset that list is associated with. See the video below at 11:45 for more info. How to remove bad components using SASICA After you remove noise components, check the waveform plots and headplots to see if you’ve removed enough noise components. How to check the data

  • Baseline Removal

    The 250 ms before the stimulus is used as a measure of “baseline” activity. For each epoch (time window before & after the stimulus), the baseline is subtracted from the waveform. This leaves only the activity that occurred in reaction to the stimulus, and removes the other background neural activity that was going on at the time. When you epoch the data, it automatically asks you if you want to remove the baseline as well. You can do it then, or do it later using these instructions.

  • Epoching

    When the data is imported, it is one continuous segment. Epoching is extracting a data segment from just before and after each stimulus. We generally extract 250 milliseconds before the stimulus and 1500 milliseconds after the stimulus. Once data is epoched, it is possible to line up different trials and average them together. You should epoch the data before using the Sasica plugin so that you can use all of its functions.

  • Independent Component Analysis

    Each electrode receives signals from a combination of various neural and non-neural sources, such as eye movements, muscle movements, blinks, and noise from electrical wires. The farther a source is from an electrode, the less of that signal the electrode picks up. Note that the electrode closest to a source picks up a signal that closely resembles the actual source signal. The electrode in the middle of the two sources picks up a combination of the two sources. ICA takes the signals received by the electrodes and decomposes them into the individual components. The number of electrodes will be the number of components ICA returns. Now it is possible to mark and remove non-neural components. The program then adjusts each electrode’s waveform to not include these bad components. Now read: The introduction of A practical guide to the selection of independent components of the electroencephalogram for artifact correction. For more info on ICA: ICA for Dummies – http://sccn.ucsd.edu/~arno/indexica.html An example of ICA using sound sources – http://research.ics.aalto.fi/ica/cocktail/cocktail_en.cgi For a lot of detail on the ICA algorithm – http://www.stat.ucla.edu/~yuille/courses/Stat161-261-Spring14/HyvO00-icatut.pdf References Figure 1. Robert Oostenveld. The Donders Institute for Brain, Cognition and Behaviour. https://www.youtube.com/watch?v=zOxCqcYmIfA

  • Filtering

    In order to understand filtering, you need a basic understanding of Fourier Transforms. Read An Introduction to the Event-related Potential Technique (Pg. 20-21) for a good introduction on filters. A significant source of noise for an EEG study is the 60 Hz line noise from the electrical wires nearby. This noise needs to be filtered out. Also, we need to filter out the very low (<0.01-0.1 Hz) and very high frequencies (>50-100 Hz) because these are definitely not brain data. Removing the very low frequencies takes out the slow drift of the data, and removing the very high frequencies helps reduce noise. I would recommend a 0.1 to 100 Hz filter Filtering out too much of the data will significantly change the shape of the waveform, so it is necesary to filter out just enough to get rid of the noise, but not so much that the shape of the waveform is altered. Filtering out too many of the high frequencies will reduce the amplitudes of sharp peaks (such as the N170), which will skew the measurements of these amplitudes. You also need to filter out the 60 Hz line noise. I would recommend a 58 to 62 Hz notch filter or 59 to 61 Hz notch filter Here’s some data before and after the 60 Hz notch filter. I hid the channels above and below the red one so that you could see it more clearly. Before 60 Hz Notch Filter: After 60 Hz Notch Filter:

  • Fourier Transforms

    French mathematician Joseph Fourier introduced the Fourier Series in 1807, and today the Fourier transform is used a wide variety of applications and nearly all electronic communication. The basic premise is that every function can be written as an infinite sum of sines and cosines with varying frequencies and amplitudes. The section on Fourier Analysis in Steven J. Luck’s An Introduction to the Event-related Potential Technique (Pg. 18-19) is a good introduction. The Wikipedia page on Fourier Series is another good introduction. The Fourier transform of a function is plotted with the frequencies in Hertz on the x-axis and the amplitude (or power, which is amplitude squared) of the sine function on the y-axis. The key thing to understand is that if there is a peak in the power spectrum at a value (such as 48 Hz in Figure 2) there isn’t necessarily a physiological or other source producing a perfect sine wave at 48 Hz. Rather, that sine wave is necessary for accurately approximating the waveform of the irregularly shaped ERP. References Figure 1. “Fourier series square wave circles animation” by Cmglee – Own work. Licensed under CC BY-SA 3.0 via Wikimedia Commons –https://commons.wikimedia.org/wiki/File:Fourier_series_square_wave_circles_animation.

  • Delete or Interpolate Bad Channels

    Deleting Channels We may want to delete bad channels. For example, we may delete channels around the face and neck that are receiving too much noise. For the GSN256 net, the bad channel list can be found on the Desktop in a the “data info.txt” file. It can also be found here: 46 72 81 90 91 101 102 112 121 134 146 166 175 188 200 209 210 217 218 219 220 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 253 254 255 256 Interpolating Channels If there is a bad channel that’s not on the edge of the net, we want to interpolate it. That means that EEGLAB looks at the surrounding channels to calculate what that channel should look like. We think you need to re-run ICA after you interpolate a channel.

bottom of page