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 terminal
sudo apt-get update sudo apt-get upgrade
- Install the X server:
Installing BASH will allow you to run applications on a command line but in order to run any GUIs for neuroimaging tools you require 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
This will add the environment variable for display to the .bashrc file.
- Downloading Freesurfer:
You can obtain your copy of Freesurfer from their web page. I would recommend getting the nightly build as I was having some trouble running the stable version v5.30, especially some of the graphical windows. If you want to try the stable version download the 64-bit centos6 stable v5.3.0 freesurfer. I would encourage getting the v6.0 nightly build even though it is not the official release. You can go back and reinstall the stable version 6.0 once it is released.To download your choice of FreeSurfer type this command at the terminal:
For stable release v5.3.0
For nightly build
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.
- Extract the zipped file to install it. 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-dev.tar.gz -C /usr/local/
You will require your admin password (for Linux) to extract it to /usr/local. Again this step can take few minutes since it is 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 make changes to 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.
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
- Add FreeSurfer path to .bashrc:
echo "export FREESURFER_HOME=/usr/local/freesurfer" >> ~/.bashrc echo "source \$FREESURFER_HOME/SetUpFreeSurfer.sh" >> ~/.bashrc
- Dependencies: libjpeg.so.62
Generally there is a libjpeg dependency that is required by FreeSurfer graphics. It doesn’t come with the basic Ubuntu installation but it can be installed using:
sudo apt-get install libjpeg62
- Final check:
Check that the Xming server is running and it says Xming Server:0.0 when you hover the mouse on the 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.
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.