fMRI data preprocessing¶
Bringing it all together - the batch interface¶
The SPM batch interface allows you to create workflows for executing multiple processing steps sequentially. This means that you can set up one batch file that contains all preprocessing steps that you want to perform.
-
From the SPM menu panel, select
Batch
. You will see a pop-up window of an empty batch interface looking like this: -
Now we will start adding each of our preprocessing steps in the order we want them to be executed, starting with realignment.
- From to top panel of the batch window, select
SPM
Spatial
Realign
Realign: estimate & reslice)
. - Now complete the realignment tab of the batch with relevant parameters as in realignment:
- Select
Data
Session
. - In the pop-up window, use the left-hand panel to navigate to
sub-01/func/
. - Use the filter box to load the full time series - type
NaN
underneathFilter
button and press Enter. - In the right-hand panel, select
sub-01_task-auditory_bold.nii
and pressDone
. - Back in the batch window, navigate to
Resliced images
underReslice options
and selectMean image only
.
- Select
- Next, add the slice timing correction module to your batch file -
SPM
Temporal
Slice timing
. - Complete the slice timing module:
- Select
Data
Session
. - Click
Dependency
in the bottom right corner. - In the pop-up window, select the realigned time series that will be generated during realignment -
Realign: estimate & reslice: realigned images (sess 1)
and pressOK
. - Select
Number of slices
64
. - Select
TR
7
. - Select
TA
6.8906
or7-(7/64)
. - Select
Slice order
[64:-1:1]
. - Select
Reference slice
32
or64/2
.
- Select
- Next, add the coregistration module to your batch file -
SPM
Spatial
Coregister
Coregister: estimate
. - Complete the coregistration module:
- Select
Reference image
Dependency
. - In the pop-up window, select the mean image that will be generated during realignment -
Realign: estimate & reslice: mean image
and pressOK
. - Select
Source image
. - In the pop-up window, navigate to
sub-01/anat/
. - Select the anatomical image -
sub-01_T1w.nii
and pressDone
.
- Select
- Now add the segmentation module -
SPM
Spatial
Segment
. - Complete the segmentation module:
- Select
Data
Volumes
Dependency
. - In the pop-up window, select the coregistered anatomical image
Coregister: estimate: coregistered images
and pressOK
. - Select
Save bias corrected
Save bias corrected
(Save INU corrected
in newer SPM versions). - Select
Deformation fields
Forward
.
- Select
- Add the normalisation module -
SPM
Spatial
Normalise
Normalise: write
. - Complete the normalisation module:
- Select
Data
New: Subject
. - Select
Deformation field
Dependency
. - In the pop-up window, select the deformation field that will be generated during segmentation -
Segment: forward deformations
and pressOK
. - Select
Images to write
. - Click
Dependency
. - In the pop-up window, select the realigned and slice time corrected data -
Slice timing: slice timing corr. images (sess 1)
. - Optional: Under
Writing options
, changeVoxel sizes
form[2 2 2]
to[3 3 3]
. This will write images at a resolution closer to that at which they were acquired.
- Select
- Add the smoothing module -
SPM
Spatial
Smooth
. - Complete the smoothing module:
- Select
Images to smooth
Dependency
. - In the pop-up window, select the realigned, slice time corrected, and normalised time series -
Normalise: write: normalised images (subj 1)
and pressOK
. - Select
FWHM
and change[8 8 8]
to[6 6 6]
.
- Select
- Now that all your preprocessing steps have been specified, save this batch -
File
Save batch and script
and name it, e.g.preprocessing_batch.mat
. Make sure you selectSave batch and script
notSave batch
. This will be important for the next step.
You can now run this batch to execute all selected preprocessing steps for this subject by clicking or use it to create a matlab script to process data from multiple subjects.