Back to list of tutorials

1. Anatomical ROI analysis

This tutorial gives a brief introduction to anatomical ROI analysis which includes working with label files, extracting ROI measures from the anatomical data, group statistics etc.


1.1. Preparations

1.1.1. If You're at an Organized Course

If you are taking one of the formally organized courses, everything has been set up for you on the provided laptop. The only thing you will need to do is run the following commands in every new terminal window (aka shell) you open throughout this tutorial. Copy and paste the commands below to get started:

setenv SUBJECTS_DIR $TUTORIAL_DATA/buckner_data/tutorial_subjs/group_analysis_tutorial
cd $SUBJECTS_DIR

To copy: Highlight the command in the box above, right click and select copy (or use keyboard shortcut Ctrl+c), then use the middle button of your mouse to click inside the terminal window (this will paste the command). Press enter to run the command. These two commands set the SUBJECTS_DIR variable to the directory where the data is stored and then navigates into this directory. You can now skip ahead to the tutorial (below the gray line).

1.1.2. If You're not at an Organized Course

If you are NOT taking one of the formally organized courses, then to follow this exercise exactly be sure you've downloaded the tutorial data set before you begin. If you choose not to download the data set you can follow these instructions on your own data, but you will have to substitute your own specific paths and subject names. These are the commands that you need to run before getting started:

tcsh
source your_freesurfer_dir/SetUpFreeSurfer.csh
setenv SUBJECTS_DIR $TUTORIAL_DATA/buckner_data/tutorial_subjs/group_analysis_tutorial
cd $SUBJECTS_DIR

Notice the command to open tcsh. If you are already running the tcsh command shell, then the 'tcsh' command is not necessary. If you are not using the tutorial data you should set your SUBJECTS_DIR to the directory in which the recon(s) of the subject(s) you will use for this tutorial are located.


1.2. Relationship between segmentation, parcellation and LookUp Table (LUT)

In this exercise, you will examine a segmentation, parcellation, and color lookup table to understand how they are related. Open the subject in freeview using the following command:


freeview -v 004/mri/orig.mgz \
004/mri/aparc+aseg.mgz:colormap=lut:opacity=0.4 \
-f 004/surf/lh.white:annot=aparc.annot


Finally, run the following command to display the contents of LUT (in another new terminal window)


less $FREESURFER_HOME/FreeSurferColorLUT.txt


You can hit the 'Page Up' and 'Page Down' buttons to see the rest of the file. Or click here to view the contents of the file. (To exit the less command, hit the 'q' button.)

Things to do -- Navigating between freeview and LUT:<<BR>>

  1. Choose the coronal view and click on a cortical structure in the brain.
  2. See the structure name next to 'aparc+aseg' in the Cursor section below the main viewing window. For example, it may say ctx-lh-precentral. Notice which hemisphere is specified.
  3. Look at the number listed immediately after the 'aparc+aseg'. For example, it may say 1024.
  4. Find that value in the LUT, which you have opened using the command mentioned above.
  5. Verify that it is the same structure you chose in freeview.
  6. Do the same with a subcortical structure of your choice.

You can close freeview once you are done. To get out of the less command, type 'q' for quit.

1.3. Label files

This section gives the details of commands to load an existing label file in text editor and freeview. To map a label, such as the lh.BA45.label, from the fsaverage subject to a target subject, run

cd $SUBJECTS_DIR
mri_label2label \
  --srcsubject fsaverage \
  --srclabel fsaverage/label/lh.BA45.label \
  --trgsubject 004 \
  --trglabel 004/label/lh.BA45.label \
  --hemi lh \
  --regmethod surface

Although we used an existing label for the example above, you could draw a new label on fsaverage and map that to all your subjects so that it will appear in the same cortical region. To take a look at the contents of that newly created label file, run:


less 004/label/lh.BA45.label


To load the label in freeview, first load the subject you want to work on.


freeview -v 004/mri/orig.mgz


Then on the menu bar click File > Load ROI loadroi.jpeg choose lh.BA45.label and hit 'Open'. The label is visible in coronal slice 158. To jump to that slice, double click on the coordinates [127,127,128] next to where it says 'orig' in the Cursor window pane. The last number is the slice number. Change it to 158 and hit enter.

BAlabel.jpg

This label can be edited when the 'ROI edit' roiedit.jpeg button is chosen. Click with your left mouse button to add voxels. Hold down the shift key while using your left mouse button to delete from the label. If this was your own subject, you would want to make sure you save your edits by clicking on the 'Save ROI' button but it's not necessary for this tutorial.

To load the label on the surface, first load the the subject's inflated surface in freeview (in another terminal window) using the command below. At the top menu bar, select the 3D view.



On the left menu, click on the drop down menu next to 'Curvature' and select 'Off'. Next to 'Label', select 'Load from file...'. Navigate to the subject's label directory (look one directory above) and select lh.BA45.label. Hit 'OK'. The label loaded on the inflated surface will look like this:

BAlabel_tksurfer.jpg

