FreeSurfer GLM Tutorial - tannerjared/MRI_Guide GitHub Wiki

Steps to run through the FreeSurfer GLM tutorial in a HiPerGator Desktop session

cd /blue/clp7934/share/Module5 #Go into the Module 5 directory

cp tutorial_data.tar.gz ../{your gatorlink}/ #Copy tutorial_data.tar.gz from Module5 into your personal directory

cd ../{your gatorlink} #Go into your directory

tar -xzvf tutorial_data.tar.gz && rm tutorial_data.tar.gz #extract the tutorial data and then remove the .tar.gz file. This will take a while to complete

cd tutorial_data_20190918_1558 #Go into the tutorial data directory

rm -fr dicom_challenge/ diffusion_recons/ diffusion_tutorial/ fsfast-functional/ fsfast-tutorial.subjects/ practice_with_data/ #Remove some unnecessary data

cd tutorial_data_20190918_1558/buckner_data/tutorial_subjs/group_analysis_tutorial #change into the group analysis tutorial directory

module load freesurfer #Make FreeSurfer available to use

export SUBJECTS_DIR=$PWD #set FreeSurfer's subjects directory to your current location. Alternatively, you can put in the whole path after the equal sign

echo $SUBJECTS_DIR #This will verify that SUBJECTS_DIR really is your current location. Make sure the path printed to the screen is where you think you are.

cd glm && ls #go in the GLM directory and display contents. The && runs the ls command if the previous command successfully completed.

Preprocessing for the analysis has already been done.

You do not need to run what's in the next block of code

mris_preproc --fsgd gender_age.fsgd \
--target fsaverage \
--hemi lh \
--meas thickness \
--out lh.gender_age.thickness.00.mgh

mri_surf2surf --hemi lh \
--s fsaverage \
--sval lh.gender_age.thickness.00.mgh \
--fwhm 10 \
--cortex \
--tval lh.gender_age.thickness.10.mgh

This is the end of the code that has already been run. Run everything after this.

This next command runs the general linear model, which is a linear regression. What you are testing is if there is a relationship between cortical thickness and age, adjusting for sex

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

View the analysis results

freeview -f $SUBJECTS_DIR/fsaverage/surf/lh.inflated:annot=aparc.annot:annot_outline=1:overlay=lh.gender_age.glmdir/lh-Avg-thickness-age-Cor/sig.mgh:overlay_threshold=1,5 -viewport 3d -layout 1