SPM Lab Monday, August 15 2005 1-3PM BME 499/Biostat 642 ============================================================================ Name: ___________________________________ Group Number: ___________________________________ Dataset Used: ________ 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 -------------------------------------------------------------------------- The data may already on your PC. Look in 'c:\temp\fmricourse'. If it is not there, ask for help using SSH "Secure File Transfer Client" to get the data. It will be in the form of a .tgz file; use WinZip to expand the archive; please expand it into the 'c:\temp\fmricourse' folder. 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:\temp\fmricourse' directory. Start Matlab and add c:\temp\fmricourse\spm2_local c:\temp\fmricourse\spm2 to the path. Under the file menu use the 'Set path...' command. Click the 'Add Folder...' button to select the spm2 & spm2_local folders. Make spm2_local is *above* spm2 in the path. 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 gray matter 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 callosum: (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. (You must have the spm2_local directory in your path, above spm2, for this tip to work.) In one of the 3 views, right-click; a context menu will appear, showing you the location of the cursor and the intensity of the voxel under the cursor. Select the option Image -> Add color bar To adjust the brightness, set a new min and maximum intensity. Find the gray value in the colorbar that you want to be the new maximum value. Right-click on this gray-value and select 'max'. Likewise, find a value to be a new minimum, right-click and select 'min. Right-click anywhere in the colorbar and select 'reset' to reset the intensity window (the min & max). (Note that in the UM-local distribution the default interpolation has been set to Nearest Neighbor; you can change the interpolation with the image context menu.) 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 ("realign"ment). 1. See if there has been appreciable motion. Use 'Check Reg' to compare 3 images (use your block design data, run 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 noticeable difference. If fact, you'd probably only be able to notice catastrophic 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 ============================================================================ 0. Before starting any analysis in SPM, make sure you are in an empty directory. SPM write many, many files to the current Matlab directory, and no two analyses can share a directory. Make a new directory c:\temp\fmricourse\G?_Blk but replace '?' with number of the dataset you're using Change into this directory, using either the cd command in the command window, the 'Current directory...' button in the command window bar. 1. Specify the model. Click 'fMRI' in the top-left window and select the 'design' option. The questions for the remaining questions are "Interscan Interval {secs}" 2 (This is the TR) "scans per session:" 192 (This could be a vector, if you had multiple sessions.) "specify design in" Scans "Select basis set..." 'hrf' (This is simplist, least flexible option. Adding temporal derivative may often be helpful). "model interactions (Volterra)" 'no' (You'll always say 'no' here) "Number of conditions" 2 "name for condition/trial 1" Faces "vector of onsets - Faces" 0:24:191 (or, 0 24 48 72 96 120 144 168) "duration[s] (events = 0) 12 (A block of faces was 24 seconds, 12 scans long) "parametric modulation" 'none' "name for condition/trial 1" Houses "vector of onsets - Faces" 12:24:191 (or, 12 36 60 84 108 132 156 180) "duration[s] (events = 0) 12 "parametric modulation" 'none' Other regressors "user specified" 0 SPM has just saved a SPM.mat file with all of the specifications you just gave it. 2. Second, review the model. In the lower-left window, select 'Explore fMRI design' -> 'Session 1' -> 'Faces' In the graphics window, shows the following Upper left: Predictor for this event Upper right: Power spectrum of this event Lower left: Displays the basis set used (boring, if just 'hrf' was used) You can get to this and other information with the 'Review Design' button. Push the 'Review Design' button, and select the 'SPM.mat' you just created. Now you see the design matrix (top) and 'design orthogonally'. The design orthogonally matrix lets you assess how collinear different effects are. This is important, because if two columns are nearly collinear you cannot distinguish their effects uniquely. Left click the orthogonally matrix to see the correlation and the cosine angle between two particular columns. 3. Assign data to this design Click 'fMRI and select the 'data' option. A file selection dialog will appear: 'Select SPM.mat' "Select scans for session 1" Select the scans in your study (run_1, block design) "remove Global effects" 'Scale' (Global scaling accounts for random, image-wide fluctuations) "High Pass filter" Specify "cutoff period (sec)" 128 (All drifts with sinusoidal periodicity of 128 seconds or greater will be modeled.) "Correct for serial correlations?" 'AR(1)' After a pause, SPM has will update you SPM.mat file with the information just supplied. The delay is because SPM must compute the global average for each image. 4. Estimate! Start the analysis actually running by using the 'Estimate' button & selecting the 'SPM.mat' file. 5. 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 analyzed. Also in SPM.mat is results information (beta-hats) for a small subset of voxels (those with F statistics greater than 0.001). It also creates the following images beta*.img GLM parameter estimates ResMS.img Residual Mean Square image; a.k.a. sigma-squared-hat mask.img A binary image indicating what voxels were analyzed 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. Unfortunately 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.) Extras for experts SPM's computes an image of local smoothness, or Resels per Voxel (RPV.img). Unfortunately, RPV values aren't very interpretable. However, it's easy to transform RPV into FWHM smoothness using this relationship FWHM = RPV^(-1/3) Using ImCalc, create a 'FWHM.img' image, using RPV.img and the equation i1.^(-1/3) Don't forget the "." before "^"! We don't have to create a mean image because it (approximately) 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 Check Reg image context window to get a colorbar, and then adjust the minimum and maximum intensities as above. 6. 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 - Houses' In the 'contrast' box enter 1 -1 Click 'OK' Repeat, specifying the "Houses - Faces", -1 1 contrast. Now select the 'Faces - Houses' 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. 'p value adjustment to control' 'FDR' (Later, you can repeat this with 'none' and 'FWE' and compare. 'FDR' is usually a good starting place.) 'p value' or 'threshold' 0.05 '& extent threshold {voxels}' 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 | Posterior 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 simultaneously). _____________________________________________________________ What is displayed when you right-click in the design matrix? _____________________________________________________________ 7. 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 Responses' Select 'Which contrast' 'Effects of interest' (this selects everything) 'Plot against...' 'Scan or Time' Now move the cursor to a less intense voxel, perhaps an isolated one. Repeat the above steps. How are the plots different? Why is this? __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ ============================================================================ $Id: Lb_SPM1.txt,v 1.1 2005/08/19 01:55:02 nichols Exp $