Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

35
Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh

Transcript of Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Page 1: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Realignment

SPM5- Methods for Dummies 2007

P. Schwingenschuh

Page 2: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Spatial Registration

We use spatial registration to align images: Realigning and unwarping

• Motion correction (realignment) adjusts for an individuals head movements → creates a spatially stabilized image

• But residual errors…..→ unwarping

Co-registration aligns two images of different modalities from the same individual.

Spatial Normalization aligns images from different people.

Page 3: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Realignment

The aim is primarily to remove movement artefact in fMRI time-series.

Page 4: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Reasons for Motion CorrectionReasons for Motion Correction

Subjects will always move in the scanner

The sensitivity of the analysis depends on the residual noise in the image series, so movement that is unrelated to the subject’s task will add to this noise and hence realignment will increase the sensitivity

However, subject movement may also correlate with the task…

…in which case realignment may reduce sensitivity (and it may not be possible to discount artefacts that owe to motion)

Subjects will always move in the scanner

The sensitivity of the analysis depends on the residual noise in the image series, so movement that is unrelated to the subject’s task will add to this noise and hence realignment will increase the sensitivity

However, subject movement may also correlate with the task…

…in which case realignment may reduce sensitivity (and it may not be possible to discount artefacts that owe to motion)

Page 5: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Realign

SPM5 manual: This routine realigns a time-series of images

acquired from the same subject using a least squares approach and a 6 parameter (rigid body) spatial transformation.

The first image in the list specified by the user is used as a reference to which all subsequent scans are realigned.

The reference scan does not have to the the first chronologically and it may be wise to chose a ”representative scan” in this role.

Page 6: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Realignment-2 stepsRealignment-2 steps

Realignment (of same-modality images from same subject) involves two stages:

1. Registration - determining the 6 parameters that describe the rigid body transformation between each source image and a reference image (in fMRI first or representative scan)

2. Transformation (reslicing) - re-sampling each image according to the determined transformation parameters

Realignment (of same-modality images from same subject) involves two stages:

1. Registration - determining the 6 parameters that describe the rigid body transformation between each source image and a reference image (in fMRI first or representative scan)

2. Transformation (reslicing) - re-sampling each image according to the determined transformation parameters

Page 7: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Motion Correction

Motion Correction (‘Realignment’) is crucial: We want to compare same part of the brain

across time. If we do not MC, there will be a lot of

variability in our data. Mathematically,

We assume that all images show the same brain, so rigid body transform is sufficient.

All images have the same contrast.

Page 8: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Rigid body transformation = Euclidean transfromation

Translation

Rotation

They preserve the They preserve the shape of the objects shape of the objects that they act on.that they act on.

