The functional volumes for each subject need to be registered with the reconstructed anatomical volume in the Anatomical Database – i.e. the directory where you keep the subjects whose anatomical data have been reconstructed with FreeSurfer..


Linking into Freesurfer allows the user to view the functional results on high-resolution 3D anatomical images as well as on the cortical surface. It also allows the user to resample into talairach, spherical, or region-of-interest (ROI) spaces in order to perform intersubject averaging. Of course, to link to Freesurfer, the subject must have been processed through the FreeSurfer anatomical reconstruction stream.

Creating The Subjectname File

Before you proceed, ensure that a file called "subjectname" appears in the functional session. You must create this file. One of the first steps in the anatomical reconstruction is to create a subject directory where “subjectname” is a unique identifer for each subject that will be analyzed. This is also known as the Subject Identifier String. The subject’s anatomical reconstruction directory must be visible from the /$SUBJECTS_DIR, i.e. you should see something when running the unix command {em /$SUBJECTS_DIR/subjectname}. To interface FS-FAST to FreeSurfer, you must create a file called subjectname in the functional session directory, the contents of which should be the name of the subject. Note that the contents hold the subject identifier string, whereas the file itself should actually be called “subjectname”’. For example, for Bert you would cd to bert-functional and create a file called subjectname with contents “bert” (no quotes), e.g.:


Then, to ensure that Bert’s reconstructed anatomical data set (the one you downloaded in the first step) exists in the right place on your system, type:

ls /$SUBJECTS_DIR/bert

You should now see the unique FreeSurfer anatomical directory structure for bert:


Functional/Anatomical Registration

Registration can be challenging because the two volumes have different resolutions, contrast weightings and fields of view. In addition, they may have been collected on different sessions, sometimes years apart and on different scanners. Yet, we still need to assign voxels in the anatomical space to voxels in the functional space in order to view the functional data on the anatomical data. This is done in three stages, two of which are automatic. The automatic is used to get the registration close, and the manual is used to fine-tune the registration.

Automatic Registration

The automatic registration can be broken into two conceptual steps, though both are accomplished with one command. The automatic registration can be used only if a high-resolution T1-weighted anatomical data set was acquired during the same scanning session. These may have been collected in order to process the subject with FreeSurfer, in which case there will probably be two or three very high-quality scans. Or, if a subject has already been reconstructed, there may only be one low-quality anatomical acquired during the functional session. The latter is the case for bert. One run of low-quality anatomicals can be found in bert-functional/3danat. These are referred to as the “same-session anatomicals”, whereas those in $SUBJECTS_DIR/bert are referred to as the “reconstructed anatomicals” and are high quality.

The first step is the Header Registration in which the functional volumes are registered with the anatomicals that were collected during the same session. No MRI data are used in the header. registration. It relies on the assumption that the head has not moved so that registration can be accomplished simply by registering the fields-of-view.

In the second step, the same-session anatomical is registered with the Database anatomicals. This is accomplished by translating/rotating the volumes based on a voxel-by-voxel comparison until they match best. This can be done because both volumes have T1 contrast.

Concatenating these two transforms yields the transform between the functionals and the reconstructed anatomicals. Those using this procedures should cite References/Collins1994. The registration for Bert can be accomplished by typing the following in your Study Directory:

spmregister-sess –sf sessid –df sesspar

This will create a file called register.dat in bert-functional/bold. This file will have eight lines:


The first four lines are: subjectname, in-plane resolution, between-plane resolution, and intensity value. The between-plane resolution is the slice thickness if there is no skip. The intensity value does not actually have anything to do with the registration itself; it is used when displaying the functional volume during the manual registration phase. The last four lines of register.dat have the values of the registration matrix that converts a location in anatomical space to a location in functional space.

Manual Registration

Because of movement and EPI distortion, the automatic stage can only get the registration close. Manual registration is used to check and fine-tune the automatic registration, or to perform the entire registration in the case that there are no same-session anatomicals or if the automatic registration failed. Even if the automatic registration succeeded, always check the registration manually by using the following commands:

tkregister-sess –sf sessid –df sesspar

This will read the read the register.dat created by the automatic registration and bring up two windows, one with a brain, the other a control window.


Hitting the COMPARE button in the control window allows toggling between the functional and the anatomical volumes. The image window will initially have a coronal view of the anatomical volume, but you can change the view by hitting the “coronal” or “sagittal” or horizontal” buttons. The functional brain can be translated left or right by adjusting the horizontal scrollbar under “Translate Brain”. It can be translated up and down by using the vertical scrollbar. The brain can be rotated about the red cursor by using the “Rotate Brain” scrollbar. With these operations, the user can navigate through the volume and check the registration.

Fine Tuning the Registration

If the registration is off, then the user has three options: translation, rotation, and scaling, each of which has its own frame inside the control window. Within the Translation frame, there are two sliders. The vertical slider translates the functional brain in the vertical direction, where “vertical” is with respect to the current view in the image window. The horizontal slider translates the functional brain horizontally. The Rotation frame has only one slider. Moving the slider will rotate the functional brain around the current cursor location about the axis perpendicular to the current image view. The Scale frame has two sliders. The vertical slider will stretch/compress the functional brain in the current vertical direction. The horizontal slider does the same for the current horizontal direction. When finished, hit the SAVE REG button (it may prompt you to overwrite the current registration; if so, do so). To quit, hit the button on the upper left hand corner to bring down a menu and choose the Close option. This will update the register.dat. Note that rerunning autoreg-sess will overwrite your results from the manual registration. Also note that any changes in registration will require that all downstream operations (e.g., resampling, inter-subject averaging) be rerun. When the volumes are properly registered, the anatomical features in the functional slice should perfectly overlay those in the anatomical slice. After adjusting the registration this way, hit the “SAVE REG” button (answer yes to overwrite).

OUTPUT: This step creates a file called register.dat in each functional subdirectory. This represents the registration between the functional volume and the Database anatomical volume.

Registration Used in the Tutorial

Here are the new contents of register.dat used for Bert’s registration in this tutorial:


Tips for Manual Registration:

Manual registration can be a tedious process. It is recommended that the user first translate, then rotate, and, as a last resort, scale. Keep in mind that a registration improvement in one part of the volume can degrade that in another part. It is best to make small adjustments at several locations around the brain, slowly converging on the optimum registration.

FsFastTutorialV4.5/930_Run_functional_and_structural_registration (last edited 2011-05-19 15:29:07 by NickSchmansky)