Вы находитесь на странице: 1из 13

Preprocessing with SPM12

Illustrated batch configuration

See SPM12_manual.pdf
for general information and
more details for the particular
processing steps.

original document by Thomas P.K. Breckel for HWK Summerschool (Delmenhorst, 2012)
adapted by Anja Gieseler for SPM12 (2015)
Overview

Existing and virtual files: Dependencies 3


DICOM Import 4

Realignment 5
Coregistration 1 6
Coregistration 2 7
Segmentation 8
Normalisation functional images 9
Normalisation structural images 10
Smoothing 11
Save and run 12

Adjusting odd images manually 13

2
Annotation: Existing and virtual files  Dependencies

In many processing steps SPM needs When establishing a longer batch (with more
paths and filenames of data which than one processing step), later processing
can be manually selected. steps have to access data that has not yet
been created, which makes manual selection
of this data impossible.

In such a case, SPM allows to use dependencies


from other, previously defined processing steps
in the batch.

In the current manual, the relevant dependency


options for the particular processing steps are
also provided.

3
DICOM Import

 SPM  Util Import  DICOM Import

DICOM images
(from CD/DVD or folder)

Choose Directory Structure


(StudyDate-StudyTime recommended)

Output directory
(create one for each subject)

Output image format


(Single file (*.nii) recommended)

4
Preprocessing: Realignment

 SPM  Spatial  Realign  Realign: Estimate & Reslice


(result: rf*.nii)

- Data  New: Session


- fVP12-0003*.nii – files **
(imported functional images)

**410 images (delete first 5)

Other options:
With Realign: Estimate only the motion parameters will be estimated; no reslicing takes place.
With Realign: Write images get only resliced; motion parameters are needed (as e.g. estimated by Realign: Estimate). 5
Preprocessing: Coregistration 1

 SPM  Spatial  Coreg  Coreg: Estimate

meanf*.nii
(Reference image stays unchanged;
meanf* is output from realignment)

Dependency:
Realign: Estimate & Reslice: Mean Image

s*.nii
(Source image will be shifted:
Structural T1-image)

With Coreg: Estimate shifting parameters are stored in the headers of the images and will be applied in the next reslicing step,
which will be conducted during normalisation in the current example.
Reslicing is not necessary in this step. 6
Preprocessing: Coregistration 2 (optional but recommended)

Define a second coregistration step:  SPM  Spatial  Coreg  Coreg: Estimate

single_subj_T1.nii
(found in spm12 folder: …/spm12/canonical/)

s*.nii
(same image as for coregistration 1)

Other Images:
rf*.nii
(Important: functional images should
also be shifted in the same way as
the source image (structural image))

Dependency:
Realign: Estimate & Reslice: Resliced
Images
and
Realign: Estimate & Reslice: Mean Image

The second coregistration is for support of the segmentation/normalisation procedure. If measurement field or head placement
of the subject during data acquisition was odd, segmentation/normalisation could fail otherwise. Alternatively odd images can
be manually adjusted before, which would make the second coregistration unnecessary (see last slide of this manual).
7
Preprocessing: Segmentation

 SPM  Spatial  Segment

s*.nii
(coregistered structural T1-image;
previous coregistration cannot be
seen in file-name)

Save Bias Corrected:


Save Bias Corrected

Deformation Fields:
Select Forward

8
Preprocessing: Normalisation functional images

 SPM  Spatial  Normalise  Normalise: Write


(result: wrf*.nii)

Data  New: Subject

y_s*.nii
(output from segmentation)

Dependency:
Segment: Forward Deformations

- rf*.nii
(realigned functional images)

- meanf*.nii
(if needed; optional)

Dependency:
Realign: Estimate & Reslice: Resliced Images
and optional
Realign: Estimate & Reslice: Mean Image

Change Interpolation: Trilinear

Alternative: Normalise: Estimate and Normalise Estimate & Write can be used to avoid segmentation and to use standard template
normalisation instead (Images can be matched to a standard MNI-templates provided by SPM without tissue segregation). 9
For Normalise: Write normalisation parameters are needed, as received from prior segmentation step in the current example.
Preprocessing: Normalisation structural image

Define a second normalisation step:  SPM  Spatial  Normalise  Normalise: Write

Data  New: Subject y_s*.nii


(output from segmentation)

Dependency:
Segment: Forward Deformations

s*.nii / ms*.nii
(structural or mean corrected
structural image (output from segmentation);
or both images)

Dependency:
Segment: Bias Corrected
(for mean corrected T1-image)
or use no dependency and select
unchanged s*.nii T1-image

Change voxel size to [1 1 1]


(T1-image is already in 1*1*1 mm
resolution)

Interpolation:
4th Degree B-Spline
1
Preprocessing: Smoothing

 SPM  Spatial  Smooth


(result: swrf*.nii)

wrf*.nii
(realigned and normalised functional
images)

Dependency:
Normalise: Write: Normalised Images
(Attention: With two normalisation steps in a
batch (as in this example) there are two options
for Normalised Images. Choose the one in which
the functional images were normalised. In this
example it is the upper/first normalisation step.)

8 mm smoothing kernel is
recommended and used
in most studies; for activations
in smaller brain regions smaller
kernels (5 or 6 mm) can achieve
better results.

11
Save and run

Save batch
(can also be saved as a script file; useful
to generate a template for scripted
batch generation when working with many
subjects)

Run the batch


Note that multiple, previously saved
batches can be loaded (as e.g. one
for each subject) and runned in sequence/at once.

12
Attachment: Adjusting odd images manually - support for normalisation processing
Example T1 image

2)

Display Image
1) Adjust rotation (see figure)

2) Find the commissura Original image


anterior (MNI origin) - Origin far away
from MNI origin
3) Adjust translation with - Head is tilt
help of actual origin coordinates

4) Apply changes to image


After adjustment
for saving changed attributes these coordinates
should be close
Adjusted image
- Perform these steps for to commissura - Origin close
structural (s*.nii) and anterior/MNI to MNI origin
functional (rf*.nii) images origin - Head is straight
separately
3)
- For changing functional images
use the meanf*.nii or one rf*.nii, 1)
but apply changes to ALL functional
images

- Important: Coregister structural


and functional images after 4) 13
manual adjusting!!