Jump to content

User Reference:BCI2000 Offline Analysis

From BCI2000 Wiki
Revision as of 18:11, 3 January 2008 by Jfialkoff (talk | contribs) (Reference)

BCI2000 Offline Analysis is a tool for finding useful features in EEG and ECoG data.

Installing and Running

In order to run BCI2000 Offline Analysis you'll need a system running either Windows XP or 2000. If your system meets this requirement, please choose from one of the following:


Systems with MATLAB v7.0 or greater installed

Startup Script

If you have not yet opened MATLAB, the easiest way to run BCI2000 Offline Analysis is to double click the OfflineAnalysis.bat file that resides in tools/OfflineAnalysis/

From the MATLAB command line

If MATLAB is already running, navigate to tools/OfflineAnalysis/ using the Current Directory explorer or typing the absolute path into the textbox at the top of the MATLAB window. Then, type OfflineAnalysis at the MATLAB command prompt in order to start analyzing your data.

Systems that do not have MATLAB installed or with versions that predate MATLAB v7.0

  1. Install the MATLAB Component Runtime (MCR)
    1. Click here to download the MCR for Windows.
    2. When the download is complete, run the installer.
    3. Follow the on-screen instructions to complete the installation.
  2. Navigate to tools/OfflineAnalysis/binaries/Windows
  3. Double-click OfflineAnalysis.exe to begin analyzing your data.

Reference

For a BCI2000 Offline Analysis and Eloc Helper tutorial, please see User Tutorial:BCI2000 Offline Frequency Analysis and User Tutorial:BCI2000 Offline P300 Analysis.

File>Save Settings - "Save Settings" allows you to save the values you've entered for all fields excluding "Ignore warnings" and "Overwrite existing plots." This functionality may be particularly useful if you want to run the same or similar analyses between sessions.

File>Load Settings - "Load Settings" allows you to load a settings file previously created using File>Save Settings.

Analysis Domain - The BCI2000 Offline Analysis tool allows for you to analyze your data either in the frequency domain or the time domain. Be aware that choosing the domain necessitates the modification of two fields. For instance, choosing "Frequency" will make the "Spectra Channels" and "Topo Frequencies" fields available. Choosing "Time," on the other hand will make the fields "Waveform Channels" and "Topo Times" available. A frequency domain analysis will result in up to three plots comprising a feature plot, any number of spectra plots (one for each spectra channel specified) and up to 9 topographic plots (one for each topo frequency specified). Typically the best frequency domain features can be found over the sensorimotor cortex and somewhere in the range of 9-12 Hz, corresponding to mu rhythms, and 18-25 Hz, corresponding to beta rhythms. Please see User Tutorial:BCI2000 Offline Frequency Analysis for a more complete explanation of this type of analysis. A time domain analysis will result in up to three plots comprising a feature plot, any number of waveform plots (one for each waveform channel specified) and up to 9 topographic plots (one for each topo time specified). Typically P300 features are found over the sensorimotor cortex and at around 300 ms following presentation of the stimulus. Please see User Tutorial:BCI2000 Offline P300 Analysis for a more complete explanation of this type of analysis.

Acquisition Type - Acquisition type allows the user to indicate whether the data was acquired using an EEG or an ECoG. If topographies are desired, a montage file must be selected that is congruent with the selected acquisition type.

Data Files - Any number of BCI2000 data files with the same state information and number of channels may be analyzed in a single run. To select a file to add to the list of files to be analyzed, simply click the "Add" button, choose the desired file and click "Open." To add multiple files from the same directory, click on any one of the desired files and then control-click the additional files. Then, when all desired files are selected, click "Open." If files have already been added to the data files list then subsequent uses of the above procedure will append the selected files to the list allowing for addition of files from different directories.

Montage File (optional) - If topographic plots are desired, you must specify a montage file that is congruent with the chosen acquisition type (i.e., EEG or ECoG). If you do not yet have a montage file, you can create one using the Eloc Helper tool that comes with BCI2000 Offline Analysis. For more information about Eloc Helper, please see User Reference:Eloc Helper.

