Notes on how to install FreeSurfer 6.0 so that every command used during the course tutorials can be run. This fills in some missing details documented here
- Follow instructions here to download and install FreeSurfer
- Download tutorial data from here and extract
- Patch FreeView (scroll to bottom of page)
In addition to the pre-reqs listed on the installation page, Python 2.7 is required.
Run python --version
to see what your default python version is. If it is not 2.7, there are many ways to configure an env for python 2.7. Using conda, you can go
conda create --name py2 python=2.7
conda activate py2
Add the following lines to the end of your .bashrc
(adjust accordingly)
export FREESURFER_HOME=~/fs/freesurfer
export SUBJECTS_DIR=~/fs/subjects
export TUTORIAL_DATA=~/fs/tutorial_data_20190918_1558
source $FREESURFER_HOME/SetUpFreeSurfer.sh
If your default python version is not 2.7, and you're using conda as described above to get a 2.7 env, you can add the following line to the end of $FREESURFER_HOME/SetUpFreeSurfer.sh
:
conda activate py2
Open an new terminal, make sure you get something like:
-------- freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0-2beb96c --------
Setting up environment for FreeSurfer/FS-FAST (and FSL)
FREESURFER_HOME /home/paul/lcn/data/fs-course-20200310/freesurfer
FSFAST_HOME /home/paul/lcn/data/fs-course-20200310/freesurfer/fsfast
FSF_OUTPUT_FORMAT nii.gz
SUBJECTS_DIR /home/paul/lcn/data/fs-course-20200310/subjects
TUTORIAL_DATA /home/paul/lcn/data/fs-course-20200310/tutorial_data_20190918_1558
MNI_DIR /home/paul/lcn/data/fs-course-20200310/freesurfer/mni
Then run:
$TUTORIAL_DATA/test_commands.sh.15
If you get the following errors (MacOS only?)
dyld: lazy symbol binding failed: Symbol not found: ___emutls_get_address
Referenced from: /Applications/freesurfer/bin/../lib/gcc/lib/libgomp.1.dylib
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: ___emutls_get_address
Referenced from: /Applications/freesurfer/bin/../lib/gcc/lib/libgomp.1.dylib
Expected in: /usr/lib/libSystem.B.dylib
Then patch FreeView
If you're still getting this error, then you might have to uninstall then re-install xquartz (somegthing about dir structure changing from /usr
to /opt
(?))
FS 6.0 needs python 2.7. Running with $TUTORIAL_DATA/test_commands.sh.15
python 3.x throws the following error:
File "/Applications/freesurfer/bin/asegstats2table", line 195
print 'ERROR: subjects are not specified (use --subjects SUBJECTS)'
^
SyntaxError: invalid syntax
There are many ways to configure an env for python 2.7. Using conda, you can go
conda create --name py2 python=2.7
conda activate py2
You can then edit $FREESURFER_HOME/SetUpFreeSurfer.sh
and add conda activate py2
. (there are reports that this might cause other issues?)
Launching FreeView generates an "accept incoming network connections" popup. It's been reported following the instructions at the link does not resovle the issue.
Completely turning off the firewall does (do so at your own risk)
Apparantly the popup window can be ignored and FreeView will still run locally.
If you get the error
/Applications/freesurfer/bin/dmri_group --list /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/stats/lh.cst_AS.avg33_mni_bbr.inputs.txt --ref /Applications/freesurfer/fsl_507/data/standard/MNI152_T1_1mm_brain.nii.gz --out /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/stats/lh.cst_AS.avg33_mni_bbr
ERROR: fio_pushd: /Applications/freesurfer/fsl_507/data/standard
and/or
cmdline /Applications/freesurfer/bin/dmri_group --list /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/stats/lh.cst_AS.avg33_mni_bbr.inputs.txt --ref /Applications/freesurfer/fsl_507/data/standard/MNI152_T1_1mm_brain.nii.gz --out /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/stats/lh.cst_AS.avg33_mni_bbr
sysname Darwin
hostname Dorit.local
machine x86_64
user doritkliemann
Base name of output files: /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/stats/lh.cst_AS.avg33_mni_bbr
Text file with list of individual inputs: /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/stats/lh.cst_AS.avg33_mni_bbr.inputs.txt
Loading list of inputs from /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/stats/lh.cst_AS.avg33_mni_bbr.inputs.txt
Loading measures along the path from /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/elmo.2005/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.byvoxel.txt
Loading input reference volume from /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/elmo.2005/dlabel/diff/aparc+aseg_mask.bbr.nii.gz
Loading affine registration from /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/elmo.2005/dmri/xfms/diff2mni.bbr.mat
Loading measures along the path from /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/elmo.2008/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.byvoxel.txt
Loading input reference volume from /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/elmo.2008/dlabel/diff/aparc+aseg_mask.bbr.nii.gz
Loading affine registration from /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/elmo.2008/dmri/xfms/diff2mni.bbr.mat
Loading measures along the path from /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.byvoxel.txt
Loading input reference volume from /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/elmo.2012/dlabel/diff/aparc+aseg_mask.bbr.nii.gz
Loading affine registration from /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/elmo.2012/dmri/xfms/diff2mni.bbr.mat
INFO: Sampling interval along path is 2.36337 voxels
Writing mean path voxel coords to /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/stats/lh.cst_AS.avg33_mni_bbr.coords.mean.txt
Writing mean path RAS coords to /Applications/freesurfer/tutorial_data_20190918_1558/diffusion_tutorial/stats/lh.cst_AS.avg33_mni_bbr.path.mean.txt
Segmentation fault
Then run:
cp -r $TUTORIAL_DATA/fsl_507 $FREESURFER_HOME/.
Note: this issue does not need to be resolved for the Caltech course, as we will not be covering diffusion.