Differences between revisions 2 and 3
Deletions are marked like this. Additions are marked like this.
Line 27: Line 27:
is the same data set used in the [[FsTutorial/QdecGroupAnalysis| QDEC
Tutorial]], and you will get the same result.
is the same data set used in the
[[FsTutorial/QdecGroupAnalysis|QDEC Tutorial]],
and you will get the same result.
Line 87: Line 88:
== Previously Cached (qcached) Data == === Previously Cached (qcached) Data ===
Line 113: Line 114:
== Uncached Data == === Uncached Data ===
Line 140: Line 141:
  1. "--cortex" means only smooth areas in cortex (exclude medial wall)   1. "--cortex" means only smooth areas in cortex (exclude medial
 
wall). This is automatically done with qcache. You can also specify
  other labels.
Line 142: Line 145:

== GLM Analysis ==

{{{
mri_glmfit \
  --y lh.gender_age.thickness.10.mgh \
  --fsgd gender_age.fsgd dods\
  --C lh-Avg-thickness-age-Cor.mtx \
  --surf fsaverage lh \
  --cortex \
  --glmdir lh.gender_age.glmdir
}}}
Notes:
  1. Input is lh.gender_age.thickness.10.mgh
  1. Same FSGD used as with mris_preproc. Maintains subject order!
  1. DODS is specfied (it is the default)
  1. Only one contrast is used (lh-Avg-thickness-age-Cor.mtx) but you
  can specify multiple contrasts.
  1. "--cortex" specifies that the analysis only be done in cortex
  (ie, medial wall is zeroed out). Other labels can be used.
  1. The output directory is lh.gender_age.glmdir
  1. Should only take about 1min to run.

Things to do:

Back to Tutorial Top

Introduction

This tutorial is designed to introduce you to the "command-line" group analysis stream in FreeSurfer (as opposed to QDEC which is GUI-driven), including correction for multiple comparisons. While this tutorial shows you how to perform a surface-based thickness study, it is important to realize that most of the concepts learned here apply to any group analysis in FreeSurfer, surface or volume, thickness or fMRI.

QDEC Tutorial
FSGD Format
FSGD Examples
DODS vs DOSS

This Data Set

The data used for this tutorial is 40 subjects from Randy Buckner's lab. It consists of males and females ages 18 to 93. You can see the demograhics here. You will perform an analysis looking for the effect of age on cortical thickness accounting for the effects of gender in the analysis. This is the same data set used in the QDEC Tutorial, and you will get the same result.

General Linear Model (GLM) DODS Setup

Design Matrix/FSGD File

For this example, we will model the thickness as a straight line. A line has two parameters: intercept (or offset) and a slope.

  1. The slope is the change of thickness with age
  2. The intercept/offset is interpreted as the thickness at age=0.

To account for effects of gender, we will model each sex with its own line, meaning that there will be four linear parameters (also called "betas"):

  1. Intercept for Females
  2. Intercept for Males
  3. Slope for Females
  4. Slope for Males

In FreeSurfer, this type of design is called DODS (for "Different-Offset, Different-Slope").

In FreeSurfer, you can either create your own design matrices, or, if you can specify your design in terms of a FreeSurfer Group Descriptor File (FSGD), FreeSurfer will create them for you. The FSGD file is a simple text file. See this page for the format. The [[FsTutorial/GroupAnalysisDemographics|demographics page]] also has an example FSGD file for this data.

Things to do:

  1. Create an FSGD file for the above design. One (gender_age.fsgd) already exists so that you can continue with the exercises.

Contrasts

A contrast is a vector that embodies the hypothesis we want to test. In this case, we wish to test the change in thickness with age after removing the effects of gender. To do this, create a simple text file with the following numbers:

0 0 0.5 0.5

Notes:

  1. There is one value for each parameter (so 4 values)
  2. The intercept/offset values are 0 (nuisance)
  3. The slope values are 0.5 so as to average the F and M slopes
  4. A file called lh-Avg-thickness-age-Cor.mtx already exists

Analysis

Assemble the Data

Assembling the data simply means:

  1. Resampling each subject's data into a common space, and
  2. Concatenating all the subjects' into a single file
  3. Spatial smoothing (can be done between 1 and 2)

This can be done in two equivalent ways:

Previously Cached (qcached) Data

When you have run recon-all with the -qcache option, recon-all will resample data onto the average subject (fsaverage) and smooth it at various FWHM (full-width/half-max), usually 0, 5, 10, 10, 20, and 25mm. This can speed later processing. The data for this tutorial have been cached, so run:

mris_preproc --fsgd gender_age.fsgd \
  --cache-in thickness.fwhm10.fsaverage \
  --target fsaverage --hemi lh \
  --out lh.gender_age.thickness.10.mgh 

Notes:

  1. Only takes a few seconds because the data have been cached
  2. The FSGD file lists all the subjects, helps keep order.
  3. The independent variable is the thickness smoothed to 10mm FWHM.
  4. The data are for the left hemisphere
  5. The output is lh.gender_age.thickness.10.mgh (which already exists)

Things to do:

  1. Run mri_info on lh.gender_age.thickness.10.mgh to find its dimensions.

Uncached Data

In the case that you have no cached the data, you can perform the same operations manually using the two commands below. There is no need to do this for this tutorial.

OPTIONAL: THIS WILL TAKE ABOUT 10 MINUTES
mris_preproc --fsgd gender_age.fsgd \
  --target fsaverage --hemi lh \
  --meas thickness \
  --out lh.gender_age.thickness.00.mgh  

Notes:

  1. This resamples each subjects data to fsaverage
  2. Output is lh.gender_age.thickness.00.mgh, which is unsmoothed

OPTIONAL: THIS WILL TAKE ABOUT 5 MINUTES
mri_surf2surf --hemi lh \
  --s fsaverage \
  --sval lh.gender_age.thickness.mgh \
  --fwhm 10 \
  --cortex \
  --tval lh.gender_age.thickness.10B.mgh
  1. This smooths by 10mm FWHM
  2. "--cortex" means only smooth areas in cortex (exclude medial wall). This is automatically done with qcache. You can also specify other labels.
  3. Output is lh.gender_age.thickness.10B.mgh.

GLM Analysis

mri_glmfit \
  --y lh.gender_age.thickness.10.mgh \
  --fsgd gender_age.fsgd dods\
  --C lh-Avg-thickness-age-Cor.mtx \
  --surf fsaverage lh \
  --cortex \
  --glmdir lh.gender_age.glmdir 

Notes:

  1. Input is lh.gender_age.thickness.10.mgh
  2. Same FSGD used as with mris_preproc. Maintains subject order!
  3. DODS is specfied (it is the default)
  4. Only one contrast is used (lh-Avg-thickness-age-Cor.mtx) but you can specify multiple contrasts.
  5. "--cortex" specifies that the analysis only be done in cortex (ie, medial wall is zeroed out). Other labels can be used.
  6. The output directory is lh.gender_age.glmdir
  7. Should only take about 1min to run.

Things to do:

FsTutorial/GroupAnalysisDng (last edited 2009-01-17 21:10:16 by crash)