Beauchamp:CorticalSurfaceOverview

From OpenWetWare
Jump to navigationJump to search
Brain picture
Beauchamp Lab



Previous step is Turning the raw data into AFNI BRIKs Next step is Making cross-subject averages with cortical surfaces

Introduction

This page describes creating cortical surface models in FreeSurfer 6.0 (released in 2017) for use with AFNI and SUMA versions (current as of August 2017). These steps assume that you are in the correct directory and have already created an AFNI directory containing the anatomical images (see Turning the raw data into AFNI BRIKs). The Beauchamp Lab convention is to use a subject code for the experiment home directory and as a prefix for all files. For instance,

 set subj = XX
 cd /Volumes/data/BCM/{$subj}/afni
  1. information on the @finish script
  2. other scripts that automate these steps

Step 1: Averaging Anatomical Scans Using AFNI

If you have only one anatomical data set, you can skip this step. FreeSurfer can handle multiple anatomies, but it is nice to register and average them in AFNI so we can have one average anatomy that we use for all purposes. This takes only a few minutes.


1. Register all the anatomicals to the space of the anatomical closest in time to the functional data (for instance, the last anatomy if the anatomies were collected before the functionals).

 3dAllineate -base series0003.nii -source series0002.nii -prefix ${subj}series2_RegTo3.nii -verb -warp shift_rotate -cost mi -automask -1Dfile ${subj}series2_RegTo3

Repeat this for as many anatomical datasets as you have.


2. Average all anatomicals into one dataset:

 3dmerge -gnzmean -nscale -prefix ${subj}anatavg.nii series0003.nii ${subj}series2_RegTo3.nii

Step 2: Run FreeSurfer

This step takes 12 or more hours. First, we must be in the home directory for the subject and set up the FreeSurfer environment variables to match.

 cd /Volumes/data/BCM/{$subj}
 setenv SUBJECTS_DIR `pwd`

Then, run FreeSurfer with the average anatomy created in the previous step. If you did not create an average anatomy, insert the name of the anatomical file to use.

 recon-all -all -parallel -subject fs -i afni/${subj}anatavg.nii 

Optional: If your anatomical images are at higher resolution than 1mm isotropic (and you'd like to maintain that resolution in the surface reconstruction), you can use the following:

 echo "mris_inflate -n 50" > expert.opts
 recon-all -all -s fs -i afni/${subj}anatavg.nii -hires -expert expert.opts

Freesurfer will complete the reconstruction with a higher resolution image without these options, but one of the first things it will do during the analysis is to downsample your image to 1x1x1mm.

Optional: If you are dissatified with the surface and you have a T2 dataset, this can be included in the recon as follows:

 recon-all -all -parallel -subject fs -i afni/${subj}anatavg.nii -T2 afni/T2anat.nii -T2pial

However, in our limited experience, this can push the pial envelope to approximately the midpoint between the WM boundary and the true pial surface.

Optional: For ECoG subjects, it is nice to have pial envelope (smooth ellipse shape of outer brain volume). This requires re-running FreeSurfer after the first run has completed. Another option would be to use the AFNI program ConvexHull.

 recon-all -s fs -localGI

Note that this step requires that Matlab with the signal processing toolbox is installed on your machine AND that you have the path set so that UNIX can find it. Type

 which matlab

To see if the path is set correctly. If not, a sample command to do so in tsch is

 set path = ( $path /Applications/MATLAB_R2015a.app/bin  )

This creates new FreeSurfer surfaces that must be converted for SUMA. @SUMA_Make_Spec_FS will need to be run (or re-run) to see the lh.pial-outer-smoothed.gii and rh.pial-outer-smoothed.gii surfaces (see Step 3).

Step 3: Convert surfaces for use with AFNI/SUMA

This step takes a few minutes.

 cd /Volumes/data/BCM/{$subj}/afni
 /Volumes/data/scripts/@finish ${subj}anatavg.nii

It is important to check the surface. To make this easier, the Beauchamp lab has a script to automatically load AFNI and SUMA and co-ordinate the viewers. Install the script like so:

 cd /Volumes/data/BCM/{$subj}  
 cp /Volumes/data/scripts/@ec .

Whenever data visualization is required, run the script like this

 ./@ec

Page describing the @ec script


If you have created extra surface with the -localGI option, they will have to be manually converted and copied into the SUMA directory like this (run in the surf directory):

foreach hemi (lh rh)
mris_convert {$hemi}.pial-outer-smoothed {$hemi}.pial-outer-smoothed.gii
cp {$hemi}.pial-outer-smoothed.gii ../SUMA/
end

Then, add them to the .spec file so that SUMA or other programs know about them.

Other relevant pages:

  1. Using the HCP Atlas Area Labels from Glasser et al. in AFNI/SUMA
  2. Creating Surface Averages of Functional Data
  3. Finding Distances on the Surface
  4. Finding Closest node on the Surface
  5. How to make 3D print outs of cortical surface models

Older pages (FreeSurfer 5.3 + older versions of AFNI

  1. Preparation for Creating Cortical Surface Models
  2. Creating Cortical Surface Models
  3. Final touches and using Cortical Surface Models
  4. What If a Cortical Surface Model Exists Already
  5. What If Cortical Surface Model Looks Bad
  6. SUMA
  7. Free Surfer

Very old pages that may not be useful

  1. Creating Standardized Surface Models
  2. FreeSurfer Standard Surface Models
  3. Caret