The official website for SPM can be found [[http://www.fil.ion.ucl.ac.uk/spm/|here]]. This page describes the processes used to analyse fMRI data using SPM in its GUI mode. '''DICOM Conversion ''' The output files from a scan are not in a format that can be processed by SPM, so they have to be converted to the DICOM format. This can be done using SPM, or a seperate package such as [[http://lcni.uoregon.edu/downloads/mriconvert|MRI convert]]. '''a. DICOM Converstion using SPM''' 1. Click "Batch" button. Navigate to the "SPM" dropdown menu, hover over the "Util" sub-heading and click on "DICOM Import" 1. Under "DICOM files", select your fMRI images. 1. Under "Output directory", select the folder you want the reconstructed images to be saved into. 1. Under the "Output image format" options, select the "Single file (nii) NIfTI" format 1. Click the play button at the top '''b. DICOM Converstion using MRI convert''' 1. To the right of the top box in MRI convert, click "Add folder". Navigate to your scan folders, and select all of the runs that you want to analyse. 1. From the dropdown menu between the two boxes, select NIfTI. 1. To the right of the bottom box click "Options" and ensure that only the options checked in the check boxes are items you want in your converted files' filenames. Also ensure that "Save each subject in a seperate directory", "Save each series in a seperate directory" and "Save as .nii file" are all checked. 1. Click "Directory" to select your output directory, and then click "Convert all." '''COREGISTERING ANATOMICAL TO TEMPLATE''' Coregistration refers to the spatial alignment of a series of images. The subject's T1 anatomical image needs to be coregistered to the T1 template at the start of pre-processing the scan data. Further coregistration is done later on in the process, using images from each run of the scan. 1. On the SPM menu, click "Coregister," and from the drop-down menu select "Est and Res" (estimate and reslice). 1. For the "Reference Image", navigate to the following path: Documents --> MATLAB --> spm8 --> templates, and select the T1.nii file. 1. For the "Source image", navigate to the folder containing the subject's T1 anatomical image (labelled mprage), and select the image file. 1. Leave all the other settings as they are, save and run the batch. 1. The newly coregistered image should be saved in the mprage folder. '''ORGANIZE DUMMIES''' Each run of each scan contains a few dummy runs in the beginning of the scan, which should be kept seperate from the rest of the data as it can have an influence on later processing. '''REALIGNMENT''' The next step is realignment (aka motion correction). This step registers all the images of a specified run from one subject to each other, and gives us information regarding how much the subject moved their head during the scan. This information is later used to ensure that functional images are accurately mapped onto structural ones. 1. On the SPM menu, click "Realign," and from the drop-down menu, select "Est and Res". 1. Under the "Data" heading, use the "Session" file selector to select all the converted DICOM files of the specified run for the subject. 1. For "Estimation options," "Quality" controls the quality of the images generated, on a range of 0 to 1. The "Interpolation" option also increases quality of images, with higher degree B-Spline options producing higher quality images. This should be changed to a minimum of "4th Degree B-Spline." The rest of the "Estimation Options" can be left as they are. 1. Under "Reslice Options," the "Resliced Images" option should be changed to "Mean Image only". The rest of the options can be left as they are. Save and run the batch. 1. Repeat for all images in each run of the scan. '''COREGISTRATION''' This step of coregistration is slightly different from the one completed previously; here, we coregister each image of a run to the coregistered image we generated earlier. 1. For the "Reference Image," navigate to the anatomical image folder, where the coregistered anatomical image should be saved (the file starting with r), and select it. 1. For the "Source Image," navigate to the folder of the run you want to coregister and select the mean image that was generated during the realignment phase (the file starting with the word "mean"). 1. For the "Other images," select the whole series of images '''EXCEPT '''the mean image. 1. The rest of the options can be left as they are. Save and run the batch. Repeat for each run. '''NORMALIZATION''' Add a section in for this around here. '''SMOOTHING''' Spatial smoothing is a tool used to cope with functional anatomical variability not compensated by normalisation and improves the signal to noise ratio. 1. On the SPM menu, click the "Smooth" button. 1. For the "Images to smooth" section, navigate to a folder containing one run of subject, and select all of the riles with the prefix "r" '''EXCEPT''' the mean images. These "r" prefix images were generated during the coregistration step. 1. "FWHM" refers to the size of voxel that you want to smooth. This can be changed according to your study (but should be the same in each run). We tend to use "6 6 6". 1. Leave the other options as they are and run the batch. '''STATS''' 1. Click the "Specify 1st-level" button on the SPM interface. 1. For the directory, navigate to the folder where you want your statistical analysis to be output. Put some run information in the folder name, so you can identify folders with specific analyses later. 1. For the "Units of design," select seconds. For the interscan interval, enter the duration of each of your scans in seconds (usually 1s for multiband and 2.5s for non-multiband but check the specific durations for your experiment). 1. Under "Data & Design," select "New:Subject/session," and for "Scans," select the newly smoothed files, which have the "s" prefix (make sure the mean files are '''not''' selected). Under "Conditions," select "New:Condition." 1. Each condition of a study is represented by a "New:Condition" option. For example, if you are analysing left hemisphere actiavtion vs right hemisphere activation in the visual cortex, You would name your condition left or right, set stimulus onsets and durations for each condition depending on your study. The "Time modulations" and "Parametric Modulations" options can be left unchanged, as can all of the following options. 1. Once the conditions are set up, save and run the batch. '''MODEL ESTIMATION''' 1. For this step, click "Estimate" on the SPM menu, and select the SPM.mat file you just generated from the folder you saved it in. 1. Leave the other options as they are and run the batch. '''CALCULATING RESULTS''' 1. Click the results button on the SPM interface. Navigate to the folder where your estimated SPM.mat file is saved and select it. 1. In the SPM contrast manager, click "Define new contrast..." For this example, where we continue the comparison between left and right hemisphere visual cortex activation, one of the contrasts will be left vs. right. Assuming that the left visual stimulus was onset before the right, the design matrix should be named "Left > Right", and filled as 1 -1. After entering these values in the box, press submit, and the design matrix in the dialogue box should highlight the targetted contrasts. Then click OK. 1. Now select your Left > Right contrast and press "Done. 1. On the results window, select "none" for "apply masking," hit enter when the title for comparison is shown, press none for the "p value adjustment," decide on the threshold p value (eg. 0.001), and the number of voxels you want in your extent threshold (eg. 5). 1. To see activation over a 3D image of the subject's brain, click overlay, and select your co-registered mprage anatomical image.