Preprocessing
Francis Loayza
Functional Neuroimaging Laboratory
Center for Applied Medical Research
University of Navarra
So
Reconstructed me
fMRI Data S tep Pre
Slice Timing s pro
AdjustmentRealignment ce
ssi
Motion ng
Correction
Coregistration
fMRI Normalization Display
Study Warping Smoothing
Rendering of
Spatial & Temporal Results on
Meta-Data Filtering Anatomy
Data Modeling
Experimental Statistical
Statistical
Design Analysis
Matrix Maps
Engine
Table of
Local Max
Tools for preprocessing
SPM (fMRI, VBM)
FSL (fMRI, VBM)
Brain Voyager (fMRI, VBM)
VoxBo (fMRI, VBM)
AFNI (fMRI, VBM)
ANTs (for Deep Learning)
SITK libraries (for Deep Learning)
Basic terminology for different scales
a period of time during which the subject is
session in the scanner, motionless (~1-2 hours)
a single run of an MR measurement
run sequence (< 10 minutes) [AKA:” series”]
volume
slice
voxel
Functional MRI (fMRI)
Uses echo planar imaging (EPI) for fast
acquisition of T2*-weighted images.
Spatial resolution:
3 mm (standard 1.5 T scanner)
< 200 μm (high-field systems)
Sampling speed:
1 slice: 50-100 ms
Requires spatial pre-processing and statistical
analysis.
Quality control
• It is essential that you perform QC checks at
multiple points in your data analysis stream
You MUST know how to look at raw data!
You can’t trust your analysis package to do everything
for you.
Things to look for
Data acquisition artifacts
Subject-related artifacts
Analysis-related artifacts
Quality control
MRI data artifact:
Things to look for:
Spikes
Ghosting
Geometric distortions
Signal dropout
Tools:
ForSPM: art_repair
(matlab toolbox)
Quality control
Spikes Ghosting
Quality control
Geometric distortions Susceptibility dropout
M Cohen.
Ojemann et al.
Quality control
Movement artifact
The traditional preprocessing
1. Slice Timing
2. Realignment
3. Coregistration
4. Normalisation
5. Smoothing
Slice Timing
Some researches don't
recommend to perform this steep
exposed last
exposed first
Slice Timing
exposed last
exposed first
Slice Timing
Correction shifts each voxel's time series so
that all voxels in a given volume "appear" to
have been captured at exactly the same time
TR RAW
TA
0 3 6
time in seconds
Slice Timing
Slices of an EPI image acquired separately
Therefore, information from different slices come
from varying points in time after task events
Different orders of slice acquisition:
ascending vs. descending
sequential vs. interleaved
Slice Timing
Only needed if:
Temporal dynamics of evoked responses are
important and if
TR is sufficiently small to permit interpolation
( <3 seconds )
BioPhysical latency is on the order of seconds
Usually unnecessary if latency differences are
modelled in SPM analysis “proper” using
temporal derivatives.
SPM Slice timing
Old Format “3D”
afilename.hdr
afilename.img New Format “3D”
afilename.nii
afilename.mat
FSL Slice timing
Included in FEAT module
Realignment (motion correction)
hemodynamic response is small compared to signal from
movement
increase sensitivity of T-Test (movement contributes to
variance)
When to do it
Must be before Normalization
Can be either before or after slice time correction
(disadvantages to both options)
For interleaved acquisitions it’s recommended to slice time
correct first
For sequential acquisitions it’s recommended to realign first
May introduce errors due to interpolation and interaction
with motion
Applying rigid-body transformations: 3 translation and 3
rotation
Métodos: análisis de imagen preprocesado
Activation
Imágenes RMf:
Realineación
Detección de artefactos
Realignment (3D motion correction)
Subjects move, like it or not
EPI image also moves from B0 shift
Along phase encode
(L->R or A->P)
Shift X, Y, Z (in mm)
Rotate X, Y, Z (pitch, roll, yaw)
If voxel at high-contrast
edge, then time series
will show changes
just from motion
Realignment
Movements could be due to stimulation
Realignment
Gadgets for prevent artifacts movements
A B
C D
Realignment
In extreme cases, up to 90% of the variance in
fMRI time-series can be accounted for by effects
of movement AFTER realignment:
subject movement between slice acquisition
interpolation artefacts
nonlinear distortion due to magnetic field
inhomogeneities (EPI distortion)
Realignment and Unwarp
EPI images are distorted relative to the structural scans
Bigger magnet = more distortion
Different tissues have different magnetic susceptibilities
Magnetic field warps at tissue boundaries
Realignment and Unwarp
Either anatomical scan or functional data is used to estimate
warping parameters, using one of the following models:
12 parameter affine transformation
Low frequency basis spatial functions
Vector field specifying the mapping for each voxel SPM
FSL (FLIRT)
in function of degrees of freedom
Realign: 6 DF
Unwarp: 6 DF
Total 12 DF
Realignment
SPM adds a prefix r to each
file
rafilename.nii
Coregistration
Align different modalities (eg PET & MRI)
Align functional (EPI) with structural (T1)
and different runs between each other
Optimize parameters describing rigid body
transformation to match functional with
structural
Coregistration
Advantages
Aids in normalization
Allows display of activation on anatomical images
Allows comparison across modalities
Necessary if no coplanar anatomical images
Disadvantages
May severely distort functional data
May reduce correspondence between functional and
anatomical images
Normalization
Normalization
Advantages
Allows generalization of results to larger population
Improves comparison with other studies
Provides coordinate space for reporting results
Enables averaging across subjects
Disadvantages
Reduces spatial resolution
May reduce activation strength by subject averaging
Time consuming, potentially problematic
Doing bad normalization is much worse than not normalizing
Normalization
Template
152 MNI; Voxel size: 2x2x2
SPM: Prefix w warfilename.nii
Normalization Template Normalized Data
fMRI to structural
Matching the functional image
to the structural image
– Overlaying activation on
individual anatomy
– Better spatial image for
normalisation
Two significant differences
between co-registering to
structural scans and motion
correction
– When co-registering to
structural, the images do not
have the same signal intensity
in the same areas; they
cannot be subtracted
– They may not be the same
shape
Problem: Images are different
Differences in signal intensity between the
images
Normalise to appropriate template (EPI to EPI; T1 to T1), then segment
Normalisation: Methods
Methods of registering images:
– Label-based approaches: Label homologous features in source
and reference images (points, lines, surfaces) and then warp
(spatially transform) the images to align the landmarks (BUT:
often features identified manually [time consuming and
subjective!] and few identifiable landmarks)
– Intensity-based approaches: Identify a spatial transformation
that maximises some voxel-wise similarity measure (usually by
minimising the sum of squared differences between images;
BUT: assumes correspondence in image intensity [i.e., within-
modality consistency], and susceptible to poor starting
estimates)
– Hybrid approaches – combine intensity method with user-
defined features
SPM: Spatial Normalisation
SPM adopts a two-stage procedure to determine
a transformation that minimises the sum of
squared differences between images:
Step 1: Linear transformation (12-parameter affine)
Step 2: Non-linear transformation (warping)
High-dimensionality problem
The affine and warping transformations are
constrained within an empirical Bayesian
framework (i.e., using prior knowledge of the
variability of head shape and size): “maximum a
posteriori” (MAP) estimates of the registration
parameters
Step 1: Affine Transformation
Determines the
optimum 12-parameter
affine transformation to
match the size and Rotation Shear
position of the images
12 parameters = 3
translations and 3
rotations (rigid-body) +
3 shears and 3 zooms Translation Zoom
Step 2: Non-linear Registration
Assumes prior approximate
registration with 12-parameter
affine step
Modelled by linear
combinations of smooth
discrete cosine basis functions
(3D)
Choice of basis functions
depend on distribution of warps
likely to be required
For speed and simplicity, uses
a “small” number of
parameters (~1000)
Matthew Brett
Step 3: Dipheomorphic Registration
2-D visualisation (horizontal
and vertical deformations):
Ashburner; HBF Chap 3
Brain
visualisation:
Source Template
Deformation
field
Warped
image
Smoothing
Application of
Gaussian kernel
Usually expressed in
#mm FWHM
“Full Width – Half
Maximum”
Typically ~2 times
voxel size
Smooth 5 to 8 mm.
Smoothing
Before convolution Convolved with a circle Convolved with a Gaussian
Métodos: análisis de imagen preprocesado
Corregistro
Normalización
Filtrado espacial
Smoothing FSL:
SPM:
Smoothing
Advantages
Increases Signal to Noise Ratio (SNR)
Matched Filter Theorem: Maximum increase in SNR by filter with
same shape/size as signal
Reduces number of comparisons
Allows application of Gaussian Field Theory
May improve comparisons across subjects
Signal may be spread widely across cortex, due to intersubject
variability
Disadvantages
Reduces spatial resolution
Challenging to smooth accurately if size/shape of signal is not
known
Smoothing effects
SPM:
Adds prefix s
swarfilename.nii
Smoothing
Unsmoothed Data
Smoothed Data (kernel width 5 voxels)
Preprocessing using DARTEL
(SPM)
There are some limitations for normalizing
using the traditional method.
For this, it have been development some
algorithms to perform normalizations.
The traditional processing
Affine registration
Diffeomorphic registration
You can use different packages:
ANTs The algorithm consist in create and store the
deformation flow field for each subject.
SPM – DARTEL The same field can be used for both forward
ART or backward deformations
IRTK
SPM-Dartel steps
Important..! process all subjects
Realign
New segment (split off the differents brain tissues: gray,
white, CSF, bone, etc)
Dartel tools => Run Dartel: create template based on all
subjects and determine the non linear deformations
Dartel tools => normalize to MNI space: apply the
non linear deformations to each selected image (EPI and T1).
This script smooth the EPI images.