Brain Innovation

support portal

# Common code {#mainpage}

This repository contains code common to multiple plugins or other projects related to BrainVoyager.

## Repository structure

The main directory contains configuration files for Doxygen and cmake and this readme. The rest of the code is split into the following directories:

* `src`: C++ source code
* `test`: unit test code
* `lib`: third-party libraries

 

## Contents

Container classes for 1-D, 2-D and 3-D datasets:

* Vector class template for numeric vectors.
* Matrix class template for numeric matrices.
* Volume class template for numeric 3-D volumes.

Reading and writing BrainVoyager file formats:

* DMR
* FMR
* MDM
* OLT: `myolt.h`
* ROI
* SDM
* TAL
* TRF
* V16
* VMR
* VOI
* VTC

Helper functions and classes for BrainVoyager plugins:

* `pluginparams.h` contains functions to get and set parameters with the BrainVoyager plugin API.
* BusyCursor tells BrainVoyager to show a "busy" cursor.
* BVQXLog provides a C++ interface to BrainVoyager's logging function.

Other:

* `stringmanipulation.h` contains functions for string manipulation, in particular for paths and filenames.

 

## Requirements

We use the following C++ libraries:

* [GLM](https://github.com/g-truc/glm) is “a C++ mathematics library for graphics programming” that implements small vectors and matrices and the standard operations on them. On OS X, you can also install it with `brew`. On Ubuntu, install package `libglm-dev`. Otherwise, just download the ZIP, unpack it somwhere and make sure your compiler can find the headers. It's a header-only library, so we don't need to link with it.
* [Catch](https://github.com/philsquared/Catch) runs our unit tests. It's distributed as a single header file, which is included in the `lib` directory, so there's nothing to install.

You also need a reasonably up-to-date C++ compiler, since we use some features from C++11.

To build the documentation, you need [Doxygen](http://www.stack.nl/~dimitri/doxygen/).

 

## Building

### With cmake

The `CMakeLists` files included with the source code tell cmake how to build the code and unit tests. However, there's one more file we need: `FindGLM.cmake`, which tells cmake how to find GLM. Download it from [FindGLM.cmake](https://raw.githubusercontent.com/g-truc/glm/0.9.5/util/FindGLM.cmake) and save it to cmake's `Modules` directory. Where that is depends on how you installed cmake; here's where it is on my machines:

* Ubuntu: `/usr/share/cmake-2.8/Modules`
* OS X, installed with homebrew: `/usr/local/Cellar/cmake/3.0.2/share/cmake/Modules`
* OS X, cmake GUI: `/Applications/CMake.app/Contents/share/cmake-3.0/Modules`

Compiling with cmake on the command line, you can use these commands to build and run unit tests and generate the documentation:

mkdir build
cd build
cmake ..
make
./test/unittest
make doc

To read the documentation, open `build/html/index.html`.

You are here: HomeSoftware ≫ Shared code