Differences between revisions 13 and 24 (spanning 11 versions)
Revision 13 as of 2023-09-04 21:15:18
Size: 5840
Editor: buildqa
Comment:
Revision 24 as of 2023-09-05 01:49:54
Size: 6738
Editor: buildqa
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
=== Freesurfer install on Ubuntu Linux in WSL === === Freesurfer on Ubuntu Linux in WSL ===
Line 39: Line 39:
... setup the FREESURFER_HOME environment variable. The 2nd command adds the environment variable settings into your bash shell init file, i.e., .bashrc ...

developer@DESKTOP-LD48TB7:~$ '''export FREESURFER_HOME=/usr/local/freesurfer/7.4.1'''
<<BR>>
developer@DESKTOP-LD48TB7:~$ '''echo "export FREESURFER_HOME=/usr/local/freesurfer/7.4.1" >> $HOME/.bashrc'''
<<BR>>

... check the Freesurfer release was installed under /usr/local/freesurfer/7.4.1 ...

<<BR>>
developer@DESKTOP-LD48TB7:~$ '''ls $FREESURFER_HOME'''
<<BR>>
{{attachment:ls_output.png}}
<<BR>>

'''If you have an existing licence.txt file from a previous freesurfer registration, you can copy it in to your home directory in Linux. Otherwise, you need to register an email address and download a license file you can receive at that email destination in order to run freesurfer commands. Fill out the form [[https://surfer.nmr.mgh.harvard.edu/registration.html|freesurfer registration]] and wait for the license.txt file to be emailed to you. '''
Line 41: Line 57:
'''''... the development stream package is installed under /usr/local/freesurfer/7-dev. The 7.2.0 release
install would be under /usr/local/freesurfer/7.2.0 There is no conflict with having
multiple versions of freesufer installed under parallel subdirectories - you only need to change the setting
of the FREESURFER_HOME environment variable ...'''''
... go to your home directory ...
Line 46: Line 59:
<<BR>>developer@DESKTOP-LD48TB7:~$
'''ls /usr/local/freesurfer/7-dev/'''
<<BR>>ASegStatsLUT.txt FreeSurferEnv.sh Simple_surface_labels2009.txt build-stamp.txt fsafd mni sources.csh tktools
<<BR>>DefectLUT.txt SegmentNoLUT.txt WMParcStatsLUT.txt diffusion fsfast models sources.sh trctrain
<<BR>>FreeSurferColorLUT.txt SetUpFreeSurfer.csh average docs lib python subjects
<<BR>>FreeSurferEnv.csh SetUpFreeSurfer.sh bin etc matlab sessions tkmeditParcColorsCMA
developer@DESKTOP-LD48TB7:~$ '''cd'''
<<BR>>
Line 53: Line 62:
'''''... setup your shell with the necessary environment variables for X-windows graphics and freesurfer. You can add these directly to your shell init file, e.g., the .bashrc file for bash shell. You will also need a license file for freesurfer which can be pointed to by an environment variable ...''''' ... then download and/or copy in your license.txt file and verify you can see it with the ls command ...
Line 55: Line 64:
<<BR>>developer@DESKTOP-LD48TB7:~$
'''echo "export XDG_RUNTIME_DIR=$HOME/.xdg" >> $HOME/.bashrc'''
<<BR>>developer@DESKTOP-LD48TB7:~$
'''echo "export DISPLAY=:0" >> $HOME/.bashrc'''
<<BR>>developer@DESKTOP-LD48TB7:~$
'''echo "export FREESURFER_HOME=/usr/local/freesurfer/7-dev" >> $HOME/.bashrc'''
developer@DESKTOP-LD48TB7:~$ '''ls license.txt'''
<<BR>>
license.txt
Line 62: Line 68:
'''''... Add your license file and set FS_LICENSE to point to it ...''''' ... set the environment variable FS_LICENSE to point to license.txt ...
Line 64: Line 70:
<<BR>>developer@DESKTOP-LD48TB7:~$
'''echo "export FS_LICENSE=$HOME/license.txt" >> $HOME/.bashrc'''
<<BR>>developer@DESKTOP-LD48TB7:~$
'''echo "source /usr/local/freesurfer/7-dev/SetUpFreeSurfer.sh" >> $HOME/.bashrc'''
<<BR>>
developer@DESKTOP-LD48TB7:~$ '''echo "export FS_LICENSE=$HOME/license.txt" >> $HOME/.bashrc'''
Line 69: Line 73:
'''''... logout and log back in and verify you see the following ...''''' ... set these environment variables for your display ...
Line 71: Line 75:
<<BR>>- - - - - - - -freesurfer-linux-ubuntu18_x86_64-dev-20210518-60f02e6- - - - - - - - <<BR>>
developer@DESKTOP-LD48TB7:~$ '''echo "export XDG_RUNTIME_DIR=$HOME/.xdg" >> $HOME/.bashrc'''
<<BR>>
developer@DESKTOP-LD48TB7:~$ '''echo "export DISPLAY=:0" >> $HOME/.bashrc'''

