In this section, a set of raw data files, that is included in the
'emegsTestData'-folder,
will be analysed step by step from rawdata to three dimensional
plotting. It is meant to illustrate how the different processing steps
are implemented in EMEGS, which programs they require, and how these
programs can be used.
To follow along on your own computer, extract the file 'sample.zip' in
the folder \emegs\ emegs2dTestData\ EEG\ BinData\ RawData to a location
of you choice. It will extract to a 129 channel EGI datafile
(*.RAW) and its corresponding impedance- (*.IMP) , zero- (*.ZERO),gain-
(*.GAIN) and history-file (*.HIST). This is a dataset collected
with a fast picture presentation paradigm (Rapid Serial Visual
Presentation), with alternating emotional (pleasant) and neutral
pictures. Each picture is presented for 333ms without interstimulus
itervall. It is a continuous stream of pictures. The baseline
correction in this special is calculated over the entire extracted
intervall. With other more standard designs, you will simple have an
interstimulus intervall before the trigger, that you can use as
baseline.
File
types
EGI Format: EGI data files have to be exported using the
netstation software, so you end up with a set of 5 files per run (*.RAW,*.HIST,*.ZERO,*.GAIN,*.IMP).
The RAW-file is then transformed (pointwise sorting is
tranformed to channelwise sorting) into a TAW-file that
contains the same data. This file in turn is used for filtering,
resulting in a modified TAW-file, for instance *.fl40.TAW
for a 40Hz lowpass filtering.
During segmentation in 'TransNetGeoHist' the trials are saved in an *.E1
file, containing all trials including artifacts and broken channels. A *.CON
file is generated containing the trigger information for each trial.
Statistical parameters used for artifact correction and calculated in
'CalcAutoEditMat' are saved in an *.AEM and an *.AEM.AR-file
(AEM signifies Auto-Edit-Matrix, AR stands for average reference), flat
or corrupted sensors are listed in a *.Xest-file (with X
replaced by your number of channels). Editing the data using 'EditAEM'
creates two new files: a *.WE-file and a *.TVM-file, both
containing good and bad trials and channels. During averaging using
'EmegsAVG', bad sensors in the trials from the *.E1-files are
interpolated and trials are averaged based an the *.WE-files,
your sensor configuration file (*.ecfg), and the *.CON
file, resulting in a set of 3 files for each condition: an *.APPx-file,
containing only good and approximated trials of the condition x, a
corresponding *.ix file, listing the indices of the good trials
for this condition, and an *.atx file, containing the averaged
waveform.
Neuroscan Format: Neuroscan *.cnt data files have to be
filtered using 'FiltNeuroscanFiles', resulting in a modified cnt-file,
for instance *.f.cnt.
During segmentation in 'Neuroscan2Egis' the trials are saved in an *.ses
file, containing all trials including artifacts and broken channels. A *.CON
file is generated containing the trigger information for each trial.
Statistical parameters used for artifact correction and calculated in
'CalcAutoEditMat' are saved in an *.AEM and an *.AEM.AR-file
(AEM signifies Auto-Edit-Matrix, AR stands for average reference), flat
or corrupted sensors are listed in a *.Xest-file (with X
replaced by your number of channels). Editing the data using 'EditAEM'
creates two new files: a *.WE-file and a *.TVM-file, both
containing good and bad trials and channels. During averaging using
'EmegsAVG', bad sensors in the trials from the *.ses-files are
interpolated and trials are averaged based an the *.WE-files,
your sensor configuration file (*.ecfg), and the *.CON
file, resulting in a set of 3 files for each condition: an *.APPx-file,
containing only good and approximated trials of the condition x, a
corresponding *.ix file, listing the indices of the good trials
for this condition, and an *.atx file, containing the averaged
waveform.
BTI Format: BTI data files, at the present stage, have to be
noisecorrected, cardiaccorrected and filtered externally. EMEGS scripts
for this are not yet available.
During segmentation in 'TransMsiContSess', the trials are saved in a *.ses
file. A *.CON file is generated containing the trigger
information for each trial.
Statistical parameters used for artifact correction and calculated in
'CalcAutoEditMEGMat' are saved in an *.AEM -file (AEM signifies
Auto-Edit-Matrix). Editing the data using 'EditAEM' creates the *.WE-file,
containing good and bad trials and channels. During averaging using
'EmegsAVG', bad sensors in the trials from the *.ses-files are
interpolated and trials are averaged based an the *.WE-files,
your sensor configuration file (*.ecfg), and the *.CON
file, resulting in a set of 3 files for each condition: an *.APPx-file,
containing only good and approximated trials of the condition x, a
corresponding *.ix file, listing the indices of the good trials
for this condition, and an *.atx file, containing the averaged
waveform.
Segmentation and filtering
Start Matlab, make sure to include all emegs-folders in your
Matlab path, type 'emegs' and hit return. The emegs-launchpad will
open, from which you
start the preprocessing module. A yellow window appears, titled
'preprocessing menu'. Push the 'open file(s)'-button and select the
extracted file 'sample.RAW'. Then choose cancel
to stop the input (EMEGS is waiting for you to choose more RAW files to
process in batch mode).
EMEGS read the file header and displays the number of channels in the
RAW-file, the sampling rate, the file format and the number of chosen
files at the top of the PrePro-window. Activate a low-pass-filter by
clicking the radiobutton above the lowpass box. You are prompted with a
filter-configuration window. The default filter is fine for this
example, so just click 'apply' to accept the filter settings. The
window will close and the settings are stored. Next, choose the time
window for the trials that you wish to extract from the continuous
data.
Enter '83' in the 'PreTrig'-editbox and '84' in the 'PostTrig'-editbox,
meaning that with the current sampling rate of 250 Hz (4ms per point),
you will extract 332ms (83 X 4ms) before and 336ms (84 X 4ms) after
each trigger. Leaving all the other options as they are, you will use
the entire extracted intervall for artifact correction (the values '83'
pretrigger and '84' posttrigger are automatically copied to the
artifact detection section), you will extract trials for all found
trigger values and calculate statistical parameters for artifact
detection with and without applying an average reference. Hit the
'Run'-button, and follow the output in the command window. If
everything works fine, you will end up with a filtered and non-filtered
transformed
raw-data file (sample.TAW, sample.fl40.TAW), a condition file
(sample.fl40.E1.CON),
five editing files (sample.fl40.E1.AEM, sample.fl40.E1.AEM.AR
,sample.fl40.E1.AEM.AWE, sample.fl40.E1.128est,
sample.fl40.E1.129est) and a segmented data file (sample.fl40.E1).
Data editing
Click the 'Close / EditAEM'-button or start the editing console
using the emegs-launchpad. Enter a '2' in the 'NTrials Factor' (because
there are 2 conditions/trigger values in the data file) and select the
'Fast Auto I'-button, to launch the automatized editing procedure.
Choose the 'sample.fl40.AEM.AR' file and press cancel to stop the input
process. For each channel, the MaximumStd for all the trials are
displayed as histogram-plots as well as a display of the sum of diff.
of the MaximumStd thresholds.
After that, the same is repeated for the absolute values. Finally,
based on the identified good and bad sensors for each trial, a index is
calculated for each trial, describing the quality which missing sensors
can be approximated with by remaining ones (using spherical spline
interpolation). This index is plotted as a histogram, and you are asked
to select a minimal quality of approximation that you will accept as
good. To do this, just click in the displayed histogram at the desired
position. Using this threshold, the five worst trials are displayed as
a green(good) and red(bad) sensor plot. If you feel, that this
corresponds the quality of your data, hit return, and the threshold
will be saved to disk (creating the files: 'sample.fl40.E1.AR.WE',
'sample.fl40.E1.TVM'). Choose 'Close & EmegsAVG' from the menu on
the upper right to close EditAEM and start the averaging console.
Averaging
On the average console, set the 'Max std. baseline
[Points]'-edit to '167' (corresponding your baseline intervall set in
'PrePro') and hit return. 'Min std. baseline [Points]' will
automatically be set to '1' (alternativly, in this special case, you
could click the 'whole intevall' button to select all points for
baseline correction) Choose 'Open Files' and select the file
'sample.fl40.E1' of the sample data. Click 'cancel' to stop the input
process. EmegsAVG will list the path of your selected file in the
message window, then look for and list the path of its corresponding
condition file, it's editing file and the current sensor condiguration
file. If all files are found, and the listing is done, click 'Run
Average' on the EmegsAVG-Menu. The averaging of the trials will start
and displayed in the upper left window. Using all the other default
options, EmegsAVG will average every condition in the condition
file, interpolate missing sensors, and create for each condition three
files: an averaged waveform (*.at), an index file (*.i) listing the
indices of the trials of the condition that were used for the averaging
(the 'good' trials), and a file containing those (interpolated) trials
(*.app). In the sample data, the trigger values are '1' and '3', so the
following files will be created: 'sample.fl40.E1.at1.ar',
'sample.fl40.E1.at3.ar' , 'sample.fl40.E1.app1' , 'sample.fl40.E1.app3'
, 'sample.fl40.E1.i1' and 'sample.fl40.E1.i5'.
2d visualization
Choose 'Close All & Emegs2d' from the bottom right of the
EmegsAVG-console to close EmegsAVG and start Emegs2d to display the
average waveforms. Click 'Open Dataset' on the Emegs2d-console and
select the file 'sample.fl40.E1.at5.ar'. This averaged waveform will be
displayed in red in the channel window. It's sampling rate, number of
points and number of channels are displayed in the Emegs2d-console. The
name of the file is listed on bottom left of the channel window. Enter
'84' in the trigger point box and click 'total intervall' in the
Emegs2d-baseline-section, to automatically enter '-332' and '336' ms in
the 'Min. baseline' and 'Max. baseline' boxes and check the 'calc
baseline'-radio. With a standard design using an interstimulus
pretrigger 100ms baseline intervall, you would first enter your trigger
point ('26') in the trigger point box, then enter '-100' in the 'Min.
baseline' -box and finally check the 'calc baseline'-radiobutton. Click
'adust' in the amplitude section of the console to adjust the vertical
scaling.
To compare the waveforms with the other condition in the file, select Dataset Slot 2 from 'Actual Dataset'-dropdown-menu and click 'Open Dataset' to load the other condition in slot 2 (a maximum of 6 waveforms can be displayed at a time). Select the file 'sample.fl40.E1.at1.ar', and this waveform will be displayed in blue, using the current baseline and trigger point settings. Note that the polarity of this dataset is inverted due to the measuring setup that was used. Therefore, negative is up and positive down. You can push the 'Polarity'-button on the Emegs2d-console to switch to negative up mode or alternatively mulitply the dataset by -1, using the menuitem \Calculate\Factor.
To get a general impression of the data, click the GP/RMS-button on
the bottom right of the Emegs2d-console to display the global power. To
zoom in on a special sensor, click the 'mouse'-button below the 'Zoom
Sensor'-dropdown-menu on the console and then click slightly below the
waveforms of a channel of your choice in the channel window.
Lets calculate the difference between the two conditions
(emotional and neutral pictures), selecting the 'Calculate'-menu
on the top of the Emegs2d-console and choosing the 'Difference' menu
item.
A window will open to let you choose which difference you wish to
calculate and into which dataslot you wish to put the result. Click the
topmost button on the left column, the second topmost button in the
middle column, and the third topmost button on the right column, to
calculate dataset 1 -
dataset 2 = dataset 3.
3d visualization
Click the 'Emegs3d'
button on the Emegs2d-console to open the 3d console. Make sure the
difference we just calculated is selected in the 'Actual
dataset'-dropdown-menu on the bottom right of the 3d console. Then
choose 'Back' from the 'Head View'-dropdown on the upper middle
of the 3d console, and select 'Scalp' from the 'Scalp, Lap,
Cort'-dropdown on the top left ot the 3d console. This will create a 3d
plot of the difference wave over the time window from 0 to 336ms, seen
from the back, with blue hues signifying negative amplitudes and red
hues for positive differences.