OpenBCI GUI Documentation

repository·master·Indexed 21 days ago

https://github.com/openbci/openbci_gui

A cross-platform desktop application for visualizing, processing, and exporting real-time biosensing data from OpenBCI hardware, including Cyton and Ganglion boards. The documentation covers unit testing, the Networking Test Kit for diagnosing OSC and UDP connectivity, and the integration of Processing libraries such as gifAnimation and Minim.

Tokens
4.2K
Snippets
13
Records
24
Agent score
76%

What's inside OpenBCI GUI

  1. Overview of the OpenBCI GUI

    master

    The OpenBCI GUI is a native application for macOS, Windows, and Linux designed to provide a stable and powerful interface for OpenBCI biosensing devices. It allows users to visualize brainwave data, apply real-time filters, and manage data acquisition.

    Key Capabilities:

    • Device Support: Compatible with Ganglion, Cyton, and Cyton with Daisy boards.
    • Real-time Processing: Includes tools to filter and clean raw data as it arrives.
    • Data Export & Networking: Move data out of the GUI into other applications (like MATLAB) using UDP, OSC, LSL, and Serial, or save data to files for offline processing.
    • Extensibility: Features a widget framework that allows users to build and run their own custom experiments.
  2. Display GIF animations using the Gif class

    master

    The Gif class allows you to either play an animation like a video or extract its individual frames. Gif extends PImage, so it can be used anywhere a PImage is expected (e.g., in the image() function).

    Option 1: Play as a video

    Create a new Gif object and call .play(). This uses the frame delays specified in the GIF file.

    Option 2: Extract frames as PImages

    Use the static method Gif.getPImages(PApplet parent, String filename) to extract all frames into a PImage[] array. This is useful if you want to manipulate frames manually without a playback thread.

    // Playback example
    Gif myAnimation;
    
    void setup() {
        size(400,400);
        myAnimation = new Gif(this, "lavalamp.gif");
        myAnimation.play();
    }
    
    void draw() {
        image(myAnimation, 10, 10);
    }
    
    // Frame extraction example
    PImage[] allFrames = Gif.getPImages(this, "lavalamp.gif");
  3. Convert OpenBCI GUI 4.x output files to 5.x format

    master

    If you have data files exported from OpenBCI GUI version 4.x and need to use them with version 5.x, you can use the gui_old_to_new_file_converter.py script. This script requires the brainflow package and other dependencies listed in requirements.txt.

    # Linux
    sudo pip3 install -r requirements.txt
    
    # Windows
    pip install -r requirements.txt
    
    # Conversion command
    python3 gui_old_to_new_file_converter.py --old %path_to_old_file% --new %file_to_create%
  4. Install the Minim library for Processing

    master

    To use Minim in Processing, you must place the library in your Processing sketchbook's libraries folder under a directory named minim.

    Option 1: Manual Download

    1. Download a package from the Minim GitHub repository.
    2. Extract the contents into a directory named minim inside your Processing sketchbook's libraries folder.
    3. Crucial: Remove the default version of Minim included with Processing to avoid conflicts:
      • OSX: Right-click Processing.app -> Show Package Contents -> Contents/Resources/Java/modes/java/libraries and delete the minim folder.
      • Windows: Navigate to the directory containing Processing.exe, go to modes/java/libraries, and delete the minim folder.
    4. Restart Processing. You should see minim listed under Sketch -> Import Library in the contributed libraries section.

    Option 2: Git Clone

    1. Open a terminal in your Processing sketchbook's libraries folder.
    2. Run the following command:
      git clone git://github.com/ddf/Minim.git minim
    3. Crucial: Remove the default version of Minim included with Processing (see OSX/Windows steps above).
    4. Restart Processing to see the library in the Sketch -> Import Library menu.
    git clone git://github.com/ddf/Minim.git minim
  5. Install dependencies for the file converter

    master

    Before running the conversion script, you must install the required Python packages (including brainflow) using the requirements.txt file located in the tools directory.

    # For Linux based systems:
    sudo pip3 install -r requirements.txt
    
    # For Windows based systems:
    pip install -r requirements.txt
  6. Configure Java code formatting for Minim contributions

    master

    If you are contributing to Minim, you must follow the project's specific code formatting standards. Use the provided code_formatting_style.xml file in the sketchbook/libraries/minim directory.

    To apply the formatter in Eclipse:

    1. Go to Preferences -> Java -> Code Style -> Formatter.
    2. Click Import... and select code_formatting_style.xml from the sketchbook/libraries/minim directory.
    3. Click Apply and OK.
    4. Ensure your Active profile is set to Minim Standards before editing source code.
  7. Export GIF animations with the GifMaker class

    master

    To record a sequence of images into a GIF, use the GifMaker class. You can instantiate it with a filename and optional quality or transparency settings.

    Workflow:

    1. Initialize GifMaker in setup().
    2. In draw(), use addFrame() to capture the current sketch state.
    3. Use setDelay(int ms) to set the playback speed for the most recently added frame.
    4. Call finish() (e.g., in mousePressed()) to write the file to the sketch folder.
    GifMaker gifExport;
    
    void setup() {
        size(200,200);
        frameRate(12);
    
        gifExport = new GifMaker(this, "export.gif");
        gifExport.setRepeat(0);          // 0 means endless loop
        gifExport.setTransparent(0,0,0); // black is transparent
    }
    
    void draw() {
        background(0);
        fill(255);
        ellipse(mouseX, mouseY, 10, 10);
    
        gifExport.setDelay(1); // Delay in milliseconds
        gifExport.addFrame();
    }
    
    void mousePressed() {
        gifExport.finish(); // Writes the file
    }
  8. System requirements for OpenBCI GUI

    master

    Ensure your system meets the following requirements before installation:

    Hardware Requirements:

    • Processor: 1.6 GHz or faster
    • RAM: 2 GB minimum
    • Storage: 400 MB minimum hard drive space
    • Graphics: OpenGL acceleration is required.

    Supported Platforms:

    • macOS: OS X 10.15.7 or later
    • Windows: Windows 8.1, 10, and 11 (64-bit)
    • Linux: Ubuntu Desktop 18 or later