Target Conditions - Target conditions consists of four fields that allow for the specification of two different conditions. Each condition consists of the condition itself (i.e., a MATLAB-syntax command that would result in a "yes" or "no") and the label for the corresponding data (e.g., "Opening and Closing Both Hands"). Take, for example, the case where we are analyzing data in order to compare the brain activity of a particular subject in response to moving both hands as opposed to moving both feet. In this case, we might choose the labels "Both Hands" and "Both Feet." The conditions themselves would depend on how the online analysis was labeled, but they would likely be similar to "(states.TargetCode==1)" and "(states.TargetCode==2)."

Trial Change Condition - The trial change condition allows for the user to indicate to BCI2000 Offline Analysis how to determine the position of the trial edges. The condition statement must be a MATLAB-syntax command resulting in a "yes" or "no." In many BCI experiments, there is a small waiting period between trials. If a sample is taken during this period, the BCI2000 state variable IntertrialInterval will take on the value 1. Therefore, for data such as these, we might use the trial change condition "states.IntertrialInterval==1." Then, BCI2000 Offline Analysis will treat any point at which this statement becomes true (i.e., where IntertrialInterval changes from some other value to 1) as a trial edge.

Spectra Channels (optional) - Note: This field is available only if you've chosen "Frequency" as the analysis domain. If you would like to have the analysis generate spectra plots, you must enter at least one channel in this field. Multiple channels can be specified using a comma-delimited list (e.g., "1,2,3") or a space-delimited list (e.g., "1 2 3").

Topo Frequencies (optional) - Note: This field is available only if you've chosen "Frequency" as the analysis domain. If you would like to have the analysis generate topographic plots, you must enter at least one frequency in this field. Multiple frequencies can be specified using a comma-delimited list (e.g., "8, 11, 22") or a space-delimited list (e.g., "8 11 22").

Waveform Channels (optional) - Note: This field is available only if you've chosen "Time" as the analysis domain. If you would like to have the analysis generate P300 waveform plots, you must enter at least one channel in this field. Multiple channels can be specified using a comma-delimited list (e.g., "1,2,3") or a space-delimited list (e.g., "1 2 3").

Topo Time (optional) - Note: This field is available only if you've chosen "Time" as the analysis domain. If you would like to have the analysis generate topographic plots, you must enter at least one time in this field. Multiple times can be specified using a comma-delimited list (e.g., "200, 300, 400") or a space-delimited list (e.g., "200 300 400").

Spatial Filter - Analyses will typically perform better using spatially filtered data. If you prefer not to perform any spatial filtering choose "None." Otherwise, choose "Common Average Reference" to use this common filtering technique.

Ignore warnings - In order to get an accurate representation of the data, it is recommended that the analysis be performed on no less than 10 trials. BCI2000 Offline Analysis will generate a warning if this condition is not met. This warning can be ignored by checking this box. If a particular combination of data files and conditions results in less than 3 trials, an error is displayed and the analysis is halted. Errors cannot be overridden.

Overwrite existing plots - Each time the analysis is run, up to three plots may be generated. If you want to compare the results from different runs, ensure that this checkbox is unchecked. In this case, BCI2000 Offline Analysis will generate the plots in new figures instead of simply overwriting the plots from previous analyses.

Troubleshooting

Clicking on any button results in the error "Undefined command/function ..." followed by "Error while evaluating figure ..."
If you're receiving this error, it is possible that after opening BCI2000 Offline Analysis you changed MATLAB's working directory. Make sure that your working directory is the same directory that contains the OfflineAnalysis script.

The analysis doesn't seem to be generating any topographic plots In order to generate topographic plots, it is necessary to specify a montage file and at least one topo frequency (for frequency domain analyses) or topo time (for time domain analyses). If the analysis you're running doesn't generate a topogrphic plot, please ensure that you've entered values in both of these fields.

The analysis doesn't seem to be generating any spectra or waveform plots In order to generate spectra or waveform plots, it is necessary to specify at least one spectra channel (for frequency domain analyses) or waveform channel (for time domain analyses). If your analysis is not resulting in one of these plots, please ensure that you have entered values into the appropriate field.

I've typed in a valid target or trial change condition, but I get the error "Invalid ... condition specified". Condition syntax is case-sensitive. For instance, while states.TargetCode may be a valid state condition, states.targetcode is not. Please double-check your conditions to ensure that the state variables are capitalized correctly.