Back to list of tutorials

Longitudinal Processing - Tutorial

This page will take you through the steps of processing your longitudinal data:

Ater the tutorial (if you want to learn more) you can read details about the longitudinal stream at LongitudinalProcessing and about edits at LongitudinalEdits.


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/long-tutorial

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.

If you are NOT taking one of the formally organized courses, klick here.

Longitudinal Image Processing

All data for this tutorial has already been processed for you (processing can take up to 24h). However, to continue you need to understand the three processing steps (cross, base, long) and associated directory names.

For example, assume you have a subject with two time points: OAS2_0001_MR1 and OAS2_0001_MR2.

  1. [CROSS]: You would process these two images independently first (we call that cross as in crossectional analysis/processing) using the regular freesurfer processing stream (recon-all). You end up with two directories with the names OAS2_0001_MR1 and OAS2_0001_MR2

  2. [BASE]: Then you would run the second step to create the within subject template (also called base) and end up with a new directory. There is only one base directory per subject. We decide to name the base: OAS2_0001. Inside this directory are the results for the average anatomy of your subject across time. You don't use this data in any analysis, and only look at it for quality checking or editing.

  3. [LONG]: Finally you would create the two longitudinal runs (the ones you are actually interested in). You end up with two more directories (these names get automatically assigned): OAS2_0001_MR1.long.OAS2_0001 and OAS2_0001_MR2.long.OAS2_0001. They contain the final, most reliable and accurate processing results.

You can now continue with the next section (inspecting the data).

If you want to learn about the exact commands for processing your data, click here.

Inspecting Longitudinal Data

Finally you get to try out a few commands! We use freeview (FreeviewGuide) as a viewer in this tutorial.

First let's check the base (subject template) of a single subject. Open the norm.mgz and surfaces with freeview. If you run the following command and freeview opens in another view, you can click on the Coronal button in order to see the data in the same view:

freeview -v OAS2_0001/mri/norm.mgz \
         -f OAS2_0001/surf/lh.pial:edgecolor=red \
            OAS2_0001/surf/rh.pial:edgecolor=red \
            OAS2_0001/surf/lh.white:edgecolor=blue \

This will show you the average image, basically the average anatomy of this subject across time overlayed with the pial and white surface. If the across-time registration failed you would see a blurry image or ghosts. You can also inspect the surfaces on the average anatomy. This will be important later as the surfaces are transferred into the longitudinal runs and therefore should be accurate in the base. Move back and forth a few slices and see if the surfaces follow the white matter ant gray matter boundaries.

Now it is time to look at the longitudinal results. Starting with Freesurfer 5.1, the base and the long runs are all in the same voxel space, therefore images are already aligned and can be directly compared if opened on top of each other (how convenient ;-). Close any open freeview window to reduce memory usage and run the following command:

freeview -v OAS2_0001_MR1.long.OAS2_0001/mri/norm.mgz \
            OAS2_0001_MR2.long.OAS2_0001/mri/norm.mgz \
         -f OAS2_0001_MR1.long.OAS2_0001/surf/lh.pial:edgecolor=red \
            OAS2_0001_MR1.long.OAS2_0001/surf/lh.white:edgecolor=blue \
            OAS2_0001_MR2.long.OAS2_0001/surf/lh.pial:edgecolor=255,128,128 \

This might take a while to load (check the progress bar). You will see the normalized skull stripped images (norm.mgz) of both time points on top of each other (the second time point is the top-most layer and so the only one visible at the moment). You also see the white and pial surface for each time point, drawn on top of each other (we only show the left hemisphere here to reduce memory usage for older computers). Time point 1 uses red and blue while time point 2 uses pink and light blue for the surface colors. The surfaces do not change much across time. You can also compare the images directly. For this, uncheck the 4 check boxes in front of all the surfaces. In older versions, click on the 'Volumes' tab which shows the two timepoint's norm.mgz files (newer versions of Freeview don't have tabs anymore). Select the first (top) norm volume and use the opacity slider to blend between the two images. You can also switch back and forth between the two images by pressing 'Alt-c'. Use 'Page Up' and 'Page Down' to scroll through the slices. You will mainly notice that the ventricles are getting larger in the second time point (and some non-linearities).