This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Neurocommand

For more advanced users who prefer a command-line interface

Neurocommand requires a Linux host machine, virtual machine or WSL for Windows.

1 - Linux and HPC

Install neurocommand on Linux, HPC

Ways of using Neurocommand in Linux and HPC:

  1. You can use the module files for Neurocontainers directly via CVMFS: https://www.neurodesk.org/docs/getting-started/neurocontainers/cvmfs/
  2. or you can install Neurocommand as described here:

Requirements:

Setup Instructions:

Install command line (e.g. running on Linux, HPC or CVL)

  1. Load singularity For optimal performance, ensure you are using Singularity version 3.x:
module load singularity/3.5.0
  1. Load aria2 (Optional) To speed up container downloads, you can optionally install or load aria2c:
module load aria2c
  1. Clone and Set Up the Repository Clone the repository into a directory with enough storage and ensure you are not using a symbolic link (to be sure run cd `pwd -P`). It’s recommended to perform this setup within a Python virtual environment (venv) or a Conda environment:
git clone https://github.com/NeuroDesk/neurocommand.git 
cd neurocommand 
pip3 install -r neurodesk/requirements.txt --user 
bash build.sh --cli
bash containers.sh
export SINGULARITY_BINDPATH=`pwd -P`
# OR, depending on your installation:
export APPTAINER_BINDPATH=`pwd -P`

Install Containers

  • If these steps are successful, the help will be displayed
  • Install all or only specific containers by following the instructions, e.g.:
  1. Search and Install Specific Containers To search for containers that have “itksnap” in the name:
bash containers.sh itksnap
  1. Install a Specific Version To install a specific version, (e.g., itksnap version 4.0.2 from 20240117):
./local/fetch_containers.sh itksnap 4.0.2 20240117

To install all containers with that name:

bash containers.sh --itksnap

To download all containers (be careful - there are a lot of containers!):

bash containers.sh --all

Add your containers to lmod

  • To add each container to the module search path, run the following:
module use $PWD/local/containers/modules/
  • It may be a good idea to add this to your .bashrc if it works. When adding to your .bashrc you will need to replace $PWD to point to the correct path, i.e.
module use ~/neurocommand/local/containers/modules/
  • It is very important to also set the SINGULARITY_BINDPATH or the APPTAINER_BINDPATH variable in your .bashrc. This variable must contain a comma-separated list of directories you want to access with the Neurodesk tools.

e.g.:

export SINGULARITY_BINDPATH=/scratch/,/data/
# OR, depending on your installation:
export APPTAINER_BINDPATH=/scratch/,/data/
#Note: User the correct line depending on your installation. Do not add a directory that does not exist, otherwise the containers will not start!
  • Run ml avail to see the installed containers at the top of the list (neurodesk containers will take preference over system modules with the same name), run:
module --ignore_cache avail
  • Every time you start a new shell you need to run module use PathToYourContainers or add this command to you .bashrc file.

To update

1. Update the Neurocommand Repository

First, ensure your local repository is up to date by pulling the latest changes:

git pull

Next, rebuild Neurocommand by running:

bash build.sh

2. Update Containers

To update the containers, navigate to the neurodesktop directory and run:

bash containers.sh

3. Update Specific Modules

Choose the module you want to update for example you want to update mrtrix3/3.0.2 module with the eddy_cuda fix:

~/neurocommand/local/fetch_containers.sh mrtrix3 3.0.2 20221108 mrview $@

2 - Windows

Install neurocommand on Windows

WSL (w/ Ubuntu + LXDE)

For more information on WSL: https://docs.microsoft.com/en-us/windows/wsl

Setting up

  1. Setup WSL2 using the following instructions (Ubuntu 18.04 recommended)
    https://docs.microsoft.com/en-us/windows/wsl/install-win10 Proceed until a Ubuntu bash shell is available from the Windows Host
    Run the remaining commands in the Bash shell
  2. sudo apt-get install lxde to install LXDE desktop in WSL
  3. Reboot
  4. sudo apt-get install xrdp to install XRDP in WSL
  5. Open /etc/xrdp/xrdp.ini Change port=3389 to port=3390 and save
  6. Run echo startlxde > ~/.xsession

Running

  1. sudo service xrdp start to start xrdp server
  2. Open Microsoft Remote Desktop Connection in Windows host
  3. Connect to localhost:3390
  4. In the next login page, leave Session as Xorg. Enter your WSL username and password and click OK
  5. This should open an LXDE Linux Desktop environment. Follow Linux guide from here on

3 - Visual Studio Code

Guide connecting your VS Code environment to Neurodesktop

The following guide is for connecting to Neurodesktop using a VS Code installation running on your host machine.

Please see additional instructions below if Neurodesktop is running remotely (i.e. Cloud, HPC, VM)

Pre-requisites

Visual Studio Code (https://code.visualstudio.com) installed on your host. Standalone version should work fine Install the following VS Code extensions:

Connecting to Neurodesktop

Open VS Code and open a Folder (File > Open Folder)

This can be any folder (e.g. home or project folder). VS Code runs into errors if no folder is opened.

Open the Command Palette (Ctrl+Shift+P).

Select Remote-Containers: Attach to Running Container from the dropdown panel

Start typing in ’neurodesktop. Select /neurodesktop from the list

This should open a VS Code Window connected to the neurodesktop as a Dev Container.

This may take about a minute if it is the first time you are connecting, as VS code has to install the VS Code server onto the container. Repeat connections should be faster.

First time connection

The first time connection will default to using neurodesktop root user. We want the default connection to be as the normal user to avoid permission issues. To check which user is being used, open the terminal in the neurodesktop VS Code instance and check if the user is user or root

Follow the following steps to configure your VS Code instance to connect to neurodesktop as normal user by default:

  1. Open the Command Palette (Ctrl+Shift+P).

  2. Select Remote-Containers: Open Container Configuration File from the dropdown panel

  3. This will open a neurodesktop%3alatest.json file. Overwrite the file with the following contents

{
	"workspaceFolder": "/home/user",
	"remoteUser": "jovyan"
}
  1. Close this VS Code window. Use steps in previous section to connect normally

Useful Additions

Plugins to view neuroimaging data inside VScode: niivue-vscode

image