Nipype interface of BrainVISA

How to start BrainVISA process from an python script

The nibv project available on github provides a wrap for all the BrainVISA processes. Those wraps allow you execute a BrainVISA process from a python script without running the script in the singularity image. The wraps are in charge to start the singularity image and run the proper command line inside.

To find the name of the process you can use the BrainVISA GUI to browser all the available node.

BrainVISA GUI
Showing the Grey White Mesh process in BrainVISA

Install the interfaces using automatic build

To use it, you need first to install BrainVISA using a singularity release. Then, run the followings lines in a terminal to download the source and automatically generate the wraps.

git clone https://github.com/BastienCagna/nibv.git
cd nibv
python setup.py develop
python scripts/generate_wraps.py
            

N.B: if you have trouble during the installation, try to add "--user" to the python setup.py line to install the package only for you.

The wraps use the "bv axon-runprocess" command that allow to execute any process when providing the right inputs. The automatic wrapper read also use this command to list and get metainfos of all the available process. Then it generate the proper python scripts to build the wraps.

Running a single process with nipype

Here is a simple example that show you how to run one process using python:

# Import the needed process wrap
from nibv.interfaces.morphologist import GreyWhiteMesh

# Instantiate a process and set the inputs
proc = GreyWhiteMesh()
proc.inputs.hemi_cortex = "/path/to/the/existing/Lcortex.nii.gz"
proc.inputs.white_mesh = "/path/to/the/created/greywhitemesh_L002.gii"

# Now, let's work
proc.run()