Save SPM8 results with anatomical labels

Hi there! This little script saves cluster-level SPM results along with anatomical labels to spm_results_with_anat.txt file in the current directory. Results are appended to the file, so that you can run it repeatedly for different contrasts. It requires SPM8. Included are AAL atlas files: aal_MNI_V4.nii, aal_MNI_V4.txt and atlas to anatomical mapping: aal_to_anat.txt. It has already saved literally hours for me, so I bet you will find it useful as well.

Usage:

>> save_spm_results_with_anat
Select SPM.mat
Select contrast
Select masking/threshold/cluster extent
Results are appended to spm_results_with_anat.txt in the current directory

Output format is semicolon-separated:

contrast_name
1;4679.000000;4.581210;3.000000;-48.000000;-58.500000;L/R;R. crus i of cerebellar hemisphere, l. crus ii of cerebellar hemisphere, r. crus ii of cerebellar hemisphere, r. lobule vi of cerebellar hemisphere, l. lobule viib of cerebellar hemisphere, r. lobule viib of cerebellar hemisphere, l. lobule viii of cerebellar hemisphere, r. lobule viii of cerebellar hemisphere, l. lobule ix of cerebellar hemisphere, r. lobule ix of cerebellar hemisphere
2;209.000000;3.758119;22.500000;-64.500000;-28.500000;R;Lobule vi of cerebellar hemisphere
3;134.000000;3.700667;-1.500000;-1.500000;9.000000;R;Lobule iii of cerebellar hemisphere, lobule iv, v of cerebellar hemisphere
4;134.000000;3.615604;16.500000;-37.500000;-27.000000;R;Lobule iii of cerebellar hemisphere, lobule iv, v of cerebellar hemisphere
5;125.000000;4.193121;-6.000000;-85.500000;-22.500000;L;Crus i of cerebellar hemisphere, crus ii of cerebellar hemisphere

The columns contain successively: cluster ordinal number, cluster extent (voxels), T-score of the cluster peak, MNI coordinates (XYZ) of the cluster peak, side(s) of the brain included, anatomical labels.

Your data should be in MNI space!

DOWNLOAD: save_spm_results_with_anat.zip

License: same as SPM, but I’m not affiliated with SPM authors

Enjoy!

2 Comments

  • This is really cool! Thanks!
    One question, why are there several anatomical regions for each location in the output txt file (and not just one)?
    thanks a lot,
    Z

  • The regions are those intersected by respective SPM8 result _clusters_. The coordinates are given for the cluster peak voxel but the whole cluster contains multiple voxels usually from multiple regions.


Leave a Reply

Your email address will not be published. Required fields are marked *