Select Page

Building SVReg

Building SVReg

The source code for SVReg is available on the download page. Except where otherwise noted, the source code is provided under a GPL v2 license.

System/Compiler Requirements

C++ compiler

We have built the official releases using the following compilers on the following platforms:

We recommend using these compilers to ensure cross-platform consistency.

Matlab R2015b

SVReg is currently written in a mainly in Matlab. In order to compile SVReg Matlab code into an executable, we need Image Processing Toolbox and Compiler Toolbox. The Parallel computing toolbox is recommended.

To compile SVReg, open Matlab and navigate to the compile_scripts/ folder of the repository. The two main functions that you’d need are:
compile_mex: compiles mex functions.
compile_all: compiles Matlab code and generates executables; also used to package atlas(es) with executables and scripts for distribution

Source Tree

Unzip the source file, which will unpack the SVReg16a_src folder. Within this folder are the following subfolders:

  • src The source code for SVReg.
  • compile_scripts Scripts that invoke matlab compiler to build all the modules in SVReg.
  • scripts Scripts for Linux and Mac platforms that at runtime invoke compiled binaries with Matlab MCR libraries.
  • MEX_Files Compiled MEX files that are used by the source code.
  • 3rdParty Third party libraries used by SVReg


Hopefully you won’t need to use this too often, as the C and C++ functions are mostly 3rd Party. However, if you decide to try a new compilier, or a new version of Matlab, you’ll have to run it. Simply running compile_mex without any input from within Matlab will compile all of the mex-functions and move them to ../MEX_Files.


This is the main compilation function. It does not use compile_mex in its execution. First copy atlases BrainSuiteAtlas1 and BCI-DNI_brain_atlas to the SVReg folder.
To create a package with atlas files and the proper scripts, run
compile_all --package version atlas1 atlas2
compile_all --package 16a2234 BrainSuiteAtlas1 BCI-DNI_brain_atlas
This script automatically updates the version info in the Matlab files that reference it, so there is no need to go through and manually change them. Also, using compile_all this way will generate a XML manifest file. On Windows, the result will be a zip file, and on Linux and Mac it will be a .tar.gz file.