Setup Brainvisa Development Environment

1 - Requirements

Python and Singularity 3.7 is needed. Read the download page of the Brainvisa website to install them.

2 - Download Brainvisa

Here are all downloads of Brainvisa. Download casa-dev version in the distros directory (example for Brainvisa 5.0.1):

mkdir $HOME/brainvisa
cd $HOME/brainvisa
wget https://new.brainvisa.info/download/casa-dev-5.0-1.sif

Then install the container with casa-distro:

mkdir $HOME/brainvisa/brainvisa
singularity run -B $HOME/brainvisa/brainvisa:/casa/setup casa-dev-5.0-1.sif brainvisa master

Finally you can edit your $HOME/.bashrc file to add the bin folder to the system path. To do so, add:

export PATH="$HOME/brainvisa/brainvisa/bin:$PATH"

Using nano (ctrl+X and Y and Enter to save and quit):

nano ~/.bashrc

3 - Compile Brainvisa with Python 3

Start the container:

bv bash

To compile Brainvisa using Python 3, edit the configuration file with nano:

nano /casa/host/conf/bv_maker.cfg
[ source $CASA_SRC ]
brainvisa standard $CASA_BRANCH
     
[ build $CASA_BUILD ]
default_steps = configure build doc

make_options = -j$NCPU

cmake_options = -DPYTHON_EXECUTABLE=/usr/bin/python3 build_type = Release packaging_thirdparty = OFF clean_config = ON clean_build = ON test_ref_data_dir = $CASA_TESTS/ref test_run_data_dir = $CASA_TESTS/test brainvisa standard $CASA_BRANCH $CASA_SRC

Then start to compile everything simply running:

bv_maker

When finished, exit from the container. Now you should be able to run "brainvisa" command directly from your computer (without openning the container).

Notes that to use GPU you will need to open the container specifying the opengl argument like this:

bv opengl=nv bash
Brainvisa's first prompt
First prompts of Brainvisa

4 - Install Pycharm in the singularity image

Start the container (

bv bash
) and then:

mkdir /casa/home/soft
cd /casa/home/soft

To download Pycharm Community (arround 500Mo), get a download link here by clicking on download and then copy the "direct link" in this wget command line:

wget [copy direct link here] -O pycharm-community-2020.3.5.tar.gz

Uncompress the archive:

tar -xf pycharm-community-2020.3.5.tar.gz

Edit bashrc to easily start pycharm next time: Add this line a the end of the file:

alias pycharm="/casa/home/soft/pycharm-community-2020.3.5/bin/pycharm.sh"

Finally, after having restart the container you can start pycharm like this:

pycharm &

When pycharm start, create a new project, configure the interpreter by clicking on the "..." button using "already installed interpreter", then choose "system interpreter" and select the proper version/executable (the one used by brainvisa). Then, test this single line in a new script (shift+F10 tu run the script):

from soma import aims