Slicer
Slicer is a graphical linux utility for manipulating structural MRI data. We use it for converting between data formats. It is run from the Linux command-line.
To check if it is installed, open up a Linux terminal and type:
Slicer
If you get a message indicating that the command can't be found, see the instructions below for installation and/or ask for help from a lab administrator.
If Slicer is in your path, you can run slicer from the console
Slicer
Alternately, if it’s not, you should be able to run it specifying the complete path, as in the example:
/opt/Slicer-4.6.0-linux-amd64/Slicer
- Open the anatomical file
- File > Add Data > choose File(s) to add
- Navigate to MPRAGE folder select the source .nii file
- Re-save the file as a .mgz file:
- File > Save (screenshot forthcoming of dialog box: select .mgz filetype, and uncheck the Scene checkbox so that only the file is saved)
You should now have filename.mgz
alongside the original files
Installing Slicer
Visit http://download.slicer.org/ and get the latest stable build (the examples below assume the most stable build is Slicer-4.5.0-1, so edit the commands below as appropriate). Unzip the tarball
tar -xzvf Slicer-*.tar.gz
Move the unzipped directory to /opt/
sudo mv Slicer-4.6.0-linux-amd64 /opt/
Edit your ~/.bashrc file to put the directory in your path
PATH=/opt/Slicer-4.6.0-linux-amd64:${PATH}
Reload your path by either logging out and logging in again or (quicker):
source ~/.bashrc
Installation Problems
The above instructions work fine for Ubuntu 14.04-LTS. More recent releases (e.g. 16.04) are missing a key shared library (libjsoncpp.so.0) that Slicer relies on. In fact, it's not even an option to install it. Fortunately, there's a workaround that takes advantage of the fact that there is a functionally similar library available in a package that simply may not be installed by default (but can be easily added).
#install the libjsoncpp-dev package sudo apt-get install libjsoncpp-dev #This package contains libjsoncpp.so.1, which seems to be compatible #with the missing libjsoncpp.so.0 library #We can now make a symbolic link (similar to a shortcut) pointing to #this compatible file, but give it the name of the library file that #Slicer is expecting. cd /usr/lib/x86_64-linux-gnu sudo ln -s libjsoncpp.so.1 libjsoncpp.so.0 #now when Slicer looks for libjsoncpp.so.0, it will load in information #from libjsoncpp.so.1, which seems to be good enough to get the job done
For the record, this sort of strategy for dealing with packages that get removed from later releases often handles these sorts of issues.