Updated 2017.03.28
- Freesurfer 6.0 is now a stable release and there are couple of additional dependencies that weren’t required in the beta release of freesurfer. I have changed the post to reflect the list of libraries that need to be installed.
There is good news for those who use neuroimaging tools such as AFNI, FSL and FreeSurfer on their Windows machines. The limitation is that they can only be run on Windows 10 with anniversary update. Does it use a Virtual Machine? No. It runs “natively” on Windows 10, so you can save, print, resize or hide any interface just like a Windows program.
Before I get into how to install FreeSurfer, I must thank the author at K-Lab for the post on “How to run FSL on Windows 10“. That post describes how to install BASH on Windows 10 in the first few steps. Sadly it is not available for Windows 7/8. It uses Ubuntu 14.04 LTS which will be supported by Canonical until 2019. We hope by then Windows would incorporate the Ubuntu 16.04 LTS as the default distribution.
I’ll repeat a few things (steps 1-5) that Lin4Neuro wrote on how to get BASH and X-server on Windows 10.
- Install Linux BASH shell on Windows 10:
There is detailed tutorial with screenshots on how to do this at the following site.
How to Install and Use the Linux Bash Shell on Windows 10
- Install the updates:
Before adding any tools, you should first download and install the updates for Ubuntu. Run the following commands at the terminalsudo apt-get update sudo apt-get upgrade
- Install the X server:
With bash you can run applications on a command line but in order to run any GUIs for neuroimaging tools you’ll need a X-server for windows. The most popular software for this is Xming. You can download and install it with default settings.
Xming X server for Windows
- Running X server:
Run Xming by searching it from start menu. When it is loaded you should see this when you go to show hidden icons button at the bottom right corner of your desktop.
- In order for X server to work with BASH run the following command at the terminal
echo
"export DISPLAY=localhost:0.0"
>> ~/.bashrc
This will add the environment variable for display to the .bashrc file.
- Downloading Freesurfer (Release 6.0):
You can obtain your copy of Freesurfer from their web page. To download FreeSurfer type this command at the terminal:wget ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.0/freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0.tar.gz
Hint: You can copy the link with your mouse and when you right-click at the terminal, it will be automatically pasted so you don’t have to type it in manually.
This is a large file (~4.6GB) so it may take some time to download it based on your network speed. - It is customary to install it at /usr/local/ so let’s extract it to that directory.
sudo tar -xzf freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0.tar.gz -C /usr/local/
You will require your admin password (for Ubuntu, not Windows) to extract it to /usr/local. Again, this step can take few minutes since we are extracting a file that’s several gigabytes in size. Once extracted, we’ll have to change permissions on that folder.
sudo chmod -R 755 /usr/local/freesurfer
This allows you to edit or create files in that folder.
- Obtain the FreeSurfer license:
In order to run the FreeSurfer applications you need to register and obtain a license from their website.
FreeSurfer Registration
Once you have the license emailed to you, copy the contents between the lines that read “cut here” and create a license.txt file.sudo nano /usr/local/freesurfer/license.txt
Paste the contents with right-click
Press ctrl+X to exit
Press y to accept and save it as license.txt
Hit Enter - Add FreeSurfer path to .bashrc:
echo "export FREESURFER_HOME=/usr/local/freesurfer" >> ~/.bashrc echo "source \$FREESURFER_HOME/SetUpFreeSurfer.sh" >> ~/.bashrc
- Dependencies: libjpeg.so.62, libgomp1, etc.
Generally there are a few dependencies including the tcsh shell that aren’t included by default in the ubuntu distribution. But they can be installed using:sudo apt-get install build-essential libjpeg62 libxss1 libgomp1 tcsh
There may be some other dependencies that may be needed as time goes on. The best way to get the needed ones is to type in sudo apt-get install <partial-name-of-needed-file> and then hit tab to see if it recognizes and autocompletes the name of that dependency. It will work in most cases.
- Final check:
Check that the Xming server is running and it says Xming Server:0.0 when you hover the mouse on the Xming icon in the lower right hand corner. Type bash at the terminal. You should see the following:-------- freesurfer-Linux-centos6_x86_6.0 -------- Setting up environment for FreeSurfer/FS-FAST (and FSL) FREESURFER_HOME /usr/local/freesurfer FSFAST_HOME /usr/local/freesurfer/fsfast FSF_OUTPUT_FORMAT nii.gz SUBJECTS_DIR /usr/local/freesurfer/subjects MNI_DIR /usr/local/freesurfer/mni
- Test your installation:
Check if everything works by going through some of the examples listed on the FreeSurfer website.
FreeSurfer examples
If everything has been installed correctly you should be able to run command line functions and open GUIs just like on a Mac or Linux machine.
If you have any questions about the installation, please post a comment. If you have questions about FreeSurfer please visit the FreeSurfer user community mail archives.