SPM Lab Monday, August 19 2002 1-3PM BME 499.098/Biostat 642 ============================================================================ Name: ___________________________________ Group Number: ___________________________________ Dataset Used: fmriclass ________ Goals of this Lab ============================================================================ After this lab you will... 1. Be able to examine at data using SPM's single- and multi-volume display facilities. 2. Be able to characterize the susceptibility artifacts and signal voids in functional data, as compared to similar structural data. 3. Be able to model a block-design fMRI dataset. Look at the data! ============================================================================ Download the data -------------------------------------------------------------------------- You may have to s-ftp data from the fMRI lab, or it may already be on your computer. Look for instructions on the board. Put the data in directory under 'c:\fmri\'. Start Matlab & SPM -------------------------------------------------------------------------- The first thing you should after starting Matlab is to change the working directory to a reasonable place. In the lab, it defaults to a directory where you do not have write permissions. Use the '...' button at the top of the Matlab window, or use the 'cd' command to change to the 'c:\fmri' directory. Start Matlab and add SPM99 to the path. Under the file menu use the 'Set path...' command. Click the 'Add Folder...' button to select the spm99 folder. Click 'Close'. Look at some functional data -------------------------------------------------------------------------- 0. Using the 'Display' button view a randomly selected image from among your functionals. You should always do this to check orientation (and any possible catastrophic problems.) 1. What is the voxel size? ________ ________ ________ 2. What is the image dimension? ________ ________ ________ 3. What are typical graymatter values? From ________ to _________ 4. Bilinear interpolation is default. Select Nearest Neighbor interpolation. Explore the image Select Sinc interpolation. Explore the image Which one do you prefer? _______________ Why? _________________________________________________________________ Compare the functional data to the anatomical data -------------------------------------------------------------------------- 0. The t1overlay image is in the same space as the functionals (it has the same number of slices with the same spatial location, but it has smaller in plane voxels, i.e. greater in-plane resolution). Use 'Check Reg' to "check" the "registration" between the t1overlay structural and the functionals. Select the t1overlay image for the first image, and select the first functional image as the second image. 1. Look for possible mis-registration (due to subject movement between t1overlay acquisition and first functional scan). Explore the pair of images, making sure to compare the following anatomical regions i. Frontal pole ii. Occipital (posterior) pole iii. Left & Right sides (e.g. superior temporal gyrus) iv. Corpus collosum: (1) Most anterior, (2) most superior and (3) most posterior extent. Extra for experts! You can modify the contrast of the images by playing with the "window", the min-max range of intensity values displayed. To set the window of the first image within 'Check Reg', use the following command spm_orthviews('window',1,[MIN MAX]) where MIN and MAX are the desired minimum and maximum displayed values. This will take some trial and error get good values, but can help a lot with T1 images. To adjust the window on the 2nd image, replace the "1" above with a "2". Do the functional and structural line up well? If not, how so? ______________________________________________________________________ ______________________________________________________________________ 2. Explore the regions of signal loss in the temporal poles and the orbitofrontal cortex. For example, on the T1, go to the medial orbitofrontal cortex and look at the sagittal image; click on the coronal or axial until you have nice view on the sagittal image---that is, not right on the mid-sagittal plane (that usually looks yukky), but just off mid-sag. Now click around on the sagittal view, keeping an eye on the axial view, and carefully compare the T1 and the functional. Similarly, find the signal void in the temporal pole (due to the ear canal). Observe cortex visible in T1 image not visible in T2*. When we get thresholded activation maps, we typically overlay them on the structural images since they have more anatomical detail. But why should we *also* check localization of activation on the functionals? ______________________________________________________________________ ______________________________________________________________________ Preprocessing Steps -------------------------------------------------------------------------- 0. Two key preprocessing steps have already been performed for you, slice time correction and image registration ("coregistriation"). 1. See if there has been appreciable motion. Use 'Check Reg' to compare 3 images (use your block design data, acq 1) a_img/..._0001.img a_img/..._0213.img ra_img/.._0213.img If there is any appreciable motion, then the first and last aimg should be out of registration, and the last raimg should be successfully corrected. (If you don't have a_img's, then just compare ra_img 001 and ra_img 0213; if the motion correction is successful then there should be no noticable difference. If fact, you'd probably only be able to notice catostrophic failures, but it's still important to check.) Can you detect any misregistration between the first and last unregistered image (aimg/..._0001.img & aimg/..._0213.img)? __________________________________________________________________ If so, is it corrected in raimg/..._0213? __________________________________________________________________ 2. The only preprocessing step left for you to do (for an intrasubject analysis) is spatial smoothing. Click the 'Smooth' button and select all of your ra* images. Apply a 8mm FWHM isotropic smoothing to the data. (Isotropic means "the same in all directions"). Extra for experts Specifying a filter size consisting of a single value implies a isotropic smoothing. Define a model for your Block Design Data ============================================================================ Block design data is regular?! 1. First, specify the model. Click 'fMRI Models' and select the 'Specify' option. The questions for the remaining questions are "Interscan Interval (TR) in sec:" 1.5 "scans per session:" 213 "Number of conditions" 2 "Enter names;" 'Faces' for first 'Places' for second "Stochastic design: No (Never answer yes here) "SOA:" Fixed (For unevenly-spaced events, this would be 'variable') For the next questions, you need to know how the experiment was organized. The stimuli were blocked, alternating between Places and Faces. Each block was 20 seconds long, and places were first. Since SPM only works in units of scans, you need to divide all seconds measures by 1.5 (the TR). "SOA for Faces" 26.67 "Time to 1st trial - Faces" 13.33 "SOA for Places" 26.67 "Time to 1st trial - Places" 0 The SOA is the stimulus onset asychrony, the time between initiation of a particular stimulus type. That is 20+20 seconds, or 26.67 scans. Since Places was first there was no delay until it's first presentation (0). On the other hand, the first presentation of Faces didn't occur until the Places block was done, at 20 seconds (13.33 scans). "Parametric modulation" None (This is for considering interactions between conditions and an epoch-by-epoch, or event-by-event covariate) "Trial type" Epochs "Type of response" fixed response (box-car) (It is rare to use the other response models). "Convolve w/ HRF" Yes (With out this option the box cars would remain 'sharp'; with this option they are blurred and delayed as per the HRF.) "Add temporal derivatives" No (Temporal derivatives allow for some variability in the delay of the HRF.) "epoch length (Places)" 13.33 "epoch length (Faces)" 13.33 Each block or epoch was 20 seconds long. "Interactions among trials" No (This employ's volterra kernals to attempt to model nonlinearity.) "User specified regressors" 0 "Estimate now" No 2. Take a moment to explore the model Click 'fMRI Models' and select the 'Review a specified model' option. It will ask you to select a SPM_fMRIDesMtx.mat file; this file contains the design parameters you just specified. On the display window you will see several different plots. On the top row are different displays of the design matrix and 'design orthogonality'. On the top left is the design matrix; left-click to see the values of the design matrix; right-click to see the name of the column you are clicking. On the top right is design orthogonality matrix; this lets you assess how collinear different effects are. This is important, because if two columns are nearly colinear you cannot distinguish their effects uniquely. Left click the orthogonality matrix to see the correlation and the cosine angle between two particular columns. 3. Next go ahead and estimate the model Click 'fMRI Models' and select the 'Estimate' option. The questions for the remaining questions are "Select scans" Select the scans in your study "remove Global effects" Scale "High Pass filter" Specify "session cutoff period (sec)" 81 "low pass" Gaussian "Gaussian FWHM" 4 "Model Intrinsic Autocorr" None "Set up F-contrasts" Yes Extra for experts! At this point, silently, SPM has written out a SPMcfg.mat file. This SPMcfg.mat file has all of the information required to complete the analysis. It basically consists of information in the SPM_fMRIDesMtx.mat plus the information you just supplied. The reason for the separate SPM_fMRIDesMtx.mat file is that it contains information that could be generic to several different datasets (you often run the exact same paradigm on many different subjects). Thus you could create a SPM_fMRIDesMtx.mat once and copy to severalb different analysis directories. "Estimate" "Now" 3. Before probing the results with SPM, let's look at the different files SPM has created. SPM has created a bunch of .mat files and images. It has created the following data files SPM.mat Results .mat file, contains basic summary information, such as the number of voxels anlayzed. Y.mad Yidx.mat These two files have results information (beta-hats) for a small subset of voxels (those with F statististics greater than 0.001). It also creates the following images beta*.img GLM parmaeter estimates ResMS.img Residual Mean Square image; aka sigma-squared-hat mask.img A binary image indicating what voxels were anlayzed RPV.img Resels-Per-Voxel image; image of roughness Before looking at any results it's useful to look at the mean and standard deviation. Unforunately SPM doesn't write out standard deviation, but variance. Use ImCalc to create a residual standard deviation image; start by clicking 'ImCalc' 'Select images to work on' Select 'ResMS.img' only 'Output filename' Enter 'ResStd' (It will add the '.img'.) 'Evaluated function' Enter 'sqrt(i1)' ('i1' is the variable representing the ResMS image; if we had entered 3 images to work on, then 'i2' and 'i3' would represent the 2nd and 3rd images.) We don't have to create a mean image because it is one of the parameters in the GLM and was written out as a beta image. What beta (1,2,3,...) is the (grand) mean? __________ (Hint: It's column of the design matrix that looks all white). Now, view both the mean and the standard deviation. Click 'CheckReg' and select the appropriate beta image and the ResStd image you created. What regions have the largest standard deviation? ____________________________________________________ ____________________________________________________ Do regions with signal voids (e.g. in the inferior frontal cortex) have large or small variability (relatively)? ____________________________________________________ If the images are too dark or bright, you can use the 'Effects' menu in the graphics window to bright or darken the whole window. Or... Extra for experts! Use the Matlab commands spm_orthviews('window',1,[MIN MAX]) spm_orthviews('window',2,[MIN MAX]) to adjust the minimum and maximum intensities for the top and bottom image respectively. Usually the ResStd image needs custom 'windowing'; try [MIN MAX] = [0 2]. 4. OK. Now that we have a explored the data, and have a sense where the most variable regions are located. (If there were any horrific spatial artifacts they should have been detected in the ResStd image.) To make inferences click 'Results' and select the 'SPM.mat' file. The contrast manager will appear. The contrast manager allows you to specify contrasts of the linear model; t contrasts (consisting of a single contrast vector) or F contrasts (consisting of one or more contrast vectors) can be created. Even though you can only view a single contrast at a time, it is a good idea to create all of your contrasts at once. So we'll define both possible contrasts now: Click on 'Define new contrast...' In the 'name' box enter the name 'Faces - Places' In the 'contrast' box enter 1 -1 Click 'OK' Repeat, specifing the "Faces - Places", -1 1 contrast. Now select the 'Faces - Places' contrast and click 'Done'. 'Mask with other contrasts' Click 'No' (This can be useful with complicated experiments with many different conditions.) 'title for comparison' Press to accept the default. 'Corrected height threshold' 'No' 'threshold {T or p value}' 0.001 '& extent threshold' 0 (Using a number greater than zero eliminates blobs smaller than that size.) After you see the glass brain view, click on the 'volume' button in the "p-value" section of the interactive window. Now try the following: o Drag the cursor around the glass brain view. Try to guess where the brightest voxel is in the brain; where is (roughly) in the brain: (Circle one on each line) Superior | Inferior Left | Medial | Right Anterior | Posteror Right click; use the 'goto global maximum' option. Did you guess correctly? _______________ o In the tabular output, click on one of the x,y,z locations. What happens to its color? To the cursor? _____________________________________________________________ _____________________________________________________________ o Click on the design matrix. What is displayed when you left-click in the design matrix? _____________________________________________________________ What is displayed when you middle-click in the design matrix? (if you don't have a middle mouse button, click left and right simeltaneously). _____________________________________________________________ What is displayed when you right-click in the design matrix? _____________________________________________________________ 5. It is useful to look at the data at individual voxels. First, move the cursor to the global maximum. Then select from several 'Plot...' functions. There is only one that is useful for Block design data... 'Fitted and Adjusted Values' Select 'Which contrast' 'Effects of interest' (this selects everything) 'Plot against...' 'Scan or Time' Now move the cursor to a less intense voxel, perhapse an isolated one. Repeat the above steps. How are the plots different? Why is this? __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ ============================================================================ @(#)Lb_SPM1.txt 1.4 02/08/19