#1. INITIALIZATION
freesurfer
tksurfer 005 brainmask.mgz
#2. SET SUBJECT DIRECTORY
export SUBJECTS_DIR=/study/NCCAM/Data/MRI/processed/structural/freesurfer
cd /study/NCCAM/Data/MRI/processed/structural/freesurfer/
#3. PREPROCESSING LONGITUDINAL
recon-all -base ${subject}_template -tp ${subject}_1 -tp ${subject}_2 -all
recon-all -long ${subject}_1 ${subject}_template -all
recon-all -long ${subject}_2 ${subject}_template -all
#4. POSTPROCESSING LONGITUDINAL BY CREATING QDEC TABLE
#Example file named: long.qdec.table.dat
fsid fsid-base group age painUnp tp
WB101_1 WB101_template MNP 65.72 11.7 0
WB401_1 WB401_template LTM 59 11.6 0
WB101_2 WB101_template MNP 65.72 8.6 1
WB401_2 WB401_template LTM 59 1
#5. OPEN QDEC TABLE
gedit qdec/long.qdec.table.dat
#6. CREATE a qdec/measures.Qdecrc file in the qdec directory that contains the following line, so that the QDEC analysi know about new files.
#Example file named: measures.Qdecrc
MEASURE1 = long.thickness-avg
MEASURE2 = long.thickness-rate
MEASURE3 = long.thickness-pc1
MEASURE4 = long.thickness-spc
#7. CREATE file for each discrete (categorical) factor
#Example file named: group.levels
MNP
LTM
#8. Pre-smooth fsaverage surfaces
#Qdec needs each subject to have pre-computed smoothed data for the target surface (fsaverage is the default) for each measure (thickness, sulc, area, curv, etc.). Your SUBJECTS_DIR should contain either a link or a copy of the 'fsaverage' subject found in your $FREESURFER_HOME/subjects directory. Presmoothing the data onto the target surface is not part of the normal recon processing stream, but you can easily create this data with recon-all, using the command:
recon-all -s <subject> -qcache
#9. Shrink qdec table from a longitudinal form to a cross sectional form, in order to run the QDEC group analysis.
long_qdec_table --qdec ./qdec/long.qdec.table.dat --cross --out ./qdec/cross.qdec.table.dat
#10. PREPARE DATA QCACHE
long_mris_slopes --qdec ./qdec/long.qdec.table.dat --meas thickness --hemi lh --do-avg --do-rate --do-pc1 --do-spc --do-stack --do-label --time tp --qcache fsaverage
#11. Open pial surface of left hemi on average subject. Open symmetrized percent change.
#--qcache flag of long_mris_slopes has been registered and mapped all results to the average subject
tksurfer fsaverage lh pial -overlay $SUBJECTS_DIR/OAS2_0001/surf/lh.long.thickness-spc.fwhm15.fsaverage.mgh -aparc
#12. Run the QDEC analysis on the qdec table:
qdec --table ./qdec/cross.qdec.table.dat