The COCOHA Matlab Toolbox

cocoha_toolbox

zip_download_icon

The COCOHA Matlab Toolbox is a coding framework internally shared within the COCOHA project. It was written to standardize MATLAB data storage and decoding analysis for the project. The data structure (GitLab login required) is based loosely on FieldTrip’s, but allows for the storage of multiple data sources (e.g. audio/EEG) and provides flexibility in defining dimensions (e.g. channel, time, frequency, rate, scale, etc). Moreover, function calls that modify the contents of the data structure will append their user-defined parameters to the data.cfg cell array. This allows for traceability of results.

The functions in the toolbox allow for external functions to operate on the data structure in a robust and standardized way.

The MATLAB components are designed for offline prototyping of decoding strategies. On the other hand, realtime processing is primarily implemented with OpenViBE Python scripts. OpenViBE is used as it provides drift correction, and its support for object-oriented programming allows better modularity.

The toolbox is not designed to replace FieldTrip for more traditional M/EEG analyses, but rather as a means to supplement such analyses with a support for decoding models. As such FieldTrip import capability is provided (and export capability is still pending).

Dependencies

  • MATLAB signal processing toolbox
  • MATLAB parallel processing toolbox (optional – for GPU support)
  • FieldTrip (optional – for data import)
  • OpenViBE, Python2, NumPy, SciPy, PyAudio (optional – for realtime framework)

Accessing the Toolbox

The toolbox can be accessed on GitLab. If you don’t have access, contact Daniel Wong with your username once you have created a GitLab account. Once you have been added to the project, you will be able to access the toolbox contents as described below.

The wiki contains tutorials on how to use the toolbox (GitLab login required).

The toolbox can be downloaded as a zip file (GitLab login required). Alternatively for those who are actively developing the toolbox, or would rather update their local copy incrementally, Git access is available. Before a Git client can be used, you need to generate an SSH key pair and add the public key to your GitLab account (GitLab login required). Generating the SSH keys can be done with ssh-keygen on Mac/Linux or PuTTYgen on Windows. The private SSH key can then be added to the system’s authentication agent via ssh-add on Mac/Linux or Pageant on Windows. The repository can then be cloned from git@gitlab.com:cocoha/cocoha-matlab-toolbox.git. If using Git on the command line, the following guide should help get you started.

Git Command Line Introduction

More information on the following commands can be obtained from the Git Reference.

Configuring Git:
git config --global user.name "FirstName LastName"
git config --global user.email "em@il.address"

Cloning the repository:
git clone git@gitlab.com:cocoha/cocoha-matlab-toolbox.git

Synchronizing with the repository:
Running fetch will download data from the repository that you don’t have locally. Running merge will then merge anything new on the repository into the current branch.
git fetch origin
git merge origin/master

Committing and pushing specific files:
To avoid accidentally overwriting changes made by someone else, it is recommended to synchronize with the repository and retest potential conflicting changes before committing.
git add FileName
git commit -m "Message describing change"
git push origin master

Committing and pushing all modified files:
As stated previously, it is recommended to synchronize with the repository before committing.
git commit -am "Message describing change"
git push origin master