Skip to content
freesurfer.rst 1.43 KiB
Newer Older
Michael Krause's avatar
Michael Krause committed
FreeSurfer
==========
Michael Krause's avatar
Michael Krause committed
Harvard's Freesurfer_ pipeline is one of the most straight forward things to
parallelize.  The time consuming :program:`recon-all` command will take up to
20 hours to complete and often needs to be run for a large number of subjects.
Michael Krause's avatar
Michael Krause committed
Obviously you can run all those processes independently of each other and in
parallel.
Michael Krause's avatar
Michael Krause committed
The simple subject loop shown in section :ref:`slurm_job_wrappers` and can be adapted like this:

.. code-block:: bash

    SUBJECTS_IDS=SOME_ID{1..99}    # SOME_ID1, SOME_ID2, ... , SOME_ID99
    SUBJECTS_DIR="./subjects"      # The freesurfer import location

    for subject in $SUBJECTS_IDS ; do
        echo '#!/bin/bash'                                          > tmp.sh
        echo "#SBATCH --output $HOME/logs/slurm-%j.out"            >> tmp.sh
Michael Krause's avatar
Michael Krause committed
        echo "export FREESURFER_HOME=/opt/freesurfer/6.0.0"        >> tmp.sh
        echo "source \$FREESURFER_HOME/SetUpFreeSurfer.sh"         >> tmp.sh
        echo "export SUBJECTS_DIR=$SUBJECTS_DIR"                   >> tmp.sh
        echo "recon-all -all -i ${subject}.nii -subjid ${subject}" >> tmp.sh

        sbatch tmp.sh
You can currently choose between different versions of FreeSurfer located in
the folder :file:`/opt/freesurfer/` by activating a freesurfer module with
:program:`module load freesurfer[/version]`. See :doc:`../environment/modules`
for details.
Michael Krause's avatar
Michael Krause committed

.. _Freesurfer: https://surfer.nmr.mgh.harvard.edu/fswiki