Skip to content

ITK SNAP

neured edited this page Jan 4, 2019 · 2 revisions

Installation

Mac and Windows

Installing ITK-SNAP on macOS or Windows is straightforward. The Windows version is self-installing (requires admin access though). The Mac version is a self-contained binary that can be moved into Applications or run from wherever you want.

Go to the ITK-SNAP downloads page and download the appropriate software for your OS. I use the ITK-SNAP 3.8.0-Beta version.

Linux (Ubuntu 18.04 in this case)

There are two options. If you want the non-beta release (version 3.6) the best approach is to use NeuroDebian.

NeuroDebian

If you don't want to install NeuroDebian as your main (Linux) OS (it's great but I prefer Ubuntu), an option is to add the appropriate repositories. The following information is specific to Ubuntu 18.04 but you can get specific instructions for other OSes here

You can enable NeuroDebian on your system by simply copying and pasting the following two commands into a terminal window. This will add the NeuroDebian repository to your native package management system, and you will be able to install neuroscience software the same way as any other package.

wget -O- http://neuro.debian.net/lists/bionic.us-tn.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9

Now you can update the package index and you are ready to install packages. Simply execute the following command in a terminal:

sudo apt-get update

You are ready to go – enjoy NeuroDebian!

Alternative (also works for the beta version)

Another option is if you want the latest ITKSNAP beta, you can download it from NITRC (this link is via the ITKSNAP website).

Download the 64 bit Linux binary

I like to move the download into the directory I will extract it in but you can also extract directly to its destination.

I happen to have a directory called neurotools in my home directory /home/[user]/neurotools

I like to keep neuroimaging software and some data in that directory. On Mac I have a similar directory in /Users/Shared/neurotools

After downloading (if you want to), move the file to another location

mv ~/Downloads/itksnap-3.8.0-beta-20181028-Linux-x86_64.tar.gz ~/neurotools/

Then uncompress the file

tar xvzf itksnap-3.8.0-beta-20181028-Linux-x86_64.tar.gz

This will uncompress the file and create a new directory with subdirectories.

In this case we have a new directory in neurotools called itksnap-3.8.0-beta-20181028-Linux-gcc64. Within that are two directories lib and bin.

Change into the bin directory cd ~/neurotools/itksnap-3.8.0-beta-20181028-Linux-gcc64/bin

List the contents

ls .

There will be a number of files in there, including one called itksnap

I made sure it was executable

sudo chmod +x itksnap

Then, if you want it available to run from the command line, you can either add it to your PATH or create an alias. You could also copy or move the binaries to a directory already in your PATH.

Here is the alias method as a demonstration.

nano ~/.bashrc OR nano ~/.bash_profile

Then add the following to that file (edit this to match where you are keeping the ITKSNAP directory)

alias itksnap=~/neurotools/itksnap-3.8.0-beta-20181028-Linux-gcc64/bin/itksnap

When I first tried to run it ./itksnap OR just itksnap after aliasing, I received an error that included this error while loading shared libraries: libpng12.so.0: cannot open shared object file

After a quick web search for that, I found the following solution.

wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb \ && dpkg -i /tmp/libpng12.deb \ && rm /tmp/libpng12.deb

That fixed the error and issue. This might just be specific to Ubuntu 18.04 but it's good practice whenever something doesn't work to pay attention to the error message(s) and search the web for a solution. It's likely the problem has been addressed before (if not necessarily specific to your use).