Brainstorm's Database Structure

Authors: Martin Cousineau, Raymundo Cassani

Understanding how data is organized and managed in Brainstorm is paramount for scripting your own pipelines, and adding new processes in the software. This page describes the structure of the Brainstorm database, and the metadata that is necessary to manage it.

Contents

On the hard drive

Brainstorm database resides on the hard drive at the database directory (brainstorm_db/). The database consists in an organized collection of protocols, where each protocol each with its own directory, which has a strict hierarchy, explained in the bullet list below:

TODO_RC: This information as tree image

The files protocol.mat and protocol.db contain all the metadata that is required to manage the protocol data. In case any of this files is accidentaly deelted, or gets corrupted, protocol metadata can ge regenerated from (brainstormsubject.mat and brainstormstudy.mat).

All required metadata should always be saved on the hard drive outside of the protocol.mat / protocol.db files, such that if they get corrupted, deleted or one does a fresh reload of the database, there is no loss of information. This is why things like: which cortex file is selected, or which trials are marked as bad are also saved in separate files (brainstormsubject.mat and brainstormstudy.mat).

The filename of each file should always clearly indicate the basic type of the file, hence the required prefixes (e.g. data_*.mat).

The content of the structure of each .mat files is defined in db_template(), with the 'mat' suffix to differenciate from the in-memory metadata structure and the in-momery data structure of each type. For example:

Protocol metadata

A brief paragraph describing why there are two versions, the main differences, and when is the user expected to see one or the other.

Matlab structure: protocol.mat

Once a protocol is loaded, Brainstorm has Matlab structures in memory that contain the metadata of all the files in this protocol. These are located in the GlobalData.DataBase global variable, such that it is easily accessible in any function of the software. It is defined db_template('GlobalData'). Let's walk through some of the important variables in this structure:

TODO: db_template('Subject'), db_template('Study'), db_template('Data'). etc

SQLite structure: protocol.db

TODO.

Tutorials/Database (last edited 2021-03-24 20:51:34 by RaymundoCassani)