Autorecon2

From CCN Wiki
Jump to navigation Jump to search

The -autorecon2 directive tells Freesurfer to convert the cubic voxel-based T1 (high-resolution anatomical) image into a triangular mesh surface model. It generates a separate surface mesh for each hemisphere, and from this point on in the process, each hemisphere will have its own independent set of files.

If you checked your data carefully after autorecon1 has finished you should find that the second step goes fairly smoothly.

There is a script, autorecon2.sh that is a wrapper for the recon-all command with the -autorecon2 directive. It simply requires you to specify a valid subjectid within your $SUBJECTS_DIR. Note that a valid subjectid will be the name of the directory generated by Freesurfer when executing the -autorecon1 directive. For example, if my source data prior to running Freesurfer came from:

  • /home
    • /mydirectory
      • /fmri
        • /sub_001
          • /MPRAGE

My $SUBJECTS_DIR might be set to be /home/mydirectory/fmri. After running autorecon1.sh, depending on the value given for the -subjid flag, a new directory might now exist containing all the resulting outputs, e.g.:

  • /home
    • /mydirectory
      • /fmri
        • /FS_001

For all subsequent processing steps, the subject id is FS_001 for this data set, and not 001.

If you have an autorecon2.sh script in your ~/bin/ directory, inspect it first before running it, and ensure that you understand what it's doing. For reference, here's what a script of mine looks like:

#!/bin/bash
# Usage: autorecon2.sh <subjectid>

PROJECTROOT=~/ubfs/cpmcnorg/openfmri/booth/ #Change this: where are your data located?

OLD_SUBJECTS_DIR=${SUBJECTS_DIR} #Your subjects directory might be initially set to something else
SUBJECTS_DIR=${PROJECTROOT} #now tell freesurfer where the subject in question resides
export SUBJECTS_DIR 

echo SUBJECTS_DIR: ${SUBJECTS_DIR}

subjectID=$1
recon-all -autorecon2 \
  -subjid ${subjectID}

SUBJECTS_DIR=${OLD_SUBJECTS_DIR} #reset subjects_dir to whatever it was before
export SUBJECTS_DIR 

When I ran my autorecon1.sh script, it created a new folder called FS_T?_* for the individual (I was working on longitudinal data, where there was a T1 and T2 time point for each participant). When I ran it for the T1 data for subject 501, it created a folder in $SUBJECTS_DIR called FS_T1_501. After editing the brainmask.mgz file for this participant, I ran autorecon2.sh like this:

autorecon2.sh FS_T1_501

The -autorecon2 directive takes several hours to complete. Initial estimates were as long as 11 hours, though it recently took only about 5 or 6 hours to run on a different participant. Either way, you should plan to do some other work while you're waiting for this step to be completed.

N.B.: This script may report that it exited with errors, with the error log file indicating that a script was unable to find ribbon.mgz. As far as we can tell, this error is inconsequential and can be ignored.

Quality Control

Note: There is a systematic blip that occurs on the medial left hemisphere near the corpus callosum and ventricle areas. Don't worry about this, since it's not grey matter anyway.

After this step has completed, you can overlay the surface mesh vector on to the source T1 anatomical image in tkmedit:

tkmedit <subject_id> brainmask.mgz -aux T1.mgz -surfs

You will want to confirm that the pial boundaries, which define where the grey matter is located, correspond to the source image data. The following wiki page has an example of where it includes dura or skull: Pial Editing Another potential problem that we have seen is where the grey matter signal is too faint, causing this stage to omit these voxels in the mesh. In one example, the top of the head appeared "flattened" because of signal drop-off. I'll hopefully be able to find a solution to this problem with the Freesurfer people.

Next, load up the generated mesh in a program called tksurfer:

tksurfer <subject_id> <hemi> <surf>

Where subject_id is the name that you passed to autorecon2.sh (e.g., FS_T1_501), hemi is the hemisphere you want to load (one of either lh or rh), and the surf flag indicates which surface you want to view (typically I look at the 'inflated' surface. tksurfer FS_1001 lh inflated

You can rotate the surface around along all 3D axes and confirm that it looks like what you would expect a normal brain to look like. Errors in the surface construction would be evident by strangely-shaped features, like spikes or pits along the surface.

Another useful application of our surface mesh is that it lets us fix potentially catastrophic misalignments manually (to get the functional images in the right ballpark) as described in the FreeSurfer wiki

We will probably find ourselves getting more experience with the issues described on this Freesurfer tutorial as time goes on: [1]

Regenerating the Surface

When you are finished editing the voxels, you will need to regenerate the surfaces. Since the white matter hasn't been changed, as we do not currently edit the white matter using control points, you don't need to resegment the entire volume (e.g. you don't need to completely re-run autorecon2.sh). You can simply regenerate the pial surface with:

recon-all -autorecon-pial -subjid <subject_id>

Or use the autorecon2_fix.sh script.

autorecon2_fix.sh FS_T1_501