SPM Scripts & Functions
Use the links above right to navigate to an archive of John’s Gems (for SPM99), Gems-2 (for SPM2) and Gems-5 (for SPM5).
Please note that since 2010 I no longer update John’s Gems, and have instead integrated them into my blog Neuroimaging Tips & Tools . Please use the John-Gems tag in the blog to find all the Gems; you may also find it useful to search by SPM version specific keywords as well.
Here are a few popular files that are embeded in old John’s Gems & the blog.
- CorrClusTh.m – This gives you the critical cluster size threshold for a given SPM result.
- SPM2: CorrClusTh.m
- SPM5: CorrClusTh.m
- SPM8 & SPM12: CorrClusTh.m
Bash script to generate set of 24 motion-derived regressors
- mp_diffpow24.sh Takes the 6-column motion parameter text file and produces a 24-column text file. The first 6 are copies of the input (6 rigid body motion parameters), the next 6 columns are the squares of these parameters, the next 6 columns are the temporal derivatives of the motion parameters, and the final 6 columns are the squares of of the temporal derivaties. The result is then suitable to be added as “multiple regressors” in a first level SPM fMRI analysis.