By measuring and correcting for translations and rotations, we can adjust for an object`s movement in an image.

Page 9: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

How many parameters?

Yaw

Pitch

Roll

ZX

Y

Translation

Rotation

•Each transform can be applied in 3 dimensions.•Therefore, if we correct for both rotation and translation, we will compute 6 parameters.

Page 10: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

3D Rigid-body Transformations A 3D rigid body transform is

defined by: 3 translations - in X, Y &

Z directions 3 rotations - about X, Y &

Z axes The order of the operations

matters

1000

0100

00cossin

00sincos

1000

0cos0sin

0010

0sin0cos

1000

0cossin0

0sincos0

0001

1000

Zt100

Y010

X001

rans

trans

trans

ΩΩ

ΩΩ

ΘΘ

ΘΘ

ΦΦ

ΦΦ

TranslationsPitch

about x axisRoll

about y axisYaw

about z axis

Page 11: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Gauss-newton Optimisation

Works best for least-squares

Minimum is estimated by fitting a quadratic at each iteration

Page 12: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Local Minima Search algorithm is iterative:

1. move the image a little bit.

2. Test cost function

3. Repeat until cost function does not get better.

Search algorithm can get stuck at local minima: cost function suggests that no matter how the transformation parameters are changed a minimum has been reached

Valu

e o

f C

ost

Fu

nct

ion

Local Minimu

mGlobal Minimu

mTranslation in X

Page 13: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Motion Correction Cost Function

=

ResliceTarget

When aligned, Difference squared = 0

2

ResliceTarget

=

2 When unaligned, Difference squared > 0

Page 14: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Motion correction cost function Motion correction uses variance to check if images

are a good match. Smaller variance = better match (‘least squares’) Iterative: moves image a bit at a time until match is

worse.

Image 1 Image 2 DifferenceVariance

(Diff²)

Page 15: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

RealignmentRealignment

Realignment (of same-modality images from same subject) involves two stages:

1. Registration - determining the 6 parameters that describe the rigid body transformation between each image and a reference image (”first or representative scan”)

2. Transformation (reslicing) - re-sampling each image according to the determined transformation parameters

Realignment (of same-modality images from same subject) involves two stages:

1. Registration - determining the 6 parameters that describe the rigid body transformation between each image and a reference image (”first or representative scan”)

2. Transformation (reslicing) - re-sampling each image according to the determined transformation parameters

Page 16: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Transformation

The intensity of each voxel in the transformed image must be determined from the intensities in the original image.

In order to realign images with subvoxel accuracy, the spatial transformations will involve fractions of a voxel.

It is therefore necessary to resample the image at positions between the centers of voxels.

This requires an interpolation scheme to estimate the intensity of a voxel, based on the intensity of its neighbours.

Page 17: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Interpolation The method by which the images are sampled when being

written in a different space. Nearest Neighbour is fastest, not recommended for image realignment.

Takes value of the closest neighboring voxel. Does not correct for intensities at subvoxel displacements.

Bilinear Interpolation is probably OK for PET, but not so suitable for fMRI because higher degree interpolation generally gives better results.

Although higher degree methods provide better interpolation, but they are slower because they use more neighbouring voxels.

Fourier Interpolation is another option, but note that it is only implemented for purely rigid body transformations. Voxel sizes must all be identical and isotropic.

The image–space method that gives the closest results to Fourier interpolation is a full sinc interpolation using every voxel in the image to calculate the new value at a single voxel. (very slow)

B-Splines, since SPM2: degrees 1-7

Page 18: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Application of registration parameters involves re-sampling the image to create new voxels by interpolation from existing voxels

Interpolation can be nearest neighbour (0-order), tri-linear (1st-order), (windowed) fourier/sinc, or in SPM2, nth-order “b-splines”

Application of registration parameters involves re-sampling the image to create new voxels by interpolation from existing voxels

Interpolation can be nearest neighbour (0-order), tri-linear (1st-order), (windowed) fourier/sinc, or in SPM2, nth-order “b-splines”

2. Transformation (reslicing)2. Transformation (reslicing)

d1 d2

d3

d4

v1

v4

v2

v3

Nearest Neighbour

Linear

Full sinc (no alias)

Windowed sinc

Page 19: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

B-Spline Interpolation

A continuous function is represented by a linear

combination of basis functions

Improves both computational speed and accuracy

Page 20: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Interpolation Simulation

Results after 10 time 5° rotation and return

No bilinear B-Spline

Errors

Page 21: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Interpolation errors, especially with tri-linear interpolation and small-window sinc

Ghosts (and other artefacts) in the image (which do not move as a rigid body)

Rapid movements within a scan (which cause non-rigid image deformation)

Spin excitation history effects (residual magnetisation effects of previous scans)

Interaction between movement and local field inhomogeniety, giving non-rigid distortion → "Unwarp"

Interpolation errors, especially with tri-linear interpolation and small-window sinc

Ghosts (and other artefacts) in the image (which do not move as a rigid body)

Rapid movements within a scan (which cause non-rigid image deformation)

Spin excitation history effects (residual magnetisation effects of previous scans)

Interaction between movement and local field inhomogeniety, giving non-rigid distortion → "Unwarp"

Residual Errors after RealignmentResidual Errors after Realignment

Page 22: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Sources & References & So On…

SPM for Dummies 2006 Rik Henson’s SPM minicourse John Ashburner’s lecture on spatial

preprocessing (SPM course USA 2005) Human Brain Function, 2nd Edition (Edited

by J Ashburner, K Friston, W Penny) – mostly chapter 2.

SPM5 manual

Page 23: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

UnwarpingUnwarping

Antoinette Nicolle

Page 24: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Pre-processing stepsPre-processing steps Voxel-based analysis assumes that the data Voxel-based analysis assumes that the data

from a particular voxel all derive from the same from a particular voxel all derive from the same part of the brainpart of the brain

So, for within-subject and between-subject So, for within-subject and between-subject comparisons we need:comparisons we need: Slice time correctionSlice time correction RealignmentRealignment to ‘undo’ the effects of subject motion to ‘undo’ the effects of subject motion Co-registrationCo-registration NormalisationNormalisation SmoothingSmoothing

Page 25: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

After RealignmentAfter Realignment

In extreme cases, up to 90% of the variance in In extreme cases, up to 90% of the variance in fMRI time-series can be accounted for by effects fMRI time-series can be accounted for by effects of movement of movement afterafter realignment. realignment. Results in loss of sensitivityResults in loss of sensitivity

This can be due to non-linear distortion from This can be due to non-linear distortion from magnetic field inhomogeneitiesmagnetic field inhomogeneities i.e. does not fit with the rigid-body assumption of i.e. does not fit with the rigid-body assumption of

realignment.realignment.

Page 26: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Field inhomogeneitiesField inhomogeneities Different tissues have different magnetic susceptibilitiesDifferent tissues have different magnetic susceptibilities These distortions are most noticeable near air-tissue These distortions are most noticeable near air-tissue

interfaces (e.g. OFC and anterior MTL)interfaces (e.g. OFC and anterior MTL) Field inhomogeneities have the effect that locations on Field inhomogeneities have the effect that locations on

the image are ‘deflected’ with respect to the real object.the image are ‘deflected’ with respect to the real object.

Page 27: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Susceptibility-by-motion interactions Variance caused by Variance caused by the susceptibility-by-motion the susceptibility-by-motion

interaction interaction When inhomogeneities are present in the field, the When inhomogeneities are present in the field, the

signal will not change linearly with subject positionsignal will not change linearly with subject position

EPI images will be a warped version EPI images will be a warped version of reality (like a fairground mirror) and of reality (like a fairground mirror) and this deformation will be this deformation will be non-rigid with non-rigid with motionmotion

Page 28: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Covarying for movement-related Covarying for movement-related errors after realignmenterrors after realignment

One solution is to include the estimated movement One solution is to include the estimated movement parameters as covariates in the design matrixparameters as covariates in the design matrix But problems when movements are correlated with But problems when movements are correlated with

the task, since this strategy will discard “good” and the task, since this strategy will discard “good” and “bad” variance alike“bad” variance alike

tmax=13.38

No correction

tmax=5.06

Correction by covariation

Page 29: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

So how does SPM do it..?So how does SPM do it..? A A deformation fielddeformation field indicates the directions and indicates the directions and

magnitudes of location deflections throughout the field (Bmagnitudes of location deflections throughout the field (B00) ) with respect to the real object.with respect to the real object.

We can create this with the We can create this with the “Fieldmap” toolbox.“Fieldmap” toolbox.

NextNext – find the derivatives of the deformations with respect – find the derivatives of the deformations with respect to subject movementto subject movement

igl.stanford.edu/~torsten/ct-dsa.html

Page 30: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

The susceptibility-by-motion interactionThe susceptibility-by-motion interaction In practice, rather than generating a statistical field map for every In practice, rather than generating a statistical field map for every

image in the EPI data set, we compute how image in the EPI data set, we compute how oneone map is warped over map is warped over subsequent scans.subsequent scans.

Computing how the images are warped over subsequent scans Computing how the images are warped over subsequent scans requires knowing how the deformation fields change with requires knowing how the deformation fields change with displacement of the subject, i.e. the derivatives of deformation with displacement of the subject, i.e. the derivatives of deformation with respect to subject motion.respect to subject motion.

UNWARPUNWARP

attempts to do this and then re-samples the voxels accordinglyattempts to do this and then re-samples the voxels accordingly

Page 31: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

How does it do it?How does it do it?

The field BThe field B00, which changes as a function of , which changes as a function of

displacement displacement ∆∆θθ, , ∆∆φφ, can be modelled by the first two , can be modelled by the first two terms of a Taylor expansionterms of a Taylor expansion

BB00((, ) = B) = B00 ( (, ) + [() + [(δδBB00/ / δδ) + ( (δδBB00/ / δδ ) ) ]]

The ‘static’ deformation field, which is the same throughout the time series.

Calculated using ‘Fieldmap’ in SPM

Changes in the deformation field with subject movement. Estimated via iteration. Procedure in UNWARP.

Page 32: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Applying the deformation field to the imageApplying the deformation field to the image

Once the deformation field has been Once the deformation field has been modelled over time, the time-variant field modelled over time, the time-variant field is applied to the image.is applied to the image.

This allows us to assume that voxels This allows us to assume that voxels over time are corresponding to the same over time are corresponding to the same parts of the brain, increasing the parts of the brain, increasing the sensitivity of our analysis.sensitivity of our analysis.

Page 33: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

In practice…In practice…

Subject movements are quite smallSubject movements are quite small With the latest scanners, distortions are With the latest scanners, distortions are

typically quite small, and distortion-by-typically quite small, and distortion-by-motion interactions even smallermotion interactions even smaller

Small distortions result from:Small distortions result from:a)a) Fast gradientsFast gradients

b)b) Low field (i.e. <3T)Low field (i.e. <3T)

c)c) Low resolution (smoothing)Low resolution (smoothing)

Page 34: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

Assumptions of UnwarpAssumptions of Unwarp That the susceptibility-by-motion interaction is That the susceptibility-by-motion interaction is

responsible for a sizeable part of the residual responsible for a sizeable part of the residual movement-related variance.movement-related variance.But:But: Subject movement between slice acquisition Subject movement between slice acquisition

(slice-to-vol effects)(slice-to-vol effects) Susceptibility-dropout-by-motion interactionSusceptibility-dropout-by-motion interaction Spin-history effectsSpin-history effects

Note also that the deformation field does not Note also that the deformation field does not give us the “true” version of the time-series, but give us the “true” version of the time-series, but rather a level of rather a level of averageaverage distortion. distortion.

Page 35: Realignment SPM5- Methods for Dummies 2007 P. Schwingenschuh.

ReferencesReferences

http://www.fil.ion.ucl.ac.uk/spm/toolbox/unwarp/http://www.fil.ion.ucl.ac.uk/spm/toolbox/unwarp/ Slides by Mary Summers (MfD 2006)Slides by Mary Summers (MfD 2006) John Ashburner’s slides John Ashburner’s slides

http://www.fil.ion.ucl.ac.uk/spm/course/#slideshttp://www.fil.ion.ucl.ac.uk/spm/course/#slides Andersson JLR, Hutton C, Ashburner J, Turner Andersson JLR, Hutton C, Ashburner J, Turner

R, Friston K (2001) Modelling geometric R, Friston K (2001) Modelling geometric deformations in EPI time series. Neuroimage deformations in EPI time series. Neuroimage 13: 903-91913: 903-919

http://www.cis.rit.edu/htbooks/mri/index.html (J http://www.cis.rit.edu/htbooks/mri/index.html (J Hornak’s tutorial)Hornak’s tutorial)