# Neuroimaging Data Processing/Processing/Tools/SPM
## Structure

Statistical Parametric Mapping refers to the construction and assessment of spatially extended statistical processes used to test hypotheses about functional imaging data. SPM is Matlab based and has been designed for the analysis of brain imaging data sequences. The current release is designed for the analysis of fMRI, PET, SPECT, EEG and MEG. The SPM software package can be extended by different toolboxes.

#### How to start SPM

After you installed SPM on your computer:
* Set SPM environment by typing SPM in capital letters in your terminal (if you have more than on version on your computer select the current one)
* Type matlab in small letters in your terminal to open matlab
* To start the SPM GUI type spm in small letters in matlab (by adding fmri, it will open the fmri mode already)
After you opened the SPM interface for fmri by pressing the fmri button it should look like this..
and you can start your data processing right away.

#### What is a Batch?

A Batch is a perfect tool to run your processing steps at once without MATLAB programming. For the basic understanding of SPM it is important to know, that each data processing step is called \module". There are several different modules e.g. for temporal (slice timing), spatial (realignment, normalisation, smoothing) or statistical (fMRI or factorial design specification, model estimation, contrast specification) processing of your MRI data.
A batch describes which modules should be run on what kind of data and how these modules depend on each other. Compared to running each processing step interactively, batches have a number of advantages:
* Documentation: Each batch can be saved as a MATLAB script. All parameters (including default settings) are included in this script. Thus, a saved batch contains a full description of the sequence of processing steps and the parameter settings used.
* Reproducibility: Batches can be saved, even if not all parameters have been set. For a multi- subject study, this allows to create template batches. These templates contain all settings which do not vary across subjects. For each subject, they can be loaded and only subject-specific parts need to be completed.
* Unattended execution: Instead of waiting for a processing step to complete before entering the results in the next one, all processing steps can be run in the specified order without any user interaction.
* Multiple batches: Multiple batches can be loaded and executed together.
To generate a Batch you can click on the Batch button on the SPM fmri GUI:
By clicking SPM in the upper taskbar you can select the processings steps you need for your data. The parameters which needs to be defined individually beside the default settings are indicated by a cross (<--X).
When you specified the order of your processings steps it is really important to set the dependencies between the single steps. Otherwise the data which was processed in the previous step can not be used in the next one.

## Documentation, tutorials, links

SPM Manual http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf
SPM Wikibook https://en.wikibooks.org/wiki/SPM
In this website, there are a series of lecture slides about how to use SPM for fMRI design and analysis (scroll down you could find the slides download) http://neurometrika.org/BasicSPM12