... set the Freesurfer environment to be setup when you open a new Linux terminal window ...

<<BR>>
developer@DESKTOP-LD48TB7:~$ '''echo "source $FREESURFER_HOME/SetUpFreeSurfer.sh" >> $HOME/.bashrc'''
<<BR>>

'''Open a new Ubuntu linux terminal window and verify you see the following output showing the Freesurfer environment has been set. Or you could just logout and log back in to Ubuntu Linux. If you do not see the output below in the new terminal window, then something went wrong with your environment variable settings above and/or the install of Freesurfer. You should stop and ask for help if the output is missing.'''

<<BR>>- - - - - - - -freesurfer-linux-ubuntu22_x86_64-7.4.1-20230614-7eb8460- - - - - - - -
Line 73: Line 90:
<<BR>>FREESURFER_HOME /usr/local/freesurfer/7-dev/
<<BR>>FSFAST_HOME /usr/local/freesurfer/7-dev//fsfast
<<BR>>FREESURFER_HOME /usr/local/freesurfer/7.4.1/
<<BR>>FSFAST_HOME /usr/local/freesurfer/7.4.1//fsfast
Line 76: Line 93:
<<BR>>SUBJECTS_DIR /usr/local/freesurfer/7-dev//subjects <<BR>>SUBJECTS_DIR /usr/local/freesurfer/7.4.1//subjects
Line 78: Line 95:
<<BR>>MNI_DIR /usr/local/freesurfer/7-dev//mni <<BR>>MNI_DIR /usr/local/freesurfer/7.4.1//mni
Line 80: Line 97:
'''''... you should now be able to run freeview and other commands from the
distribution pointed to by $FREESURFER_HOME/bin. Please note that if you
see the following error when trying to run freeview ...'''''
<<BR>>
'''If you plan to run image viewing programs such as Freeview in LInux running under WSL, the next step is to setup an X-server running on the Windows host. Some notes are provided below for setting up Xming. Some users have found Moba Xterm to be a good choice.'''
<<BR>>
Line 84: Line 101:
<<BR>>developer@DESKTOP-LD48TB7:~$ freeview
<<BR>>QXcbConnection: Could not connect to display :0
<<BR>>Could not connect to any X display.
[[https://surfer.nmr.mgh.harvard.edu/fswiki/FSL_wsl_xming|Xming and setup notes]]
<<BR>>
[[https://mobaxterm.mobatek.net|MobaXterm]]
<<BR>>
[[https://sourceforge.net/projects/vcxsrv|VcxSrv]]
<<BR>>
Line 88: Line 108:
'''''... then modify your DISPLAY variable to contain your IP address before the :0 ...''''' ... Once the X-server is running on the Windows host, you should be able to start running freeview commands ...
Line 90: Line 110:
<<BR>>developer@DESKTOP-LD48TB7:~$ grep nameserver /etc/resolv.conf
<<BR>>nameserver 154.132.1.1
<<BR>>developer@DESKTOP-LD48TB7:~$ export DISPLAY="154.132.1.1:0"
... if you see the following error when trying to run freeview ...
Line 94: Line 112:
'''''... edit the Xming X0.hosts file from the windows side to contain your IP address BELOW the entry for localhost ...''''' <<BR>>
developer@DESKTOP-LD48TB7:~$ '''freeview'''
<<BR>>
QXcbConnection: Could not connect to display :0
<<BR>>
Could not connect to any X display.

... then try modifying your DISPLAY variable to contain your IP address before the :0 ...

<<BR>>
developer@DESKTOP-LD48TB7:~$ '''grep nameserver /etc/resolv.conf'''
<<BR>>
nameserver 154.132.1.1
<<BR>>
developer@DESKTOP-LD48TB7:~$ '''export DISPLAY="154.132.1.1:0"'''

... if you have installed and setup Xming as your X-server on the windows host, then edit the Xming X0.hosts file to contain your machines IP address below the entry for localhost ...
Line 97: Line 131:
'''''... before edit ...'''''
<<BR>>developer@DESKTOP-LD48TB7:~$ cat /mnt/c/"Program Files (x86)"/Xming/X0.hosts
... before edit ...
<<BR>>developer@DESKTOP-LD48TB7:~$ '''cat /mnt/c/"Program Files (x86)"/Xming/X0.hosts'''
Line 100: Line 134:
<<BR>>'''''... after edit ...'''''
<<BR>>developer@DESKTOP-LD48TB7:~$ cat /mnt/c/"Program Files (x86)"/Xming/X0.hosts
<<BR>>... after edit ...
<<BR>>developer@DESKTOP-LD48TB7:~$ '''cat /mnt/c/"Program Files (x86)"/Xming/X0.hosts'''
Line 104: Line 138:
<<BR>>'''''... check DISPLAY matches IP address...'''''
<<BR>>developer@DESKTOP-LD48TB7:~$ echo $DISPLAY
<<BR>>... check DISPLAY matches IP address...
<<BR>>developer@DESKTOP-LD48TB7:~$ '''echo $DISPLAY'''
Line 108: Line 142:
'''''... try running freeview again ...''''' ... try running freeview again ...
Line 110: Line 144:
<<BR>>developer@DESKTOP-LD48TB7:~$ freeview <<BR>>developer@DESKTOP-LD48TB7:~$ '''freeview'''

Freesurfer on Ubuntu Linux in WSL

Please read the latest MS documentation about how to setup WSL (version2 as of this writing) on your Windows machine, MS WSL Dcoumentation. Once you are able to bring up a terminal window in WSL's pre-installed version of Ubuntu linux you can proceed to setting up the Freesurfer environment. As of this writing, WSL should install Ubuntu 22 Linux and so the install of a Freesurfer Ubuntu 22 package is listed below.

The commands below shows how to download and install the freesurfer package. That is followed by notes on setting up a 3rd party X-windows server on the host Windows machine using Xming. If you do not need to view any brain images, e.g., through Freeview, then there is no need to setup the X-Windows server.

We do not advise manually trying to install packages in the Ubuntu Linux image in order to get freesurfer to run. Please allow the installer to try and determine what packages are needed on the system and install them.

developer@DESKTOP-LD48TB7:~$ cd

developer@DESKTOP-LD48TB7:~$ wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.4.1/freesurfer_ubuntu22-7.4.1_amd64.deb
... download output ...

developer@DESKTOP-LD48TB7:~$ ls freesurfer_ubuntu22-7.4.1_amd64.deb
freesurfer_ubuntu22-7.4.1_amd64.deb

... update the package information in Ubuntu linux ...

developer@DESKTOP-LD48TB7:~$ sudo apt-get update -y
[sudo] password for developer:
... output from package updates ...

... install the freesurfer distribution under /usr/local/freesurfer/<release>. Anwer "Y" to any prompts ...

developer@DESKTOP-LD48TB7:~$ sudo apt-get -y install ./freesurfer_ubuntu22-7.4.1_amd64.deb
[sudo] password for developer:
The following NEW packages will be installed:
... output from package updates followed by install of freesurfer package ...

... setup the FREESURFER_HOME environment variable. The 2nd command adds the environment variable settings into your bash shell init file, i.e., .bashrc ...

developer@DESKTOP-LD48TB7:~$ export FREESURFER_HOME=/usr/local/freesurfer/7.4.1
developer@DESKTOP-LD48TB7:~$ echo "export FREESURFER_HOME=/usr/local/freesurfer/7.4.1" >> $HOME/.bashrc

... check the Freesurfer release was installed under /usr/local/freesurfer/7.4.1 ...


developer@DESKTOP-LD48TB7:~$ ls $FREESURFER_HOME
ls_output.png

If you have an existing licence.txt file from a previous freesurfer registration, you can copy it in to your home directory in Linux. Otherwise, you need to register an email address and download a license file you can receive at that email destination in order to run freesurfer commands. Fill out the form freesurfer registration and wait for the license.txt file to be emailed to you.

... go to your home directory ...

developer@DESKTOP-LD48TB7:~$ cd

... then download and/or copy in your license.txt file and verify you can see it with the ls command ...

developer@DESKTOP-LD48TB7:~$ ls license.txt
license.txt

... set the environment variable FS_LICENSE to point to license.txt ...


developer@DESKTOP-LD48TB7:~$ echo "export FS_LICENSE=$HOME/license.txt" >> $HOME/.bashrc

... set these environment variables for your display ...


developer@DESKTOP-LD48TB7:~$ echo "export XDG_RUNTIME_DIR=$HOME/.xdg" >> $HOME/.bashrc
developer@DESKTOP-LD48TB7:~$ echo "export DISPLAY=:0" >> $HOME/.bashrc

... set the Freesurfer environment to be setup when you open a new Linux terminal window ...


developer@DESKTOP-LD48TB7:~$ echo "source $FREESURFER_HOME/SetUpFreeSurfer.sh" >> $HOME/.bashrc

Open a new Ubuntu linux terminal window and verify you see the following output showing the Freesurfer environment has been set. Or you could just logout and log back in to Ubuntu Linux. If you do not see the output below in the new terminal window, then something went wrong with your environment variable settings above and/or the install of Freesurfer. You should stop and ask for help if the output is missing.


- - - - - - - -freesurfer-linux-ubuntu22_x86_64-7.4.1-20230614-7eb8460- - - - - - - -
Setting up environment for FreeSurfer/FS-FAST (and FSL)
FREESURFER_HOME /usr/local/freesurfer/7.4.1/
FSFAST_HOME /usr/local/freesurfer/7.4.1//fsfast
FSF_OUTPUT_FORMAT nii.gz
SUBJECTS_DIR /usr/local/freesurfer/7.4.1//subjects
INFO: /home/developer/matlab/startup.m does not exist ... creating
MNI_DIR /usr/local/freesurfer/7.4.1//mni


If you plan to run image viewing programs such as Freeview in LInux running under WSL, the next step is to setup an X-server running on the Windows host. Some notes are provided below for setting up Xming. Some users have found Moba Xterm to be a good choice.

Xming and setup notes
MobaXterm
VcxSrv

... Once the X-server is running on the Windows host, you should be able to start running freeview commands ...

... if you see the following error when trying to run freeview ...


developer@DESKTOP-LD48TB7:~$ freeview
QXcbConnection: Could not connect to display :0
Could not connect to any X display.

... then try modifying your DISPLAY variable to contain your IP address before the :0 ...


developer@DESKTOP-LD48TB7:~$ grep nameserver /etc/resolv.conf
nameserver 154.132.1.1
developer@DESKTOP-LD48TB7:~$ export DISPLAY="154.132.1.1:0"

... if you have installed and setup Xming as your X-server on the windows host, then edit the Xming X0.hosts file to contain your machines IP address below the entry for localhost ...

... before edit ...
developer@DESKTOP-LD48TB7:~$ cat /mnt/c/"Program Files (x86)"/Xming/X0.hosts
localhost
... after edit ...
developer@DESKTOP-LD48TB7:~$ cat /mnt/c/"Program Files (x86)"/Xming/X0.hosts
localhost
154.132.1.1
... check DISPLAY matches IP address...
developer@DESKTOP-LD48TB7:~$ echo $DISPLAY
154.132.1.1:0

... try running freeview again ...


developer@DESKTOP-LD48TB7:~$ freeview

FS7_wsl_ubuntu (last edited 2023-09-05 03:07:34 by buildqa)