preproc_zurich2010

advertisement
Spatial Preprocessing
Ged Ridgway
University College London
Thanks to:
John Ashburner, Klaas Enno Stephan, and the FIL Methods Group.
Meike Grol, Chloe Hutton, Jesper Andersson, Floris de Lange,
Miranda van Turennout, Lennart Verhagen, …
Terminology of fMRI
Structural (T1) images:
- high resolution
- to distinguish different types of tissue
Functional (T2*) images:
- lower spatial resolution
- to relate changes in BOLD signal
to an experimental manipulation
 Time series:
A large number of images that
are acquired in temporal
order at a specific rate
t
Terminology of fMRI
subjects
sessions
runs
single run
volume
slices
TR = repetition time
time required to scan
one volume
voxel
Terminology of fMRI
Scan Volume:
Field of View
(FOV),
e.g. 192 mm
Axial slices
Slice thickness
e.g., 3 mm
Matrix Size
e.g., 64 x 64
In-plane resolution
192 mm / 64
= 3 mm
3 mm
3 mm
3 mm
Voxel Size
(volumetric pixel)
fMRI Time-series Movie
Overview of SPM Analysis
fMRI time-series
Motion
Correction
Statistical Parametric Map
Design matrix
Smoothing
Spatial
Normalisation
Anatomical
Reference
General Linear Model
Parameter Estimates
Preprocessing in SPM
• Realignment
– With non-linear unwarping for EPI fMRI
•
•
•
•
•
Slice-time correction
Coregistration
Normalisation
Segmentation
Smoothing
The many guises of affine registration
• Manual reorientation
• Rigid intra-modal realignment
– Motion correction of fMRI time-series
– Within-subject longitudinal registration of serial sMRI
• Rigid inter-modal coregistration
– Aligning structural and (mean) functional images
– Multimodal structural registration, e.g. T1-T2
• Affine inter-subject registration
– First stage of non-linear spatial normalisation
– Approximate alignment of tissue probability maps
Other types of registration in SPM
• Non-linear spatial normalisation
– Registering different subjects to a standard template
• Unified segmentation and normalisation
– Warping standard-space tissue probability maps to a
particular subject (can normalise using the inverse)
• High-dimensional warping
– Modelling small longitudinal deformations (e.g. AD)
• DARTEL
– Smooth large-deformation warps using flows
– Normalisation to group’s average shape template
Manual
reorientation
Image “headers” contain
information that lets us map
from voxel indices to
“world” coordinates in mm
Modifying this mapping
lets us reorient (and
realign or coregister)
the image(s)
Manual
reorientation
Manual
reorientation
Interpolation
Nearest
(Bi)linear
Neighbour
(Bi)linear
Sinc
Interpolation
• Applying the transformation parameters, and resampling the data onto the same grid of voxels as
the target image (usually)
– AKA reslicing, regridding, transformation, and writing (as in
normalise - write)
• Nearest neighbour gives the new voxel the value of
the closest corresponding voxel in the source
• Linear interpolation uses information from all
immediate neighbours (2 in 1D, 4 in 2D, 8 in 3D)
• NN and linear interp. correspond to zeroth and first
order B-spline interpolation, higher orders use more
information in the hope of improving results
– (Sinc interpolation is an alternative to B-spline)
Manual reorientation – Reslicing
Reoriented
Resliced
(1x1x3 mm
voxel size)
(to 2 mm
cubic)
Quantifying image alignment
• Registration intuitively relies on the concept of
aligning images to increase their similarity
– This needs to be mathematically formalised
– We need practical way(s) of measuring similarity
• Using interpolation we can find the intensity at
equivalent voxels
– (equivalent according to the current transformation
parameter estimates)
Voxel similarity measures
 I ref (i, j , k ) 
 I (i  1, j , k )
 ref




 I ref (i, j  1, k )





