= Tutorial 15: Import epochs = ''Authors: Francois Tadel, Elizabeth Bock, Sylvain Baillet'' We can consider that our datasets are clean from any major artifact. We will now proceed to the analysis of the brain signals we recorded in response to the auditory stimulation. There are two major types of processing workflows for MEG/EEG, depending on whether we are dealing with an event-related paradigm or a steady-state/resting-state study. This tutorial will only focus on the event-related case: series of stimuli are sent to the subject and we have the corresponding triggers marked in the recordings. We will base our analysis on those triggers, import short epochs around each of them and average them. You will find in the advanced tutorials a scenario of MEG resting-state analysis. <> == Import in database == Until now, we've only been looking at data that was read from continuous files. The raw file viewer provides a rapid access to the recordings, but many operations can only be applied to short segments of recordings that have been imported in the database, called "epochs" or "trials". * Right-click on '''Run#01''' > '''Import in database'''. <
><
> {{attachment:import_popup.gif||height="152",width="298"}} * Set the import options as they as described below: <
><
> {{attachment:import_options.gif}} * '''Time window''': Time range of interest. We are interested by all the stimulations, so do not change this parameter; the default values always represent the entire file. * '''Split''': Useful to import continuous recordings without events, to import successive chunks of the same duration. We do not need this here. * '''Events selection''': Check the "Use events" option, and select both "'''standard'''" and "'''deviant'''". <
>The number between parenthesis represents the number of occurrences of each event in the selected time window (changes if you modify the time definition at the top of the window) * '''Epoch time''': Time segment that is extracted around each event marker. Set it to '''[-100,+500]ms'''. * '''Apply Signal Space Projections''': Use the active SSP projectors calculated during the previous pre-processing steps. Keep this option selected. * '''Remove DC Offset''': Check this option, and select: Time range: [-100, 0] ms. For each epoch, this will: compute the average of each channel over the baseline (pre-stimulus interval: -100ms to 0ms), and subtract it from the channel at every time instants (full epoch interval: [-100,+300]ms). This option removes the baseline value of each sensor, ie. the continuous (DC) offset that is added permanently on top of the recordings of interest. In MEG, the sensors record variations around a somewhat arbitrary level, therefore this operation is always needed, unless it was already applied during one of the pre-processing steps. Note that a high-pass filter with a very low frequency (for instance 0.3Hz) can replace efficiently this DC correction. If a high-pass filter has already been applied to the recordings, you may want to unselect this option. * '''Resample recordings''': Keep this unchecked * '''Create a separate folder for each epoch type''': If selected, a new folder is created for each event type (here, it will create two folders in the database: "left" and "right"). If not selected, all the epochs are saved in a new folder, the same one for all the events, that has the same name as the initial raw file. Two new conditions containing two groups of trials appeared in the database. To expand a group of trials and get access to the individual epochs: double-click on it or click on the "+" next to it. The SSP projectors calculated in the previous tutorial were applied on the fly when reading from the continuous file. Those epochs are clean from eye blinks and power line contamination. Note that the trials that are overlapping with a BAD segment are tagged as bad in the database explorer (marked with a red dot). . {{http://neuroimage.usc.edu/brainstorm/Tutorials/Auditory?action=AttachFile&do=get&target=import2.gif|import2.gif|class="attachment"}} == Review the individual trials == Double-click on the first trial for the "left" condition. Then right-click on the figure > Navigator > '''Next data file''', or use the keyboard shortcut '''F3 '''to jump to the next trial. This way you can quickly review all the trials, to make sure that there is no obvious problem in the recordings. If you haven't reviewed manually all the recordings in the continuous mode, and marked all the bad segments, it is a good time to do it now. To mark a trial as bad manually, you have three methods: * Right-click on the trial file in the database > '''Reject trial''' * Right-click on the figure > '''Reject trial''' * Use the keyboard shortcut '''Control+B''' * To set all the trials back as good in a group: right-click on the trials group or the condition > Accept bad trials. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawAvg?action=AttachFile&do=get&target=rejectManual.gif|rejectManual.gif|class="attachment"}} When a trial is tagged as bad, its icon in the database explorer shows a red mark. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawAvg?action=AttachFile&do=get&target=rejectTree.gif|rejectTree.gif|class="attachment"}} All the bad trials are going to be ignored in the rest of the analysis, because they are ignored by the Process1 and Process2 tabs. If you drag and drop the 101 left trials in the Process1 list, with one trial marked as bad, the summary of the selected files on top of the tab would show only 100 data files. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawAvg?action=AttachFile&do=get&target=rejectProcess.gif|rejectProcess.gif|class="attachment"}} == Database navigator == The Navigator menu can help you to go quickly from a dataset to another. It can be almost indispensable when your are reviewing 200 trials of the same MEG response. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutExploreRecodings?action=AttachFile&do=get&target=navigator.gif|navigator.gif|class="attachment"}} * You can access it from the popup menus of all the figures showing functional data. * You can also use the keyboard shortcuts:'' F1, F2, F3'', together with ''Shift ''key to go backwards. * Now, close all the figures (use the ''Close all figures ''button) * For ''Right / ERF'', display three views : * Time series (double click) * 2D sensor cap (Ctrl+T)''' ''' * 2D Layout (right click on ERF file > Display > 2D Layout) * Press ''F3 ''once: Updates all the figures to display ''Right/Std'' and selects it in the database explorer * Press ''F3 ''again: Nothing happens, you are already at the last dataset for this subject / condition. * Press ''Shift + F3'': And you'll be back to ''ERF ''file. * Press ''F2'': Similar to F3, but jumps from a condition to another, within the same subject. * If you had many subjects you could also use ''F1 / Shift+F1''. * MacBook users: The keys "Fx" are obtained by holding the "Fn" key simultaneously. == Run #02 == == On the hard drive == * Where is the bad trial information ? * Structure of the data files * '''F''': recordings time series (nChannels x nTime), in Volts * '''Comment''': String displayed in the Brainstorm database explorer to represent this file * '''ChannelFlag''': one value per channel, 1 means good, -1 means bad (not displayed or processed) * '''Time''': Time values, in seconds * '''DataType''': Type of the data saved in the F matrix (recordings, Z-score...) * '''Device''': Name of the acquisition system used to record this file * '''nAvg''': For averaged files, number of trials that were used to compute this file * '''Events''': Time markers available in the file (stimulus triggers or other events) * '''History''': Operations performed on file since it was imported * . {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutImportRecordings?action=AttachFile&do=get&target=dataFileMat.gif|dataFileMat.gif|class="attachment"}} <> <>