Presentation on theme: "SPM5 Tutorial, Part 1 fMRI preprocessing Tiffany Elliott May 9 2007."— Presentation transcript:
SPM5 Tutorial, Part 1 fMRI preprocessing Tiffany Elliott May 9 2007
Start matlab and initiate SPM by running spm fmri from the command prompt
The first thing we will do is look at our data by clicking on the Display button.
Navigate to the first session in your sample data set and select the f.nii file. Then click done
Click around in the brain views. The crosshairs will move to where you click
Save this picture as a JPEG under the sample_data directory Then display and save the other two sessions as well
Now we will begin to preprocess the data and prepare it for statistics Click on the Slice Timing button
On the right you will see this in the SPM graphics window. Double click on the slice timing node to expand it
In the panel to the left is a list of the jobs you have currently selected. It is organized in a tree structure. Double-clicking a node will allow you to expand and contract its items. + means the node is contracted -means the node is expanded Items with an X to the right have not been set. To the right is an example of our expanded slice timing node.
In top right panel are the options available for a highlighted item. Once you have single clicked on the item of your choice the options will appear. Single clicking on New “Session” will create a new item to associate data with. We will do this 3 times for 3 runs of the visual oddball task giving us 3 session to select data for.
Single click on the first session. Then in the top right panel single click on Specify Files
The first thing you want to do is make sure you set the range of frames to 1:195. This is because we are working with 4D image files and we want all volumes in the file to be included. In this particular paradigm there are 195 volumes. Hit enter after you type in this number. Then navigate to your sample data and click on the Rec button to recursively select your nifti volumes Click Done and follow the same steps to select your data for sessions 2 and 3
Click on the Number of Slices node and then Specify Text Enter 33 into the prompt box and hit enter You will see your input in the middle right box
Enter these values for the next four nodes… TR 2, repetition time TA 1.93939, acquisition time is usually TR-(TR/nslices) Slice order 1:33, a vector 1,2,3,…33 Reference Slice 16, a slice in the middle of the brain When you are done click the save button to save your settings…
You can save as mat file, m file (script), or xml file. Pick your favorite format, name the file, and save under the sample_data folder After you have saved your settings click Run to perform the slice time correction
Next we will realign our data Realignment corrects for movement over time using affine registration Click the Realign dropdown and select Realign
Click on New “Realign: Estimate & Reslice” to create a new realignment node. Double click on the new node to expand it
Enter these values for the estimation options… Quality 0.5, 0
"name": "Enter these values for the estimation options… Quality 0.5, 0
Enter these values for the reslice options… Resliced Images Mean Image Only Interpolation 4 th Degree B-Spline, default Wrapping No Wrap, default Masking Mask Images, default
When you are done entering your items click on the Realign: Estimate & Reslice node Then click Replicate Item two times making 2 more nodes like the first one This way we don’t have to re-enter the parameters for the other two sessions
Click on Data and then New “Session” to select your files for each node for realignment. Session 1 goes with the first node. Session 2 goes with the second. Session 3 goes with the third. This is done so we can realign each session separately If you want to realign all the sessions together, you would instead make 3 sessions under 1 Data node
We are now working with the slice time correction files from the previous step. So, set your file filter to ^af.* ^ is a character specifying that the letter that follows must be the first letter in the file name.* means any number of other characters may follow
Once all your information is entered save the settings in your file format of choice under the sample_data folder. Then click Run to perform the Realignment
As each session finishes SPM will display the results in the graphics window. You will see a plot showing how each volume moved with respect to the previous volume. Rotational parameters roll, pitch and yaw are in radians
Rotational movement parameters resemble that of airplane terminology
Now we will normalize our data to the standard template Click on the Normalize button
Click on “Normalise: Estimate & Write” Expand all your nodes
For the Data node add 3 New “Subject” Items Each of these will be for sessions 1,2 and 3 respectively
For each subject node expand it and enter these parameters… Source Image meanaf.nii, average of all the volumes produced during realignment Source Weighting , default Images to Write all 195 volumes of the realigned af.nii file and the meanaf.nii file
Under the Estimation node, click template image, then specify files. We will use the EPI template included in the spm5 package.
Set the following estimation options to these values… Template Weighting Image , default Source Image Smoothing 8, default Template Image Smoothing 0, default Affine Image Regularisation ICBM space template, default Nonlinear Frequency Cutoff 45 Nonlinear Iterations 16, default Nonlinear Regularisation 1, default
Set the following writing options to these values… Preserve Preserve Concentrations, default Bounding Box leave as default Voxel Sizes [2 2 2], default Interpolation Trilinear, default Wrapping No wrap, default Save your settings in your file type of choice under your sample_data folder. Then Run the analysis.
Now we’re going to check our results Click on the Check Reg button When you are prompted select the wmeanaf.nii image from session 1 and the EPI template that we used from the spm5 package
Click around and see if the normalization did a good job Are the results what you would expect? Do the edges of different brain regions match up in both images? Save this picture as a JPEG under your sample_data directory
Now we will spatially smooth our data Click on the Smooth button
Select all your waf.nii images from the 3 sessions Set FWHM to [8 8 8] for an 8mm Gaussian smoothing kernel
We will select our normalized images for smoothing Set your filter to ^wa.* (normalization puts a w on the front of the image name) Smoothing will put an s on the front of the image names
Click Run to perform the smoothing… Now your images will be ready for modeling! Friday morning there will be a tutorial on modeling this data.