Skip to content

A display for training phase for motor imagery-based BCI (MI-based BCI) training using pygame.

Notifications You must be signed in to change notification settings

orvindemsy/two-class-mi-bci-gui-v1

Repository files navigation

Basic Two Class BCI-MI User Interface

This user interface provides two class for MI-based brain computer interface (BCI) training and testing, was developed mainly using pygame

About

This program serves as interface for classical BCI motor imagery application. Two major programs are used in this application, the first one is the GUI program which is built in python language. Second one is the program that interacts with g.tec USB AMP device to record EEG signal. This one is an exe application generated by program written in C#. In this document the first program (GUI) may be referred as ‘master’, while the second one (recording) is referred as ‘slave’.

Thorough explanation of this program is available in docs/MI-BCI-GUI_Documentation_v1.pdf

Hardware and Software Requirements

These specification/ tools are required to conduct the experiment:

  • Windows 10 OS (g.tec USB AMP only compatible to this OS)
  • PyCharm (or equivalent python IDE)
  • Program dependencies (explain in the next chapter)
  • g.tec USB AMP device and its power supply & USB cable
  • g.tec USB AMP driver & g.tec C API driver installer

How It Works

Main Menu

mi-bci-gui

There are three items that the subject is required to fill in to satisfy data recording. Those are subject number, session number, run number. User is expected to be able to input their data easily as these input boxes operates like common input boxes. Keep in mind that certain format has to be met in order for the data to be properly recorded please refer to complete documentation

Send to UDP button serves to confirm number of the three items so that it can be corrected if they are incorrect. It will show the subject, session, and run number, preceded by ‘T’ and ended with ‘xx’. e.g.: T0532xx

After all information is inputted correctly pressing Run will execute one run. In this program one run consist of ten trials each consists of arrow pointing to corresponding direction, meaning horizontal will produce 5 left and 5 right arrows, vertical will produce 5 up and 5 down arrow. Arrows will appeear in random order. e.g. choosing horizontal direction will produce arrow pointing in left, left, right, left, right, right, right, left, right, left.

Two Modes

There are two modes available calibration and test

  1. Calibration

    Calibration mode is used to calibrate the EEG recording amplifier to specific subject. This mode should be done prior to test mode especially to new subject who has never done experiment before. This mode enables EEG recorder to develop subject-specific model, which enables it to properly record EEG. In this mode, subject is asked to perform motor-imagery task that corresponds to certain arrow direction shown on the screen.

mi-bci-cali.gif

  1. Test

    Test mode is when the experiment is actually being evaluated by the program. In this mode, the previously generated model in calibration mode is utilized as user performs several motor-imagery tasks. The only difference between test and calibration mode is that in the last 4 seconds of each trial of a bar will be shown. This bar indicates subject's performace in motor-imagery task.

mi-bci-cali.gif

Data Recording

When ‘Run’ button is clicked, sequence will run. Simultaneously, the program will interact with externally available DataRec.exe application to record EEG and save to predetermined folder.

The recorded data will be saved in the same directory of main program. A ‘Data’ folder will be created then inside this folder you shall find ‘T’ folder, inside this folder there will be folder with one digit indicating number of sessions. Inside this folder there will be a file with three digits, indicating, number of runs, arrow direction, and number of trials. The details of name file will be discussed further in DataRec section.

During the sequence, if program is recording properly the following text should appear on console. seq_running_edit1

Box color Description
red The list containing the order of the arrow direction, please refer to naming format
blue The name of the file, this will translate to ‘T’ mode, subject 05, session 3, run 2, right arrow, trial 1
green Notice the last digits is incrementing, this shows the trial number while the second last digit indicates the arrow direction*

Data Storing

This is a snapshot of how data is stored into Data folder recording-folder

From the above picture we can observe how the renaming works, the current projects is named 'BCI_MI_Sequence_develop', recorded data is saved in Data then S03 in T denotes subject number 3, the subsequent folder 3 denotes session number. Inside this session folder there will be .bin files each file is one trial, this naming follows what was explained in previous section in blue section. Thie first digit (from left to right) refers to run number (3), seond digit refers to arrow direction (3 or 4), third digit refers to trial number (0-9). For complete details about renaming please refer to documentation

Footnote

Currently classification algorithm is still not applied in the program, the score shown during test phase is just a random number.

About

A display for training phase for motor imagery-based BCI (MI-based BCI) training using pygame.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages