Differences between revisions 5 and 26 (spanning 21 versions)
Revision 5 as of 2012-11-21 13:01:41
Size: 4318
Editor: tanha
Comment:
Revision 26 as of 2022-03-01 12:24:25
Size: 8081
Editor: DougGreve
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
Line 5: Line 4:
= Surface-based Interhemispheric Registration =

Greve, D.N., Sabuncu, M.R., Shafee, R., Schmansky, N., Buckner, R.L.,
and Fischl, B. (2011). Automatic surface-based interhemispheric
registration with FreeSurfer (Quebec City, Canada: 17th Annual Meeting
of the Organization on Human Brain Mapping, June 2011).
http://www.nmr.mgh.harvard.edu/martinos/publications/posters/HBM-2011/HBM11-Greve.pdf
= Xhemi: Surface-based Interhemispheric Registration and Analysis =
This page describes xhemi, a collection of routines to perform interhemispheric cortical surface-based analysis. Those using this procedure should site the following paper: Greve, Douglas N., Lise Van der Haegen, Qing Cai, Steven Stufflebeam, Mert R. Sabuncu, Bruce Fischl, and Marc Bysbaert. "A surface-based analysis of language lateralization and cortical asymmetry." (2013). Journal of Cognitive Neuroscience 25.9: 1477-1492.
Line 14: Line 8:
Line 18: Line 11:
Line 19: Line 13:
ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/surfreg
ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/xhemireg
ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/mris_preproc
ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/fsaverage_sym.tar.gz
ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/mult-comp-cor.tar.gz
ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/mri_convert.{linux,mac}
ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/mri_vol2vol.{linux,mac}
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/surfreg
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/xhemireg
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/mris_preproc
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/fsaverage_sym.tar.gz
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/mult-comp-cor.tar.gz
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/mri_convert.{linux,mac}
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/mri_vol2vol.{linux,mac}
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/mri_surf2surf.{linux,mac}
Line 27: Line 22:
Copy surfreg, xhemireg, mris_preproc into $FREESURFER_HOME/bin <<BR>> Copy mri_convert.{linux,mac} into $FREESURFER_HOME/bin/mri_convert <<BR>> Copy mri_vol2vol.{linux,mac} into $FREESURFER_HOME/bin/mri_vol2vol <<BR>>
Line 28: Line 24:
Copy surfreg, xhemireg, mris_preproc into $FREESURFER_HOME/bin
Copy mri_convert.{linux,mac} into $FREESURFER_HOME/bin/mri_convert
Copy mri_vol2vol.{linux,mac} into $FREESURFER_HOME/bin/mri_vol2vol
# Untar fsaverage_sym.tar.gz into your $SUBJECTS_DIR<<BR>> cd $SUBJECTS_DIR<<BR>> tar xvfz fsaverage_sym.tar.gz<<BR>>
Line 32: Line 26:
# Untar fsaverage_sym.tar.gz into your $SUBJECTS_DIR
cd $SUBJECTS_DIR
tar xvfz fsaverage_sym.tar.gz
# Untar mult-comp-cor.tar.gz into $FREESURFER_HOME/average<<BR>> cd $FREESURFER_HOME/average<<BR>> tar xvfz mult-comp-cor.tar.gz<<BR>>
Line 36: Line 28:
# Untar mult-comp-cor.tar.gz into $FREESURFER_HOME/average
cd $FREESURFER_HOME/average
tar xvfz mult-comp-cor.tar.gz
# Copy mris_preproc into $FREESURFER_HOME/bin after making a backup<<BR>>
Line 40: Line 30:
# Copy mris_preproc into $FREESURFER_HOME/bin after making a backup
To apply an existing atlas (eg, fsaverage_sym) to an anatomical analysis
== Apply an existing atlas (fsaverage_sym) in a group study ==
# Reg to atlas (1-2 hours per subject)<<BR>> # Creates $subject/xhemi<<BR>> # Creates lh.fsaverage_sym.sphere.reg in $subject and $subject/xhemi<<BR>>
Line 43: Line 33:
== Apply an existing atlas (fsaverage_sym) ==

# Reg to atlas (1-2 hours per subject)
# Creates $subject/xhemi
# Creates lh.fsaverage_sym.sphere.reg in $subject and $subject/xhemi
Line 50: Line 35:
  surfreg --s $subject --t fsaverage_sym --lh
  surfreg --s $subject --t fsaverage_sym --lh --xhemi
  surfreg --s $subject --t fsaverage_sym --lh --no-annot
  surfreg --s $subject --t fsaverage_sym --lh --no-annot --xhemi
Line 54: Line 39:
Though the right hemisphere is not explicitly listed above, it is implied by --lh --xhemi. It is possible to run the above commands with --rh, but there is no need to do so unless you are trying to evaluate the bias the procedure. If this is something you choose to do, you can run the first command before the above two commands finish, but wait to run the 2nd (--xhemi) command until the lh --hemi command has finished. The --no-annot tells surfreg not to use the annotation (aparc) to help with the registration. This was creating some artifacts on the edge of the medial wall. If you want to continue with the previous behavior, use --aparc instead of --no-annot.<<BR>>
Line 56: Line 42:
Line 57: Line 44:
mris_preproc --target fsaverage_sym --hemi lh  mris_preproc --target fsaverage_sym --hemi lh
Line 64: Line 51:
# Smooth. This example smooths by 10mm on the surface. This is only an example and your data might be better off being smoothed more or less. There is no way to determine what the optimal smoothing level is. Note that smoothing is always done on the lh of fsaverage_sym.
Line 65: Line 53:
# Smooth
Line 67: Line 54:
mris_fwhm --s fsaverage_sym --hemi lh --cortex --smooth-only --fwhm 5\
 --i lh.lh-rh.thickness.sm00.mgh --o lh.lh-rh.thickness.sm05.mgh
mris_fwhm --s fsaverage_sym --hemi lh --cortex --smooth-only --fwhm 10\
 --i lh.lh-rh.thickness.sm00.mgh --o lh.lh-rh.thickness.sm10.mgh
Line 70: Line 57:
# Analyze. Note that glmfit is always done on the lh of fsaverage_sym.
Line 71: Line 59:
# Analyze
Line 73: Line 60:
mri_glmfit --y lh.lh-rh.thickness.sm05.mgh --glmdir glm.lh.lh-rh.thickness.sm05 \
 --osgm --surf fsaverage_sym lh 
mri_glmfit --y lh.lh-rh.thickness.sm10.mgh --glmdir glm.lh.lh-rh.thickness.sm10 \
 --osgm --surf fsaverage_sym lh
Line 76: Line 63:
# View. Note that viewing is always done on the lh of fsaverage_sym.
Line 77: Line 65:
# View
Line 79: Line 66:
tksurfer fsaverage_sym lh inflated -aparc -overlay glm.lh.lh-rh.thickness.sm05/osgm/sig.mgh tksurfer fsaverage_sym lh inflated -aparc -overlay glm.lh.lh-rh.thickness.sm10/osgm/sig.mgh
Line 81: Line 68:
# Correct for multiple comparisons
Line 82: Line 70:
# Correct for multiple comparisons
Line 84: Line 71:
mri_glmfit-sim --glmdir glm.lh.lh-rh.thickness.sm05 \ mri_glmfit-sim --glmdir glm.lh.lh-rh.thickness.sm10 \
Line 87: Line 74:
== Apply an existing atlas (fsaverage_sym) to an overlay of an individual ==
Map the left hemi to fsaverage_sym left hemi

{{{
mris_apply_reg --src lh.map.mgh --trg lh.map.lh.fsaverage_sym.mgh
--streg $SUBJECTS_DIR/subject/surf/lh.fsaverage_sym.sphere.reg
        $FREESURFER_HOME/subjects/fsaverage_sym/surf/lh.sphere.reg
}}}
Map the right hemi to fsaverage_sym left hemi. Note that it is not using the above command changing lh and rh. Instead, lh.fsaverage_sym.mgh is still used, but it is the one in the xhemi folder (which means that it is rh). All further commands using rh.map.lh.fsaverage_sym.mgh (eg, smoothing with mris_fwhm or mri_surf2surf) should use the left hemi (lh) of fsaverage_sym and not the right hemi.

{{{
mris_apply_reg --src rh.map.mgh --trg rh.map.lh.fsaverage_sym.mgh
   --streg $SUBJECTS_DIR/subject/xhemi/surf/lh.fsaverage_sym.sphere.reg
           $FREESURFER_HOME/subjects/fsaverage_sym/surf/lh.sphere.reg
}}}
You now how lh.map and rh.map on the lh of fsaverage_sym (and so in vertex-for-vertex alignment). You can look at with with

{{{
tksurferfv fsaverage_sym lh inflated -aparc -ov lh.map.lh.fsaverage_sym.mgh -ov rh.map.lh.fsaverage_sym.mgh
}}}
These will be two different overlays (lh and rh), so one does not expect them to be identical.

== Compute Laterality Index ==
The Laterality Index LI = (LH-RH)/(LH+RH)

{{{
fscalc lh.map.lh.fsaverage_sym.mgh pctdiff0 rh.map.lh.fsaverage_sym.mgh div 200 -o li.map.lh.fsaverage_sym.mgh
}}}
Above, pctdiff is the percent differenence = 100*(LH-RH)/((LH+RH)/2), so it has to be divided by 200 to get the LI.

== Map the right hemisphere of an individual to the left of same person ==
Thickness map

{{{
cd $SUBJECTS_DIR/subject
mris_apply_reg --src surf/rh.thickness --trg rh-on-lh.thickness.mgh \
  --streg xhemi/surf/lh.fsaverage_sym.sphere.reg surf/lh.fsaverage_sym.sphere.reg
}}}
rh-on-lh.thickness.mgh will be the right hemisphere thickenss sampled onto the left hemisphere.

Map a label

{{{
cd $SUBJECTS_DIR/subject
mris_apply_reg --src-label label/rh.V1_exvivo.thresh.label --trg rh-on-lh.V1_exvivo.thresh.label \
--streg xhemi/surf/lh.fsaverage_sym.sphere.reg surf/lh.fsaverage_sym.sphere.reg
}}}
rh-on-lh.V1_exvivo.thresh.label is now a label on the right hemisphere
Line 89: Line 124:
# Create xhemi subject (don't reg, a few minutes to finish)
Line 90: Line 126:
# Create xhemi subject (don't reg, a few minutes to finish)
Line 96: Line 131:
# Reg to existing sym atlas # Note: if you want test how symmetrical the atlas is use --lhrh # (but it takes twice as long)
Line 97: Line 133:
# Reg to existing sym atlas
# Note: if you want test how symmetrical the atlas is use --lhrh
# (but it takes twice as long)
Line 106: Line 139:
# Make first iteration (<5min)
Line 107: Line 141:
# Make first iteration (<5min)
Line 113: Line 146:
  --no-vol --template-only    --no-vol --template-only
Line 115: Line 148:
   # Reg to first iteration
# Note: if you want test the symmetry, use --lhrh 
# Reg to first iteration # Note: if you want test the symmetry, use --lhrh
Line 124: Line 156:
# Make second iteration (<5min)
Line 125: Line 158:
# Make second iteration (<5min)
Line 131: Line 163:
  --no-vol --template-only    --no-vol --template-only
Line 133: Line 165:
   # Reg to second iteration. Note: if you want test the symmetry, use --lhrh  # Reg to second iteration. Note: if you want test the symmetry, use --lhrh
Line 141: Line 173:
# Note: you may need to iterate "many" times to reach convergence. How many is "many"? Not sure, but in the above publication is was about 30 times. Probably overkill.
Line 143: Line 176:
Line 147: Line 181:
  --xhemi --hemi lh   --xhemi --lh

1. Xhemi: Surface-based Interhemispheric Registration and Analysis

This page describes xhemi, a collection of routines to perform interhemispheric cortical surface-based analysis. Those using this procedure should site the following paper: Greve, Douglas N., Lise Van der Haegen, Qing Cai, Steven Stufflebeam, Mert R. Sabuncu, Bruce Fischl, and Marc Bysbaert. "A surface-based analysis of language lateralization and cortical asymmetry." (2013). Journal of Cognitive Neuroscience 25.9: 1477-1492.