Pairs of voxel intensities
• Mean-squared difference
• Correlation coefficient
• Joint histogram measures
 I src (i, j , k ) 
 I (i  1, j , k )
 src




 I src (i, j  1, k )





Intra-modal similarity measures
• Mean squared error (minimise)
– AKA sum-squared error, RMS error, etc.
(monotonically related). AKA “least squares”
– Assumes simple relationship between intensities
– Optimal (only) if differences are i.i.d. Gaussian
– Okay for fMRI realignment or sMRI-sMRI coreg
• Correlation-coefficient (maximise)
– Slightly more general, e.g. T1-T1 inter-scanner
– Invariant under affine transformation of intensities
– AKA Normalised Cross-Correlation, Zero-NCC
Automatic image registration
• Quantifying the quality of the alignment with a
measure of image similarity allows computational
estimation of transformation parameters
• This is the basis of both realignment and
coregistration in SPM
– Allowing more complex geometric transformations or
warps leads to more flexible spatial normalisation
• Let’s look at an example of realignment next
– We will return to coregistration later...
Option of second pass, reregistering to mean from
first pass, improves results
if first image is not perfectly
representative of all others
How much motion is significant?
Edge:
DS(x) ~ 70-90%
0.05 pixel shift
3 - 5% DS
(187 mm)
Inside:
DS(x) ~ 10-20%
0.25 pixel shift
(~1 mm)
Slide from Kent Kiehl’s 2005 (USA) Course Workshop
3 - 5% DS
Motion in fMRI
• Even small head movements can be a major
problem:
– Movement artefacts add up to the residual variance
and reduce sensitivity.
– Data may get completely lost if sudden movements
occur during a single volume
– Movements may be correlated with the task
performed
Minimising movements is one of the most
important factors for ensuring good data quality
fMRI motion prevention
1. Constrain the volunteer’s head
2. Instruct him/her explicitly to remain as calm
as possible, not to talk between sessions,
and swallow as little as possible
3. Do not scan for too long – everyone will move
after while!
fMRI motion correction
•
Each volume in the time-series is realigned
– Using rigid-body registration
• Assumes that brain shape doesn’t change
– Least squares cost function
•
Realigned images must be resliced for analysis
– Not necessary if they will be normalised anyway
•
An example of severe motion…
Residual errors in realigned fMRI
Even after realignment, as much as 90% of the variance can
be accounted for by effects of movement
This can be caused by e.g.:
1. Movement between and within slice acquisition
2. Interpolation artefacts due to resampling
3. Non-linear distortions and drop-out due to
inhomogeneity of the magnetic field
Incorporate movement parameters
as confounds in the statistical model
Movement-by-distortion interaction
• Subject disrupts B0 field,
rendering it inhomogeneous
– distortions occur along
phase-encode direction
• Subject moves during EPI
time series
– Distortions vary with
subject orientation
– Shape varies
Co-registration example
• Rigid intra-modality inter-subject registration
• Purely to illustrate concepts
• Coreg more commonly used to register a
structural image to a mean functional one
– Allows more accurate anatomical localisation
– Assists spatial normalisation (see later)
– Examples in SPM8 Manual, Chapters 28, 29
Reference
AKA template
AKA fixed image
(single_subj_T1)
Source
AKA template (!)
AKA moving image
(auditory/sM00223)
spm_defaults; global defaults
opts = defaults.coreg.estimate
opts =
cost_fun: 'nmi'
sep: [4 2]iteration 1...
tol: [1x123.72
double] 0
15.95
fwhm: [7 7]3.72
3.72 % intra-modal
15.95
opts.cost_fun = 'ncc';
3.72
15.95
15.95
x = spm_coreg(ref, 3.72
src, opts)
% …
3.72
15.95
iteration 2...
x =
... -0.02 -0.01
2.52 20.86 28.79 -0.20
iteration 8...
M = spm_matrix(x) 2.447
20.97
M =
2.447
20.97
0.999
-0.011 2.447
-0.016 20.97
2.522
0.008
0.981 2.447
-0.195 20.97
20.857
0.018
0.195 2.447
0.981 20.97
28.790
0
0 2.447 0 20.97
1.000
det(M)
ans =
1.000
0
0
19.61
19.61
19.61
19.61
0
0
0
-0.1837
-0.1837
-0.1837
0
0
0
0
-0.00151
-0.00151
28.73
28.73
28.74
28.74
28.74
28.74
-0.1905
-0.1905
-0.1905
-0.1905
-0.1905
-0.1905
-0.003633
-0.003633
-0.003633
-0.003633
-0.003633
-0.003633
Svx2Rvx = inv(ref.mat)*inv(M)*src.mat
0
0
0
0
0
-0.00063
-0.01026
-0.01026
-0.01026
-0.01026
-0.01026
-0.01031
|
|
|
|
|
|
-0.50731
-0.55893
-0.62815
-0.6434
-0.64341
-0.64341
|
|
|
|
|
|
-0.71486
-0.71486
-0.71487
-0.71487
-0.71487
-0.71487
Inter-modal similarity measures
• Often derived from joint and marginal entropies
– Entropies via probabilities from histograms
• Mutual Information (maximise)
– MI= ab P(a,b) log2 [P(a,b)/( P(a) P(b) )]
– Related to entropy: MI = H(a) + H(b) - H(a,b)
• H(a) = -a P(a) log2P(a)
• H(a,b) = -a P(a,b) log2P(a,b)
• Normalised MI = (H(a) + H(b)) / H(a,b)
Joint and marginal histograms
Joint histogram based registration
Initially registered T1 and T2 templates
After deliberate misregistration
(10mm relative x-translation)
Joint histogram sharpness correlates with image alignment
Mutual information and related measures attempt to quantify this
Overview of SPM Analysis
fMRI time-series
Motion
Correction
Statistical Parametric Map
Design matrix
Smoothing
Spatial
Normalisation
Anatomical
Reference
General Linear Model
Parameter Estimates
Spatial Normalisation
Spatial Normalisation - Reasons
• Inter-subject averaging
– Increase sensitivity with more subjects
• Fixed-effects analysis
– Extrapolate findings to the population as a whole
• Mixed-effects analysis
• Make results from different studies comparable
by aligning them to standard space
– e.g. The T&T convention, using the MNI template
Standard spaces
The Talairach Atlas
The MNI/ICBM AVG152 Template
The MNI template follows the convention of T&T, but doesn’t match the particular brain
Recommended reading: http://imaging.mrc-cbu.cam.ac.uk/imaging/MniTalairach
Coordinate system sense
• Analyze™ files are stored in a left-handed system
• Talairach space has the opposite (right-handed) sense
• Mapping between them requires a reflection or “flip”
– Affine transform with a negative determinant
z
x
z
y
y
y
z
x
x
Rotated example
Spatial normalisation – Issues
We want to warp the images to match functionally
homologous regions from different subjects
However…
1. No exact match between structure and function
2. Different brains – different structural topology
3. Computational problems (local minima, etc.)
Compromise by correcting gross differences
followed by smoothing of normalised images
Spatial Normalisation – Procedure
• Start with a 12 DF affine
registration
– 3 translations, 3 rotations
3 zooms, 3 shears
– Fits overall shape and size
• Refine the registration with
non-linear deformations
• Algorithm simultaneously minimises
– Mean-squared difference (Gaussian likelihood)
– Squared distance between parameters and their
expected values (regularisation with Gaussian prior)
Spatial Normalisation – Warping
Deformations are modelled with a linear
combination of non-linear basis functions
Spatial Normalisation – DCT basis
The lowest frequencies of a 3D discrete cosine
transform (DCT) provide a smooth basis
spm_dctmtx(5,5)
ans =
0.447
0.602
0.512
0.447
0.372 -0.195
0.447
0.000 -0.633
0.447 -0.372 -0.195
0.447 -0.601
0.512
plot(spm_dctmtx(50, 5))
0.372
-0.602
-0.000
0.602
-0.372
0.195
-0.512
0.633
-0.512
0.195
% Note, pinv(x)=x’, projection P=x*x’
P{n} = x(:,1:n)*x(:,1:n)’
P{N} == eye(N)
P{n<N} projects to smoother approx.
Spatial Normalisation
– Templates and masks
A wider range of contrasts can be registered
to a linear combination of template images.
PET
T2
T1
Transm
EPI
PD
PET
Spatial normalisation
can be weighted so that
non-brain voxels do not
influence the result.
T1
PD
More specific weighting
masks can be used to
improve normalisation
of lesioned brains.
Spatial Normalisation – Results
Affine registration
Non-linear registration
Optimisation
• Find the “best” parameters according to an
“objective function” (minimised or maximised)
• Objective functions can often be related to a
probabilistic model, e.g. Maximum Likelihood
Objective
function
Global optimum
(most probable)
Local optimum
Value of parameter
Local optimum
Optimisation – poor local optima
Optimisation – regularisation
• The “best” parameters according to the
objective function may not be realistic
• In addition to similarity, regularisation terms
or constraints are often needed to ensure a
reasonable solution is found
– Also helps avoid poor local optima
– These can be considered as priors in a Bayesian
framework, e.g. converting ML to MAP:
• log(posterior) = log(likelihood) + log(prior) + c
Spatial Normalisation – Overfitting
Without
regularisation,
the non-linear
normalisation
can introduce
unnecessary
deformation
Template
image
Non-linear
registration
using
regularisation.
(2 = 302.7)
Affine
registration.
(2 = 472.1)
Non-linear
registration
without
regularisation.
(2 = 287.3)
Normalising fMRI time-series
•
Two main options for fMRI normalisation:
1. Structural normalisation (unified segmentation)
– Rigidly coregister structural MRI to mean functional
– Normalise structural and apply warp (write) to fMRI
2. EPI normalisation
– Normalise mean functional to EPI template
– Apply warp to fMRI time-series
– Optional coregistration and norm-write of structural
for visualisation purposes
Normalising structural to T1 template
Estimate normalization parameters
(T1 -> T1 template)
T1 image
Apply the normalization
parameters to the T1 image
EPI time series
And apply the normalization
parameters to the (coregistered)
functional images
Normalising time series to EPI template
Calculate
mean of
EPI time
series
Estimate
normalization
parameters
(EPI -> EPI
template)
EPI time series
Apply the normalization
parameters to all EPI images
T1 image
Apply the normalization
parameters to the (coregistered)
T1 image
Custom EPI
template
Custom EPI
template (note
different coords)
Original EPI
image
Normalised
EPI image
Smoothing
• Why would we deliberately blur the data?
– Suppress noise and effects due to differences in
anatomy by averaging over neighbouring voxels
– Achieve better spatial overlap, enhanced sensitivity,
and greater validity of statistical assumptions
– Reduce the effective number of multiple comparisons
when correcting results using Random Field Theory
• How is it implemented?
– Convolution with a 3D Gaussian kernel, of specified
Full-width at half-maximum (FWHM) in mm
Example of
Gaussian smoothing
in one-dimension
The Gaussian kernel is
separable we can
smooth 2D data with
two 1D convolutions.
Generalisation to 3D is
simple and efficient
A 2D
Gaussian
Kernel
Smoothing – a link to ROI analysis
Each voxel after smoothing effectively represents a
weighted average over its local region of interest (ROI)
Before convolution
Convolved with a circle
Gaussian convolution
Preprocessing in SPM
• Realignment
– With non-linear unwarping for EPI fMRI
•
•
•
•
•
Slice-time correction
Coregistration
SPM8’s unified tissue segmentation
Normalisation
and spatial normalisation procedure
will be covered in the VBM lecture
Segmentation
Smoothing
Download