Some tutorial Python and Matlab programs for fMRI, pattern-based analysis and SPM

Here are some tutorial files that show how to use Python and Matlab for fMRI, including pattern-based analysis (also known as multi-voxel pattern analysis, or MVPA). Please feel more than free to use the code for teaching, and if you do, please mail me with comments and feedback.

The code has lots of comments in it, which attempt to explain the concepts as explicitly as possible. No prior knowledge of Matlab or linear algebra is assumed.

The following tutorials illustrate standard fMRI analysis, i.e. modeling individual voxel time-courses using a General Linear Model (GLM):
These next two tutorials show some approaches in pattern-based fMRI anaylsis: The following programs show how to use Matlab to view brain slices and to overlay statistical maps on top of anatomical scans. In order to run them, you need the companion .mat file that contains the brain images: speech_brain_images.mat (Choose "Download link to disk" with right-click, or Control-mouseclick).
The programs below are slightly more complicated, and use functions from SPM99. The code gives commented examples of how to do things like reading SPM images into Matlab, finding their origins, displaying overlays, and extracting parts of SPM plots.