Spatial preprocessing¶
This page describes the transforms applied to the image data of a single participant prior to statistical analysis.
Display¶
Display one of the functional image volumes using the Display button on the “Menu” window. Note
the orbitofrontal and inferior temporal drop-out and ghosting. This can be
seen more clearly by selecting Brighten from the Effects menu in the
Colours menu from the SPM Figure tab at the top of the “Graphics” window.
Realignment¶
Under the spatial pre-processing section of the SPM base window select
Realign (Est & Res) from the Realign pull-down on the “Menu” window. This will call up
a realignment job specification in the batch editor window. Then
-
Highlight data, select
New Session, then highlight the newly createdSessionoption. There are two fMRI runs, so you need to do this twice. -
For the first session, select
Specify Filesand use the SPM file selector to choose all of the functional image volumes for the first run. To select all the volumes in a file, change the field that says1toNaN. -
For the second session, select
Specify Filesand use the SPM file selector to choose all of the functional image volumes for the second run. -
The other options in the user interface can be left as they are.
-
Save the job file as e.g.
realign_job.m. When saved as a.mfile, the jobs are human readable text that can serve as a starting point for creating scripts. If you read the contents ofrealign_job.min a text editor, the structure of the contents should be comparable to the structure shown in the batch editor.matlabbatch{1}.spm.spatial.realign.estwrite.data = { {'func\sub-XX_ses-mri_task-facerecognition_run-01_bold.nii'} {'func\sub-XX_ses-mri_task-facerecognition_run-02_bold.nii'} }'; matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.quality = 0.95; matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.sep = 1.5; matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.fwhm = 1; matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.rtm = 1; matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.interp = 2; matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.wrap = [0 0 0]; matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.weight = ''; matlabbatch{1}.spm.spatial.realign.estwrite.roptions.which = [2 1]; matlabbatch{1}.spm.spatial.realign.estwrite.roptions.interp = 4; matlabbatch{1}.spm.spatial.realign.estwrite.roptions.wrap = [0 0 0]; matlabbatch{1}.spm.spatial.realign.estwrite.roptions.mask = 1; matlabbatch{1}.spm.spatial.realign.estwrite.roptions.prefix = 'r'; -
Press the
Runbutton in the batch editor window (green triangle).
This will run the realign job which will write realigned images into the
folder where the functional images are. These new images will be
prefixed with the letter “r”. SPM will then plot the estimated time
series of translations and rotations. These data, the realignment
parameters for each run, are also saved to a file called func/rp_sub-XX_ses-mri_task-facerecognition_run-XX_bold.txt, so
that these variables can be used as regressors when fitting GLMs. This
allows movements effects to be discounted when looking for brain
activations.
In addition to resliced versions of the original images (func/rsub-XX_ses-mri_task-facerecognition_run-01_bold.nii and func/rsub-XX_ses-mri_task-facerecognition_run-02_bold.nii), SPM will also create a mean image (func/meansub-XX_ses-mri_task-facerecognition_run-01_bold.nii)
which will be used in the next step of spatial processing - coregistration.
Coregistration¶
Select Coregister (Estimate) from the
Coregister pull-down on the “Menu” window. This will call up the specification of a
coregistration job in the batch editor window.
-
Highlight
Fixed Imageand then select the mean functional imagefunc/meansub-XX_ses-mri_task-facerecognition_run-01_bold.nii. -
Highlight
Moved Imageand then select the anatomical imageanat/sub-XX-T1w.nii. -
Press the
Savebutton and save the job ascoreg_job.m -
Then press the
Runbutton.
SPM will then coregister the anatomical image so that it matches the functional data (as far as possible using a rigid-body transform). SPM will have changed the header of the moved (anatomical) image to reflect its new position and orientation.
Segmentation¶
Press the Segment button on the “Menu” window. This will call
up the specification of a segmentation job in the batch editor window.
Highlight the Volumes field in Data > Channels and then select the
subject’s coregistered anatomical image anat/sub-XX-T1w.nii. Change
Save INU corrected so that it contains Save INU corrected instead
of Save nothing. At the bottom of the list, select Forward in
Deformation Fields. Save the job file as segment_job.m and then press
the Run button. SPM will segment the structural image using the
default tissue probability maps as priors. SPM will create, by default,
gray and white matter images and an intensity non-uniformity corrected version of the image.
These can be viewed using the Check Reg facility.
SPM will also write a spatial normalisation deformation field file
anat/y_sub-XX-T1w.nii in the original anat folder. This
will be used in the next section to spatially normalise the functional data.
Normalise¶
Select Normalise (Write) from the
Normalise pull-down on the “Menu” window. This will call
up the specification of a normalise job in the batch editor window.
-
Highlight
Data, selectNew Subject. -
Open
Subject, highlightDeformation fieldand select theanat/y_sub-XX-T1w.niifile that you created in the previous section. -
Highlight
Images to writeand select all of the resliced functional images (func/rsub-XX_ses-mri_task-facerecognition_run-01_bold.niiandfunc/rsub-XX_ses-mri_task-facerecognition_run-02_bold.nii). To select all the volumes in a file, change the field that says1toNaN. -
Press
Save, save the job asnorm_func_job.mand then press theRunbutton.
SPM will then write spatially normalised versions of the images to the func folder.
These files have the prefix w (func/wrsub-XX_ses-mri_task-facerecognition_run-01_bold.niiandfunc/wrsub-XX_ses-mri_task-facerecognition_run-02_bold.nii`).
If you wish to superimpose a subject’s functional activations on their own anatomy you will also need to apply the spatial normalisation parameters to their (intensity non-uniformity corrected) anatomical image. To do this
-
Select
Normalise (Write), highlightData, selectNew Subject. -
Highlight
Deformation field, select theanat/y_sub-XX-T1w.niifile that you created previously and pressDone. -
Highlight
Images to Write, select the intensity non-uniformity corrected anatomical MRIanat/msub-XX-T1w.niiand pressDone. -
Open
Writing Options, select voxel sizes and change the default [2 2 2] to [1 1 1] which better matches the original resolution of the images. -
Save the job as
norm_struct_job.mand press theRunbutton.
The spatially normalised image will be saved as anat/wmsub-XX-T1w.nii.
Smoothing¶
Press the Smooth button on the “Menu” window. This will call up the specification of a smooth job in the batch editor window.
-
Select
Images to Smoothand then select the spatially normalised volumes created in the last section (func/wrsub-XX_ses-mri_task-facerecognition_run-01_bold.niiandfunc/wrsub-XX_ses-mri_task-facerecognition_run-02_bold.nii). To select all the volumes in a file, change the field that says1toNaN. -
Save the job as
smooth_job.mand press theRunbutton.
This will smooth the data by (the default) 8 mm in each direction, which will be saved as image files prefixed by s (func/swrsub-XX_ses-mri_task-facerecognition_run-01_bold.nii and func/swrsub-XX_ses-mri_task-facerecognition_run-02_bold.nii).