Neurodesk
Neurodesk
is a flexible package for reproducible neuroimaging. It ships with all commonly used toolboxes, often in different versions, and allows for an easy and rapid installation. The package is built upon the use of singularity containers which allows for a fixed software environment for each tool facilitating reproducibility. It can be used on local computers, with and without graphical interface, as well as on Scinet where it integrates well with the lmod
system (i.e., the module
command).
Notes on neurocommands
-
When using the integration as shell commands via the
neurocommands
package it might be necessary to pass environment variables to a launched command (e.g. Freesurfer’sSUBJECTS_DIR
variable when runningmri_sclimbic_seg
). Since the shell integration ofneurocommands
launches singularity commands in the background, the regular way of exporting bash variables viaexport SUBJECTS_DIR=...
does not work. Instead, the variables that should be used by any of theseNeurodesk
commands need to be defined at runtime when viaSINGULARITYENV_SUBJECTS_DIR=... mri_sclimbic_seg ...
. In other words, any variable name needs to be prepended with the termSINGULARITYENV_
. -
In order to access data through
neurocommands
, the corresponding folders have to be “made available” to the underlying singularity command. This works by defining all necessary paths for reading and writing data in the environment variableSINGULARITY_BINDPATH
. For example, if the commandfslmaths
reads data from/localdata/input
and writes data to/localdata/output
the variable should be set asSINGULARITY_BINDPATH=/localdata/input,/localdata/output
. It would work equally well to set the variable asSINGULARITY_BINDPATH=/localdata
. For common data locations (e.g. on a local computer) it is useful to define the bindpaths in the file.bashrc
asexport SINGULARITY_BINDPATH=/localdata
so that future commands using data only in/localdata
do not need another specification of the environment variable. -
In case specific singularity flags need to be passed when launching a command from
neurocommands
, the environment variableneurodesk_singularity_opts
can be used. For example, in order to launch a graphical tool likemrview
, first defineexport neurodesk_singularity_opts="--nv"
to activate the singularity GPU support.
Example workflow
After successful installation of the shell integration, a typical script could look like this:
# 1. activate freesurfer commands
module load freesurfer/7.4.1
module load fsl/6.0.5
# 2. define available data locations (everything in $SCRATCH and $HOME will be accessible,
# e.g. $SUBJECTS_DIR if it is located in either of those locations)
export SINGULARITY_BINDPATH=$SCRATCH,$HOME
# 3. use Freesurfer and FSL commands
...
SINGULARITYENV_SUBJECTS_DIR=/path/to/subjects/dir mri_sclimbic -s sub-01 ...
...
fslmaths ...
...