Information on how to create and edit labels in a freesurfer program, tksurfer, can be found on this wiki. You don't have to do this for the tutorial, but please feel free to take a look if you are interested.

1.4. Individual Stats files

During the normal FreeSurfer processing stream, via the recon-all script some statistical output files are generated. They are kept in each subjects' stats/ subdirectory and are generated for the subcortical segmentation (aseg) and the cortical parcellation (aparc). These tables include information on each labeled region for the individual subject.

1.4.1. aseg.stats

The statistical output from the subcortical segmentation, called aseg.stats, is a regular text file and will contain the volumes of specific structures. For example, you can obtain information such as the volume of left hippocampus and its mean intensity from this file.



At the head of the text file there will be information about the command that was run, the version used, the user who ran it and a time stamp. Following this there is information about the volume of the entire brain.
The next section of this file defines the column headers, field name, and units for the rest of the table. We can expect to see the Segmentation Id, Number of Voxels, Volume, Structure Name, Intensity normMean, Intensity normStdDev, Intensity normMin, Intensity normMax, and Intensity normRange for each entry in the table.
The remainder of the table shows this information for all the structures that are labeled in the aseg.

1.4.2. aparc.stats

The statistical output from the cortical parcellation, called lh.aparc.stats and rh.aparc.stats, is a regular text file and will contain the thickness of specific structures. For example, you can obtain information such as, how big is left superior temporal gyrus and its average thickness from this file.



At the head of the text file there will be information about the command that was run, the version used, the user who ran it and a time stamp. Following this there is information about the volume of the entire brain. This shows the number of vertices in the cortex (NumVert), and the surface area of the cortex (SurfArea). This part of the file also tells us that the lh.aparc.annot is being used as the annotation file (AnnotationFile ../label/lh.aparc.annot).
The next section of this file defines the column headers, field name, and units for the rest of the table. We can expect to see the Structure Name, Number of Vertices, Surface Area, Gray Matter Volume, Average Thickness, Thickness StDev, Integrated Rectified Mean Curvature, Integrated Rectified Gaussian Curvature, Folding Index and Intrinsic Curvature Index for each entry in the table.
The remainder of the table shows this information for all the structures that are labeled in the aparc.

1.5. Group stats files

This section will run you through using the stats directory in the subjects to perform group stats of certain structures that may be of interest to your study. The following commands will help you combine the data of the subjects you are analyzing into one table that will be easily read into a spreadsheet program. We have considered 6 subjects as examples (004, 021, 040, 067, 080, 092) in the following sections. Set your SUBJECTS_DIR to the path where you have your subjects to be analyzed.



1.5.1. Table of segmentation volumes

This section explains how to create a table of segmentation volumes using the 6 subjects mentioned above.



where 11, 17 and 18 correspond to the segmentation label of left caudate, left hippocampus and left amygdala respectively. (You can create a table with all of the labels, not just these three, by omitting the --segno part.) Click here if you would like to view the list of labels and their corresponding ID numbers again. The file aseg.vol.table is your output - a text file consisting of the subjects mentioned in the command above and the values for the structures requested. The information in this text file is formatted so it can be easily imported into a spreadsheet program (often used as input for many statistical analysis programs). If you do the ls command, you should see that the text file aseg.vol.table has been created. To see what the file looks like, do:



To to load the resulting table into a spreadsheet, run:



Note: the gnumeric command is meant to be run on a Linux machine. Mac users could install OpenOffice 3.0 to open the table in a spreadsheet and run the command



In the table, the first cell is volume indicating that the measure is a volume in mm3. In addition to segmentations, you can also get IntraCranialVol (ICV) and BrainSegVol into the table. About the subject IDs, you'll notice that in the examples we've considered here, each subject is a 3 digit number. Therefore gnumeric thinks it is a number and removes leading 0s. This is a gnumeric issue but probably it would not happen if subject names had characters in them instead of integers.

1.5.2. Table of segmentation mean intensities

Purpose of this section is to demonstrate how you can change what measure you collect for your spreadsheet from volume to mean intensity using the asegstats2table command.



Things to do:

  1. You can load the table into a spreadsheet as explained in the previous section.

  2. Refer to the file FreeSurferColorLUT.txt for the segmentation labels and the corresponding subcortical structures.



For tutorial purposes, click here to view the contents of the file.

1.5.3. Table of white matter parcellation volumes

The purpose of this section is to show how you can change which segmentation atlas you get stats from (and thus which structures):



Things to do:

  1. You can load the table into a spreadsheet.

  2. Refer to the file FreeSurferColorLUT.txt for the segmentation labels and the corresponding subcortical structures.



For tutorial purposes, click here to view the contents of the file

1.5.4. Table of the surface area of each cortical parcellation in the Desikan atlas

This section explains how to create a table of the surface area of each cortical parcellation in the Desikan atlas (surface area is the default measure).



You can now load the resulting table into a spreadsheet.

1.5.5. Table of the average thickness of each cortical parcellation in the Destrieux atlas

The purpose of this section is to show how to change the summary measure and the parcellation atlas.



You can now load the resulting table into a spreadsheet.