1.1. Installation

Note: you only need to do this installation if you have version 5.1 or lower

Download these files

ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/surfreg
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/xhemireg
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/mris_preproc
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/fsaverage_sym.tar.gz
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/mult-comp-cor.tar.gz
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/mri_convert.{linux,mac}
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/mri_vol2vol.{linux,mac}
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.1.0/xhemi/mri_surf2surf.{linux,mac}

Copy surfreg, xhemireg, mris_preproc into $FREESURFER_HOME/bin
Copy mri_convert.{linux,mac} into $FREESURFER_HOME/bin/mri_convert
Copy mri_vol2vol.{linux,mac} into $FREESURFER_HOME/bin/mri_vol2vol

# Untar fsaverage_sym.tar.gz into your $SUBJECTS_DIR
cd $SUBJECTS_DIR
tar xvfz fsaverage_sym.tar.gz

# Untar mult-comp-cor.tar.gz into $FREESURFER_HOME/average
cd $FREESURFER_HOME/average
tar xvfz mult-comp-cor.tar.gz

# Copy mris_preproc into $FREESURFER_HOME/bin after making a backup

1.2. Apply an existing atlas (fsaverage_sym) in a group study

# Reg to atlas (1-2 hours per subject)
# Creates $subject/xhemi
# Creates lh.fsaverage_sym.sphere.reg in $subject and $subject/xhemi

foreach subject (subjectlist)
  surfreg --s $subject --t fsaverage_sym --lh --no-annot
  surfreg --s $subject --t fsaverage_sym --lh --no-annot --xhemi
end

Though the right hemisphere is not explicitly listed above, it is implied by --lh --xhemi. It is possible to run the above commands with --rh, but there is no need to do so unless you are trying to evaluate the bias the procedure. If this is something you choose to do, you can run the first command before the above two commands finish, but wait to run the 2nd (--xhemi) command until the lh --hemi command has finished. The --no-annot tells surfreg not to use the annotation (aparc) to help with the registration. This was creating some artifacts on the edge of the medial wall. If you want to continue with the previous behavior, use --aparc instead of --no-annot.

# Create a stack of subjects

mris_preproc --target fsaverage_sym --hemi lh
  --xhemi --paired-diff \
  --srcsurfreg fsaverage_sym.sphere.reg \
  --meas thickness \
  --out lh.lh-rh.thickness.sm00.mgh \
  --s subj1 --s subj2 ...

# Smooth. This example smooths by 10mm on the surface. This is only an example and your data might be better off being smoothed more or less. There is no way to determine what the optimal smoothing level is. Note that smoothing is always done on the lh of fsaverage_sym.

mris_fwhm --s fsaverage_sym --hemi lh --cortex --smooth-only --fwhm 10\
 --i lh.lh-rh.thickness.sm00.mgh --o lh.lh-rh.thickness.sm10.mgh

# Analyze. Note that glmfit is always done on the lh of fsaverage_sym.

mri_glmfit --y lh.lh-rh.thickness.sm10.mgh --glmdir glm.lh.lh-rh.thickness.sm10 \
 --osgm --surf fsaverage_sym lh

# View. Note that viewing is always done on the lh of fsaverage_sym.

tksurfer fsaverage_sym lh inflated -aparc -overlay glm.lh.lh-rh.thickness.sm10/osgm/sig.mgh

# Correct for multiple comparisons

mri_glmfit-sim --glmdir glm.lh.lh-rh.thickness.sm10 \
   --cwpvalthresh .5 --cache 2 abs

1.3. Apply an existing atlas (fsaverage_sym) to an overlay of an individual

Map the left hemi to fsaverage_sym left hemi

mris_apply_reg --src lh.map.mgh --trg lh.map.lh.fsaverage_sym.mgh
--streg $SUBJECTS_DIR/subject/surf/lh.fsaverage_sym.sphere.reg
        $FREESURFER_HOME/subjects/fsaverage_sym/surf/lh.sphere.reg

