DTI/FSL

Right-click desktop and open new terminal

psy4320 (sources the software and takes you to the course’s folder structure)

cd ../dti (takes you to the dti folder)

ls (shows you the files and folder in the dti folder)

mkdir name (create your own folder [replace name with something else])

cp -r id* name/ (copy data into your folder, could take a few minutes)

In the dti folder, every subject has its own sub-folder (idXXX).

cd name (takes you to your folder)

cd idXXX

ls

Here you should see bvals bvecs data.nii.gz

View the dti raw data in fslview

fslview data.nii.gz

Look at the data and familiarize yourself with the FslView tool. The data file contains 80 3D volumes. Look at every frame/volume.

Now you are ready to perform the initial processing.

fslroi data.nii.gz nodif 0 1

Look at nodif.nii.gz in fslview

fslview nodif.nii.gz

Remove non-brain tissue (skull, dura, eyes etc)

bet nodif.nii.gz nodif_brain –m –f .2

Look at skull-stripped volume

fslview nodif_brain.nii.gz (does it look ok?)

Compute FA and other DTI parameter maps using dtifit

dtifit –k data –m nodif_brain_mask –r bvecs –b bvals –o data

ls

Which new files have been generated?

Look at the generated FA volume and find areas of low and high FA. Why is FA low/high in these areas?

fslview data_FA.nii.gz

Look at the principal eigenvector volume (as RGB and lines)

fslview data_FA data_V1 data_V1

In fslview, change viewer to RGB and lines. Check if the colors and lines are reasonable

Repeat the above for all subjects, then:

Go to your dti folder

psy4320

cd ../dti/<name>

Create TBSS folder

mkdir tbss

Copy all subjects’ FA data into tbss folder

cp idXXX/data_FA.nii.gz tbss/idXXX.nii.gz (and so on, this can easily be scripted)

Go to tbss folder and look at files

cd tbss

ls

You should see one file per subject (id300.nii.gz etc)

Start TBSS processing (this will take a few minutes)

tbss_1 *

When done, check what has been done and also inspect the generated html file.

firefox FA/slicesdir/index.html

Check that all volumes are correctly aligned (they should look similar).

Continue with the next TBSS step (this could take several days, so find Lars at this point instead of running the command)

tbss_2_reg –T

Continue with the third TBSS step (this could take half an hour)

tbss_3_postreg -S

Which new files and folder have been generated?

Look at the average FA volume

fslview stats/mean_FA.nii.gz

Does it look reasonable? See if large areas of the brain are lacking or any other anomalies.

Overlay the mean_skeleton (“Add”) stats/mean_FA_skeleton. Check if this looks reasonable. Try with different thresholds (0.2, 0.3, 0.5 etc). Which threshold would you prefer and why?

Run last step of the TBSS procedure

tbss_4_prestats <threshold> Insert your threshold (usually 0.2 is recommended)

At this point, you are ready to prepare the stats files. Copy the file describing the included subjects to your folder and open it

psy4320

cd ..

cp ids.txt dti/<name>/

cd dti/<name>/

gedit ids.txt

Set up data matrix and contrasts (statistical models). This should be done when you have finished the ERP analyses and have P300 amplitude and latency measures for each subject.

Glm (ask Lars at this point)

Run statistics (this will take up to 48 hours, depending on the number of contrasts)

randomise –i all_FA_skeletonised –o <stats> –m stats/mean_FA_skeleton_mask –t <stats>.con –d <stats>.mat –x – –T2 –n 5000

Morphometry/FreeSurfer

Right-click desktop and open new terminal

psy4320 (sources the software and takes you to the course’s folder structure)

ls

Look at the raw T1-weighted data for a random subject (idXXX)

tkmedit –f idXXX/mri/T1.mgz

Familiarize yourself with the tkmedit tool. Find subcortical structures like the hippocampus, the cerebellum, the lateral ventricles etc. Compare with other subjects.

Look at the generated surfaces for a random subject:

tkinflated idXXX

Familiarize yourself with the tksurfer tool. Look both at the white, pial and inflated surfaces. Compare with other subjects.

Look at the segmented volume for a random subject

wmseg idXXX

Turn on and off the different segmentations and surfaces. Turn on the pial surface and check if it looks accurate. Turn on the white surface and check if it looks accurate. The thickness of the cerebral is calculated as the difference between the white and the pial surface, so it is important that the surfaces are accurate. Turn on the subcortical segmentation and locate structures like hippocampus, amygdala, cerebellum, lateral ventricles etc. Compare a young and an old subject (check age in the file ids.txt). Do you see any large differences between the old and the young brain?

Visualize the variability in cortical thickness on the subject’s surface:

tkinflated idXXX

Open overlay -> ?h.thickness. Adjust thresholds. Where is the cortex thickest? Where is it thinnest? Compare different subjects side by side.

Create your own folder

psy4320

mkdir <name>

cd <name>

Create a group descriptor file (fsgd-file, ask Lars)

Prepare group files for statistics for left and right hemisphere (lh/rh)

psy4320

mris_preproc --fsgd <fsgd-file> --target fsaverage --hemi lh --meas thickness –out <name>/lh.thickness.mgh

mris_preproc --fsgd <fsgd-file> --target fsaverage --hemi rh --meas thickness --out <name>/rh.thickness.mgh

Smooth surfaces

cd <name>

mri_surf2surf --hemi lh --s fsaverage –sval lh.thickness. mgh --fwhm 20

--tval lh.thickness.20.mgh

Repeat for right hemisphere

Setup stats file (ask Lars)

Run statistics

psy4320

cd <name>

mri_glmfit --y lh.thickness.20.mgh --label $SUBJECTS_DIR/fsaverage/label/lh.cortex.label --fsgd <stats>.fsgd doss --glmdir lh.<analyse>.20 --surf fsaverage lh --C <contrast>.con

Repeat for right hemisphere

Inspect results

psy4320

tkinflated fsaverage

Load sig.mgh files as overlays (find it in your folder). Adjust threshold and find areas of effects. Load scatter plot and inspect results. How would you describe the results?

1