Beauchamp:CorticalSurfaceOverview
Previous step is Turning the raw data into AFNI BRIKs Next step is Making cross-subject averages with cortical surfaces IntroductionThis 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 Step 1: Averaging Anatomical Scans Using AFNIIf 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.
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.
3dmerge -gnzmean -nscale -prefix ${subj}anatavg.nii series0003.nii ${subj}series2_RegTo3.nii Step 2: Run FreeSurferThis 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/SUMAThis 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
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:
Older pages (FreeSurfer 5.3 + older versions of AFNI
Very old pages that may not be useful |