Map the right hemi to fsaverage_sym left hemi. Note that it is not using the above command changing lh and rh. Instead, lh.fsaverage_sym.mgh is still used, but it is the one in the xhemi folder (which means that it is rh). All further commands using rh.map.lh.fsaverage_sym.mgh (eg, smoothing with mris_fwhm or mri_surf2surf) should use the left hemi (lh) of fsaverage_sym and not the right hemi.

mris_apply_reg --src rh.map.mgh --trg rh.map.lh.fsaverage_sym.mgh
   --streg $SUBJECTS_DIR/subject/xhemi/surf/lh.fsaverage_sym.sphere.reg
           $FREESURFER_HOME/subjects/fsaverage_sym/surf/lh.sphere.reg

You now how lh.map and rh.map on the lh of fsaverage_sym (and so in vertex-for-vertex alignment). You can look at with with

tksurferfv fsaverage_sym lh inflated -aparc -ov lh.map.lh.fsaverage_sym.mgh -ov rh.map.lh.fsaverage_sym.mgh

These will be two different overlays (lh and rh), so one does not expect them to be identical.

1.4. Compute Laterality Index

The Laterality Index LI = (LH-RH)/(LH+RH)

fscalc lh.map.lh.fsaverage_sym.mgh pctdiff0 rh.map.lh.fsaverage_sym.mgh div 200 -o li.map.lh.fsaverage_sym.mgh

Above, pctdiff is the percent differenence = 100*(LH-RH)/((LH+RH)/2), so it has to be divided by 200 to get the LI.

1.5. Map the right hemisphere of an individual to the left of same person

Thickness map

cd $SUBJECTS_DIR/subject
mris_apply_reg --src surf/rh.thickness --trg rh-on-lh.thickness.mgh \
  --streg xhemi/surf/lh.fsaverage_sym.sphere.reg surf/lh.fsaverage_sym.sphere.reg

rh-on-lh.thickness.mgh will be the right hemisphere thickenss sampled onto the left hemisphere.

Map a label

cd $SUBJECTS_DIR/subject
mris_apply_reg --src-label label/rh.V1_exvivo.thresh.label --trg rh-on-lh.V1_exvivo.thresh.label \
--streg xhemi/surf/lh.fsaverage_sym.sphere.reg surf/lh.fsaverage_sym.sphere.reg

rh-on-lh.V1_exvivo.thresh.label is now a label on the right hemisphere

1.6. Build Your Own Atlas

# Create xhemi subject (don't reg, a few minutes to finish)

foreach subject (subjectlist)
  xhemireg --s $subject
end

# Reg to existing sym atlas # Note: if you want test how symmetrical the atlas is use --lhrh # (but it takes twice as long)

foreach subject (subjectlist)
  surfreg --s $subject --t fsaverage_sym --lh
  surfreg --s $subject --t fsaverage_sym --xhemi --lh
end

# Make first iteration (<5min)

make_average_subject --out myatlas.i1 \
  --surf-reg fsaverage_sym.sphere.reg \
  --subjects subjectlist \
  --xhemi \
  --no-vol --template-only

# Reg to first iteration # Note: if you want test the symmetry, use --lhrh

foreach subject (subjectlist)
  surfreg --s $subject --t myatlas.i1 --lh
  surfreg --s $subject --t myatlas.i1 --xhemi --lh
end

# Make second iteration (<5min)

make_average_subject --out myatlas.i2 \
  --surf-reg myatlas.i1.sphere.reg \
  --subjects subjectlist \
  --xhemi \
  --no-vol --template-only

# Reg to second iteration. Note: if you want test the symmetry, use --lhrh

foreach subject (subjectlist)
  surfreg --s $subject --t myatlas.i2 --lh
  surfreg --s $subject --t myatlas.i2 --xhemi --lh
end

# Note: you may need to iterate "many" times to reach convergence. How many is "many"? Not sure, but in the above publication is was about 30 times. Probably overkill.

# Make final iteration (1-2 hours)

 make_average_subject --out myatlas.i3 \
  --surf-reg myatlas.i2.sphere.reg \
  --subjects subjectlist \
  --xhemi --lh

Xhemi (last edited 2025-06-03 10:54:09 by DougGreve)