Elekta Neuromag Oy 20071217/LPa/Draft General Averager: Concise user's manual Introduction “General Averager” performs offline averaging of continuous MEG data. It supports averaging into multiple categories, event lists, and conditional averaging. It also features an automatic rejection of trials contaminated by artifacts. This application is build on “Graph”, the signal processor module from Elekta Neuromag Oy, and it can be customized on a peruser or persite basis. For a particular study, a control file describing the averaging categories and the related trigger events and conditions has to be created by the user. This file can be reused to perform averaging for all subjects within that study. The General Averager setup file includes other averaging parameters such as the time window, and rejection thresholds. Thus, it is recommended to save the tailored setup file with the project files. Procedure 1. Define the averaging categories in a control file that defines the LISP variable event-tag-table. The syntax and semantics of that file are described later in this document. The file name should have the extension .lsp and it can be conveniently used if saved in the project data directory, e.g., as /neuro/data/my_project/events.lsp 2. Start Graph, choose File/Load settings... in the main window, browse to the directory local and select the file general-averager.setup 3. Set the current working directory by File/Change Directory to your project data directory, e.g., /neuro/data/my_project 4. Specify the name of the control file, created at Step 1, by selecting Parameters/classification, and then typing the file name in double quotes but without the .lsp extension, e.g., events . 5. Load the continuous MEG data into Graph; choose File/Open Diskfile and select the file. 6. [Skip this step if the raw data have been processed with MaxFilter]. Open Commands/SSP dialog/File/Load and load the SSP operator from the same file. Select all SSP vectors in 'Vector pool' and copy them to 'SSP vectors' by clicking the arrow button in the middle of the SSP window. (Bug workaround: If the File menu does not open, move the SSP window and start by opening the Actions menu. 7. The MEG channels can now be viewed in groups by using the Displays/Selection menu. Select the MEG device first by clicking on Device/Vectorview. 8. Let Graph search for trigger events in the MEG data file by selecting Action/Scan all events in the Averager event lists window. When completed, a list of events should appear; the list shows the time point and the classification for each event, based on the control file created at Step 1. Optionally, the event list can be saved into a text file, modified in an external program or text editor, and loaded back for the actual averaging. 9. Open the Graph control panel, doubleclick on the “averager” widget to open its resource editor, and set the resource “tag” to correspond to the tag (name) of the category you want to average. The tag should be written in double quotes. Set also the “start” and “end” resources to the desired start and end of the averaging window (in seconds). Typically, “start” is negative to provide a prestimulus baseline in the average. Update also the rejection time window accordingly in Parameters/rejection. 10. Start averaging by selecting Action/Average all accepted events in the Averager event list window. 11. During averaging, the data plotter display operating in conjunction with Graph should display the intermediate and final averages. All channels present in the raw data file are averaged, however, only gradiometers are shown in the plotter display. In addition, the plotter display does not use SSP so the signal may appear noisier than the properly noisecompensated final result if MaxFilter was not applied to the raw data. 12. Once the averaging has completed, save the average by selecting File/Save average in the Averager event list window. Remember to indicate the category in the file name. 13. Repeat Steps 9—12 for all the categories that should be averaged; change the “tag” resource (Step 9) to reflect the category being averaged next. 14. [Skip this step if the raw data have been processed with MaxFilter]. The average files do not contain an SSP operator but the proper one can be attached by the command (in a terminal window) /neuro/bin/util/copy_proj_fiff mydata_raw.fif mydata_cat1_avg.fif Syntax of the control file [Modified from Classifybytable v. 1.2 reference manual]. The following paragraphs describe the format of the control file, also known as the event tag table file. The file is read in directly as a lisp object, so the contents resemble a function definition. The file should contain one list, starting with the symbol event-tag-table. That should be followed by the category entries, which are also lists. The first element of the entry defines the “tag”. Second element describes the trigger combination that must be present on the trigger lines. Here the combination is assumed to be encoded into the amplitude of the trigger signal as the binary combination of the trigger bits. The rest of the elements define extra conditions that must prevail. Currently, two such conditions are provided: (signal <widget name> <channel number> <begin time> <end time>) (no-signal <widget name> <channel number> <begin time> <end time>) These definitions cause function to examine the signals at specified widget / channel / time ranges. The channel count starts from 1 and the epoch is relative to the trigger point. Times are specified in seconds. Below is an example file: ;; ;; This is a sample event tag table ;; Comments can be entered in normal lisp fashion. ;; (event-tag-table ;; Most specific entries first ;; Note that the second element is trigger combination, ;; but the third element in signal is the channel number. ( S3both 4 (signal stim 1 1.0 2.0) (signal stim 2 -1.0 -0.05)) ( S3post 4 (signal stim 1 1.0 2.0)) ( S3pre 4 (signal stim 2 -1.0 -0.05)) ( S1 1) ( S2 2) ( S3 4) ( S4 8) ( S5 16) ( S6 32) ( other :any) ) The first three classes are conditioned by presence of signals in the outputs of widget stim. The records are examined one by one until a match is found. Therefore, the most specific conditions must appear first. In addition to actual triggers, the channels of stim may contain, e.g., thresholded response button signals. In the above example, the event is classified as S3both if there is a button press both before and after the event. Second class would comprise the epochs where the button press is only either before or after the trigger point. The entries from fourth to ninth are to classify the ordinary triggers where they are delivered to one trigger line at a time. The last entry matches anything, and its presence is recommended in all setups. Tricks and tips – With long averaging windows and/or high sampling rates, Graph may emit an error message telling that the evoked data file is too large. This can be worked around by issuing the Graph command (setq max-evoked-data-size 100000000) prior to averaging. To make this change permanent, edit the .graph file in your home directory to include the above command. – The rejection time window is specified separately from the averaging window; thus, if the averaging window length is changed, the rejection window defined in Parameters/rejection should be updated accordingly. – Bad channels that should not participate the rejection checks can be added as “ignore”'d channels in the pick widgets named grad/mag/eeg/eog-reject on the Graph control panel. – If the control file is changed while Graph is running, the updated version has to be reloaded into Graph with a command like (load events.lsp ), or (load* filename-with-no-.lsp). The first form assumes that the file is in the current working directory while the second form requires that the directory of the file is in the search paths of Graph. – There is a handy way to debug the control file. Since the classifier function takes only one argument, it can be easily tested on the Graph command line. Simply call the function with a time point as the argument: (classify-by-table <time>) and the function displays the assigned class. Even handier is to use (classify-by-table (first (x-selection)) which allows using the mouse to point the time.
© Copyright 2024