Brain Visualization on Cluster
As we often run large image-processing jobs on the cluster, it can be useful to view images directly from the cluster file system rather than transferring them to a local computer first. However, viewing these images on the cluster is not as simple as viewing locally-stored images. This page describes a few options for viewing neuroimaging files stored on the cluster.
This is not intended to be a comprehensive list, but it covers three useful approaches:
- ITK-SNAP
- FSLeyes
- NiiVue
Setup for ITK-SNAP and FSLeyes
Both ITK-SNAP and FSLeyes can be launched from the terminal. For images that are stored locally, you can simply point the software to the files you wish to view. For images that are stored on the cluster, you can run the software locally but point it to the remote files of interest. To view images stored on the cluster, you first need to mount a cluster directory locally using sshfs.
First, create a local mount point. This only needs to be done once:
mkdir -p <local-mount-path> # for example ~/cluster_mount
Then mount a cluster directory to that local mount point:
sshfs <username@host>:/<cluster-path> <local-mount-path>
After mounting, files located in that cluster directory will appear under <local-mount-path> on your local computer.
If you ever need to unmount the directory, such as when changing the path or resetting the connection, try:
umount -f <local-mount-path>
Option 1: ITK-SNAP
To use this option, you must have ITK-SNAP installed on your local computer. You can download it from the ITK-SNAP website here.
ITK-SNAP can load images directly from the terminal using the itksnap command. Some useful flags are:
-g: main image (accepts one image)
-o: overlay image (accepts one or more images)
-s: segmentation image (accepts one image)
After mounting a cluster directory locally in Setup for ITK-SNAP and FSLeyes:
itksnap -g <local-mount-path>/<path-to-main-image> -o <local-mount-path>/<path-to-overlay-image> <local-mount-path>/<path-to-additional-overlay-image> -s <local-mount-path>/<path-to-segmentation-image>
For more information about using ITK-SNAP, see the following pages:
ITK-SNAP wiki
ITK-SNAP tutorial
Option 2: FSLeyes
FSL must be installed on your local system to use this option. Instructions for download can be found here.
FSLeyes can also be launched directly from the terminal with the fsleyes command, through which you can load multiple images.
After mounting a cluster directory locally in Setup for ITK-SNAP and FSLeyes:
fsleyes <local-mount-path>/<path-to-image> <local-mount-path>/<path-to-additional-image>
Checkout the pages below for more information about using FSLeyes:
FSLeyes user guide
FSLeyes documentation
Option 3: NiiVue
If you use VSCode, you may be interested in checking out NiiVue. NiiVue is a simple software that allows for image viewing directly in VSCode. While ITK-SNAP or FSLeyes are often more flexible and easier to use with overlays, segmentations, and scripting batch visualization, this is a nice option for quick image viewing on the cluster.
To use it, you have to install the NiiVue extension in VSCode.

Images can be viewed by clicking directly on a supported neuroimaging file through the VSCode Explorer panel or Terminal.

Once NiiVue has launched, the 'Add Image' menu can be used to view additional images side-by-side. Segmentations or overlays can be loaded through the 'Overlay' menu.

More details can be found on the NiiVue extension page in VSCode or on their website:
NiiVue
Happy viewing!