Functional MRI data preprocessing
Transcript of Functional MRI data preprocessing
Functional MRIFunctional MRI
data data preprocessingpreprocessing
Cyril Pernet, PhDCyril Pernet, PhD
Data have been acquired, whatData have been acquired, what’’s next?s next?
Picture credit: http://home.kpn.nl/raema005/functional_magnetic_resonance_imaging_fmri.html
No matter the design, multiple volumes (made from multiple slices) have
been acquired in time. Before getting data out, we need to make sure the signal from each voxel contains the right temporal and spatial information.
time
Slice timing andRealignment
smoothing
normalisation
Statistics
AnatomicalAnatomical
referencereference
kernelkernel
fMRI timefMRI time--seriesseries
Slice Timing CorrectionSlice Timing Correction
R. Henson, C. Buechel, O. Josephs, K. FristonThe slice-timing problem in event-related fMRI
NeuroImage, 9 (1999), p. 125-125
Slice Timing CorrectionSlice Timing Correction
�� Most of the time, fMRI data are acquired using sequential Most of the time, fMRI data are acquired using sequential
2D imaging like single shot EPI. Since fMRI statistics are 2D imaging like single shot EPI. Since fMRI statistics are
about analyzing the time course of the BOLD signal, exact about analyzing the time course of the BOLD signal, exact
timing with regard to the stimulus presentation is crucial.timing with regard to the stimulus presentation is crucial.
Sladky et al. (2011) NeuroImage, 58, 588-594.
�� For instance, if you set a For instance, if you set a
TR of 2 sec and acquire TR of 2 sec and acquire
30 slices, the acquisition 30 slices, the acquisition
time of 1 slice is ~66.66 time of 1 slice is ~66.66
ms (2000/30) and STC ms (2000/30) and STC
compensates for these compensates for these
sampling differences .sampling differences .
� STC consists in shifting the signal phase by a given amount to temporally align data. It is therefore mandatory to select a reference slice. The reference slice is usually the slice acquired in the middle of the sequence (maximum interpolation of TR/2) but any slice can be used.
00.20.40.60.811.21.41.61.8
123456789
10
123456789
10
010.21.2 0.41.4 0.61.6 0.81.8
Sequential acquisitionRef slice 6
Interleaved acquisitionRef slice 2
Data are acquired either in sequential or interleaved mode and the middle of the sequence is not the middle of the brain!
Slice Timing CorrectionSlice Timing Correction
Sladky et al. (2011) NeuroImage, 58, 588-594.
� TR of e.g. 2 sec with the middle temporal slice as reference is comparable to a dataset with a TR of 1 sec when the first (or last) slice acquired are used as a reference slice. This can be a reasonable practice, if the region of interest and putative activations are located near the first (or last) slice because it suppresses temporal interpolation effects in these areas.
Slice Timing CorrectionSlice Timing Correction
Note that all regressors in the GLM also need to be adjusted for this shift in time according to the reference slice (e.g. TR / 2).
Sladky et al. (2011) NeuroImage, 58, 588-594.
� Possible introduction of aliasing effects for signals at frequencies above the Nyquist sampling limit. Given a typical TR of 2 s (f = 0.25 Hz) a minimal inter-stimulus interval (ISI) of more than 4 s is recommended. When using the slice acquired in the middle of the acquisition period (TR) as a reference slice, the signal needs to be shifted by TR / 2, therefore reducing the suggested minimal ISI to 2 s.
� It is sometimes advocated to not do the STC especially for TR<2 sec. However, Sladky et al. showed that is always beneficial. When not performed, the reduction of parameter estimates (effects) were more pronounced for long TRs, event-related designs and designs with shorter SOA (up to 63% !).
Slice Timing CorrectionSlice Timing Correction
motion correction motion correction
(realignment)(realignment)
JV. Hajnal, R. Myers, A. Oatridge, JE. Schwieso, IR. Young, GM. BydderArtifacts due to stimulus-correlated motion in functional imaging of the brain.
Magn Reson Med, 3 (1994), p283–291.
Motion artefactsMotion artefacts
�� Subjects will always move in the scanner: swallowing for Subjects will always move in the scanner: swallowing for instance lead to motion along the x axis or some instance lead to motion along the x axis or some movements may be related to the tasks performed.movements may be related to the tasks performed.
�� Motion will results in a mismatch of the location of Motion will results in a mismatch of the location of subsequent images in the timesubsequent images in the time--series. Since the sensitivity series. Since the sensitivity of the statistical analysis is determined by the amount of of the statistical analysis is determined by the amount of residual noise in the image series, mismatch of the location residual noise in the image series, mismatch of the location will add to this noise and reduce the sensitivity.will add to this noise and reduce the sensitivity.
�� This type of motion problem corresponds to wholesale This type of motion problem corresponds to wholesale movements (movements (bulkbulk--motionmotion) and is well corrected by ) and is well corrected by realignment algorithms.realignment algorithms.
Motion correction: How?Motion correction: How?
∆x=10mm
∆y=0
∆θ=10º
∆θ
Transform
co-ordinate∆x
For each voxel-centre
co-ordinateFind co-ordinate in
original image
�� Determine the rigid body transformation that minimises Determine the rigid body transformation that minimises
some cost function (a way to define the difference between some cost function (a way to define the difference between
2 images as e.g. least square (SPM) or normalized 2 images as e.g. least square (SPM) or normalized
correlation ratio (FSL)).correlation ratio (FSL)).
�� Rigid body transformation is defined by: 3 translations in X, Rigid body transformation is defined by: 3 translations in X,
Y & Z directions and 3 rotations around the X, Y & Z axes.Y & Z directions and 3 rotations around the X, Y & Z axes.
Illustration taken from Jesper Andersson
Motion correction: Quality checkMotion correction: Quality check
�� Plots the estimates from the head motion algorithmPlots the estimates from the head motion algorithm
(might be useful to change angles into degrees and also (might be useful to change angles into degrees and also
plot the 1plot the 1stst derivative derivative –– outlier detection can then be run to outlier detection can then be run to
identify identify ‘‘badbad’’ scans)scans)
�� Compute whole head distance between volumes and to the Compute whole head distance between volumes and to the
mean (mean square difference)mean (mean square difference)
�� Inspect the realigned data as a movieInspect the realigned data as a movie
Lots of tools available on websitesFor SPM users, I wrote a script to do this automaticallysee https://sourceforge.net/projects/spm-qa-tools
Motion correction: Quality checkMotion correction: Quality check
Plots of head motion
50 100 150 200 250
−0.4
−0.2
0
0.2
0.4
0.6
Translation
scans
mm
50 100 150 200 250−0.5
0
0.5
Rotation
scans
de
gre
es
50 100 150 200 250
−0.2
0
0.2
scan to scan translation
scans
mm
50 100 150 200 250
−0.1
0
0.1
0.2
scan to scan rotation
scansd
eg
ree
s
50 100 150 200 2500
0.1
0.2
0.3
0.4
Mean square displacement
scans
dis
pla
ce
me
nt
Motion correction: Quality checkMotion correction: Quality check
Whole head distances
50 100 150 200 250
200
300
400
500
600
700
scans
square
d d
iffe
rence
Mean quared distance to the average
50 100 150 200 250
100
150
200
250
scans
square
d d
iffe
rence
Volume to volume mean squared distance
Motion correction: Quality checkMotion correction: Quality checkMovies
Even more motion artefactsEven more motion artefacts
�� Motion can also alter the MR signal because protons that Motion can also alter the MR signal because protons that moves into a moves into a voxelvoxel from a neighbouring slice have an from a neighbouring slice have an excitation different from that expected by the scanner and excitation different from that expected by the scanner and the signal will not reflect well the tissue in that the signal will not reflect well the tissue in that voxelvoxel. This . This spin history effectspin history effect is not corrected using motion correction is not corrected using motion correction algorithms and Independent Component Analysis (ICA) or algorithms and Independent Component Analysis (ICA) or dedicated methods must be used.dedicated methods must be used.
The spin history effect is seen as alternating bright and dark stripes with interleaved acquisitions. One can mitigate this by modelling bad images as dummy regressors and include movement parameter estimates into the
analysis.
Picture credit: http://wagerlab.colorado.edu/wiki/doku.php/help/fmri_quality_control_overview
Even more motion artefactsEven more motion artefacts
�� Physiological artefactsPhysiological artefacts
Lund et al. (2006) NeuroImage, 29, 54-66
respiratory-induced noise is dominant near the edges of the brain as well as near in the larger veins and in the ventricles.
cardiac-induced noise is dominant near larger vessels (e.g. medial cerebral artery and Circle of Willis)
�Physio monitoring�Don’t trust those regions
Spatial NormalizationSpatial Normalization
M, Holden A review of geometric transformations for nonrigid body registration.
IEEE Trans Med Imaging, 27 (2008) , p 111-128
Normalization: Why?Normalization: Why?
�� InterInter--subject averagingsubject averaging
�� extrapolate findings to the population as a wholeextrapolate findings to the population as a whole
�� increase activation signal above that obtained from increase activation signal above that obtained from
single subjectsingle subject
�� increase number of possible degrees of freedom increase number of possible degrees of freedom
allowed in statistical modelallowed in statistical model
�� Enable reporting of activations as coEnable reporting of activations as co--ordinates within a ordinates within a
known standard spaceknown standard space
�� e.g. the space described by e.g. the space described by TalairachTalairach & & TournouxTournoux, , or or
thethe MNI space MNI space (SPM, FSL)(SPM, FSL)
Normalization: How?Normalization: How?
�� Current methods works mainly on T1 weighted images Current methods works mainly on T1 weighted images
(i.e. anatomical), so in practice one uses a 3 steps (i.e. anatomical), so in practice one uses a 3 steps
approach in which one i) approach in which one i) coregistercoregister T1 and T2* (fMRI) T1 and T2* (fMRI)
data so that they are aligned and in the same space and data so that they are aligned and in the same space and
ii) normalize the anatomical image (i.e. transform it to ii) normalize the anatomical image (i.e. transform it to
match the template) and iii) apply the parameters match the template) and iii) apply the parameters
obtained to the fMRI imagesobtained to the fMRI images
Mean EPI T1-weighted Template
coregister normalize
apply normalization parameters
T1 image T1 image preprocessingpreprocessing
�� The anatomical image is 1The anatomical image is 1stst preprocessedpreprocessed, depending on , depending on
the method this includes: i) the method this includes: i) Noise reductionNoise reduction: improves : improves
local features using local smoothing (SUSAN algorithm in local features using local smoothing (SUSAN algorithm in
FSL), ii) FSL), ii) Bias correctionBias correction: from 3 : from 3 TeslasTeslas, there is often , there is often
broad intensity variations in space that need to be broad intensity variations in space that need to be
corrected, iii) corrected, iii) Brain extractionBrain extraction: remove non brain tissue, : remove non brain tissue,
iv) iv) SegmentationSegmentation: separate grey matter, white matter : separate grey matter, white matter
and CSFand CSF
In SPM, the unified segmentation approach (Ashburner and Friston (2005) NeuroImage, 26, 839-851) combines/optimizes bias correction, segmentation, and normalization all in one, such as the prior probability of
a voxel to belong to a tissue class is determined using a probabilistic atlas. In this framework 2 voxels with the same values can be classified differently using anatomical knowledge.
T1 image T1 image preprocessingpreprocessing
Noise reductionNoise reduction
Bias correctionBias correction
Brain extractionBrain extraction
SegmentationSegmentation
Original T1Original T1--weightedweighted
�� The first part of spatial normalisation is a 12 parameter The first part of spatial normalisation is a 12 parameter affine transformationaffine transformation: :
�� 3 translations3 translations
�� 3 rotations3 rotations
�� 3 scaling3 scaling
�� 3 shears3 shears
VolumeVolume--based normalizationbased normalization
} Rigid body transformation (realignment)� does not change the size or shape of images
Affine transformation: any set of points that fell on a line prior transformation will continue to fall on a line after the transformation
} Allow change in overall size and shape
VolumeVolume--based normalizationbased normalization
�� DARTEL toolbox in SPM or DARTEL toolbox in SPM or FNIRT in FSL rely on FNIRT in FSL rely on diffeomorphismdiffeomorphism, that is the , that is the transformation from one transformation from one image to the other can be image to the other can be represented as a vector field, represented as a vector field, describing the movements to describing the movements to
apply at each apply at each voxelvoxel..
�� The second part of the normalization uses nonThe second part of the normalization uses non--linear deformations.linear deformations.
SurfaceSurface--based Normalizationbased Normalization
�� Often more accurate to register cortical features Often more accurate to register cortical features than than ‘‘oldold’’ volume based methods. Often limited volume based methods. Often limited to cortical surface.to cortical surface.
�� A combined method (surface based for cortical A combined method (surface based for cortical and volume based for deep brain structures) is and volume based for deep brain structures) is available in available in FreesurferFreesurfer..
orig white pial
inflated sphere patch
original white pial
Image credit: Sarah W
hittle &
Dominic Dwye
r free-surfer talk
Normalization: quality checkNormalization: quality check
�� Visual inspection using e.g. Visual inspection using e.g. CheckRegCheckReg in SPMin SPM
�� Mean T2*, T1, TemplateMean T2*, T1, Template
Allows checking the coregistration and normalization worked
Normalization: quality checkNormalization: quality check
�� Segmented (normalized) gray matter and white matter Segmented (normalized) gray matter and white matter
vs. priors (i.e. the gray and white matter images used vs. priors (i.e. the gray and white matter images used
with the template) with the template)
Sometimes the overall shape looks ok but the segmentation was not
too good – best to check this as well
Normalization: quality checkNormalization: quality check
�� Outlines of template vs. normalized T1Outlines of template vs. normalized T1
�� Average normalized imagesAverage normalized images
�� Distance of normalized data to the templateDistance of normalized data to the template
�� MovieMovie
Lots of tools available on websitesFor SPM users, I wrote a script to do this automaticallysee https://sourceforge.net/projects/spm-qa-tools
Normalization: quality checkNormalization: quality check
Average of Normalized T2* Image Outlines Average/T1
Interpolation methodsInterpolation methods
P. P. ThevenazThevenaz, T. , T. BluBlu & M Unser& M Unser
Interpolation revisedInterpolation revised
IEEE Trans Med Imaging, 19 (2000), p 739IEEE Trans Med Imaging, 19 (2000), p 739--758 758
Write down the new imagesWrite down the new images
�� Each transformation (realignment, segment, Each transformation (realignment, segment,
normalize) comes with different methods of normalize) comes with different methods of
interpolationinterpolation
�� Each time an image is transformed, Each time an image is transformed, voxelsvoxels dondon’’t align t align
with the original ones and new with the original ones and new voxelsvoxels have to be have to be
created created –– their value is inferred from neighbours.their value is inferred from neighbours.
There is no need to apply each transformation. Parameters are stored in the header and for a new transform, previous parameters are applied and the new transform computed. Only when all is computed, one has to write images. At this stage all parameters are applied. This allows to interpolate voxel values only once.
Write down the new imagesWrite down the new images
Interpolation methods include i) nearest neighbour ii) linear
interpolation iii) higher-order interpolation like sinc
interpolation or spline.
http://imp4-2008.blogspot.co.uk/
http://www.hyperzoid.com/csc492/rendering.html
Loss of resolution
Tends to blur images
Write down the new imagesWrite down the new images
Interpolation methods include i) nearest neighbour ii) linear
interpolation iii) higher-order interpolation like sinc
interpolation or spline.
SmoothingSmoothing
Smoothing: Why?Smoothing: Why?
�� Increase signal to noise by removing highIncrease signal to noise by removing high--frequency frequency
information (smallinformation (small--scale changes in the image)scale changes in the image)
�� InterInter--subject averaging as spatial normalization subject averaging as spatial normalization
cannot perfectly align all structurescannot perfectly align all structures
�� Increase validity of statistics when using random field Increase validity of statistics when using random field
theory.theory.
Smoothing: How?Smoothing: How?
Before convolution Convolved with a circle Convolved with a Gaussian
Each voxel, after smoothing, effectively becomes the
result of applying a weighted region of interest. In SPM, smoothing is a convolution with a 3D Gaussian kernel, and
the kernel is defined in terms of FWHM (full width at half
maximum)
2D illustration using the conv2 function in Matlab
Smoothing: How much?Smoothing: How much?
�� Depends on effects to be detected Depends on effects to be detected �� Matched filter Matched filter theorem: smoothing kernel = expected signal.theorem: smoothing kernel = expected signal.
�� Practically FWHM 2 times the Practically FWHM 2 times the voxelvoxel size is appropriate size is appropriate for random fields theory, whilst improving SNR.for random fields theory, whilst improving SNR.
�� May consider varying kernel size if interested in different May consider varying kernel size if interested in different brain regions (e.g. hippocampus brain regions (e.g. hippocampus --vsvs-- parietal cortex)parietal cortex)))
Picture credit: http://fcp-indi.github.com/docs/user/smoothing.html