Presentation is loading. Please wait.

Presentation is loading. Please wait.

SINPASE fMRI course Dr Cyril Pernet, University of Edinburgh Dr Gordon Waiter, University of Aberdeen.

Similar presentations


Presentation on theme: "SINPASE fMRI course Dr Cyril Pernet, University of Edinburgh Dr Gordon Waiter, University of Aberdeen."— Presentation transcript:

1 SINPASE fMRI course Dr Cyril Pernet, University of Edinburgh Dr Gordon Waiter, University of Aberdeen

2 Overview Matlab® environment: images are matrices Matlab® environment: images are matrices MRI and fMRI: image format and softwares MRI and fMRI: image format and softwares Computational Neuro-anatomy: theory Computational Neuro-anatomy: theory Computational Neuro-anatomy: pratice Computational Neuro-anatomy: pratice Statistics: theory Statistics: theory fMRI Single level analysis in practice fMRI Single level analysis in practice fMRI Random effects analysis fMRI Random effects analysis Other software - visualization Other software - visualization Data provided by the FIL: Data provided by the FIL:

3 Matlab® environment: images are matrices Read data and do basic stuffs

4 Matlab (1) Command window: Command window: A = 3+5 A = 3+5 Workspace: whos Workspace: whos History History Browser Browser

5 Matlab (2) load MRI_3D look in the workspace load MRI_3D look in the workspace size(MRI_3D) returns the dimensions (here nb of voxels) size(MRI_3D) returns the dimensions (here nb of voxels) imagesc(MRI_3D(:,:,54)) imagesc(MRI_3D(:,:,54)) All rows All columns column 54 on dim3 All rows All columns column 54 on dim3 imagesc(MRI_3D(:,:,54)') imagesc(MRI_3D(:,:,54)') imagesc(flipud(MRI_3D(:,:,54)')) imagesc(flipud(MRI_3D(:,:,54)')) colormap('gray') colormap('gray')

6 Matlab (3) MRI images are matrices (tables) with 3 dimensions, but it can be 4 dimensions (fMRI) or more. MRI images are matrices (tables) with 3 dimensions, but it can be 4 dimensions (fMRI) or more. Operations on matrices Operations on matrices A = [ ]; B = A' (transpose) A = [ ]; B = A' (transpose) A*B matrix multiplication sum of row*columns A*B matrix multiplication sum of row*columns C = [ ]; C = [ ]; A+C addition / subtraction work by cell A+C addition / subtraction work by cell A.*C multiplication by cell uses.* (and./) A.*C multiplication by cell uses.* (and./) Exercise: subtract slice 54 from slice 55 and image it imagesc(flipud(MRI_3D(:,:,55)'-MRI_3D(:,:,54)'))

7 Matlab (4) Exercise: Make a script (Matlab Editor) to look at the all volume using an axial view Exercise: Make a script (Matlab Editor) to look at the all volume using an axial view Possible functions to use: for, imagesc, squeeze, pause … and the matlab help Possible functions to use: for, imagesc, squeeze, pause … and the matlab help Loop For/End Loop For/End for z = 1:108 for z = 1:108 do this and that for each z end end

8 Matlab (5) for z = 50:220 imagesc(squeeze(MRI_3D(:,z,:))) imagesc(squeeze(MRI_3D(:,z,:))) colormap('gray') colormap('gray') title(['this is the slice ',num2str(z)]) title(['this is the slice ',num2str(z)]) pause(0.1) pause(0.1)end

9 MRI and fMRI: image format and software

10 Image format DICOM format (.dcm) DICOM format (.dcm) Standard format coming from all scanners Standard format coming from all scanners Stands for Digital Imaging and Communications in Medicine Stands for Digital Imaging and Communications in Medicine Part 10 of the DICOM standard describes a file format for the distribution of images Part 10 of the DICOM standard describes a file format for the distribution of images A single DICOM file contains both a header (which stores information about the patient's name, the type of scan, image dimensions, etc), as well as all of the image data (which can contain information in three dimensions). A single DICOM file contains both a header (which stores information about the patient's name, the type of scan, image dimensions, etc), as well as all of the image data (which can contain information in three dimensions). Manufacturers tend to output in DICOM but also put lots of useful information in the private part of the header Manufacturers tend to output in DICOM but also put lots of useful information in the private part of the header

11 Image format Analyze format (.img.hdr) Analyze format (.img.hdr) Analyze is an image processing program, written by The Biomedical Imaging Resource at the Mayo Foundation. Analyze is an image processing program, written by The Biomedical Imaging Resource at the Mayo Foundation. There are two Analyze formats. One, by much the more common, is Analyze 7.5 (this is one format used by SPM), the other is Analyze AVW, the format used in the latest version of the Analyze program There are two Analyze formats. One, by much the more common, is Analyze 7.5 (this is one format used by SPM), the other is Analyze AVW, the format used in the latest version of the Analyze program An Analyze (7.5) format image consists of two files, and image (.img) and a header file (.hdr). The.img file contains the numbers that make up the information in the image. The.hdr file contains information about the img file, such as the volume represented by each number in the image (voxel size) and the number of pixels in the X, Y and Z directions. This header contains fields of text, floating point, integer and other information. An Analyze (7.5) format image consists of two files, and image (.img) and a header file (.hdr). The.img file contains the numbers that make up the information in the image. The.hdr file contains information about the img file, such as the volume represented by each number in the image (voxel size) and the number of pixels in the X, Y and Z directions. This header contains fields of text, floating point, integer and other information.

12 Image format NIfti format (.img.hdr or.nii) NIfti format (.img.hdr or.nii) Stands for Neuroimaging Informatics Technology Initiative (The National Institute of Mental Health and the National Institute of Neurological Disorders and Stroke) Stands for Neuroimaging Informatics Technology Initiative (The National Institute of Mental Health and the National Institute of Neurological Disorders and Stroke) Facilitates inter-operation of functional MRI data analysis software packages Facilitates inter-operation of functional MRI data analysis software packages Headers now include - affine coordinate definitions relating voxel index (i,j,k) to spatial location (x,y,z); codes to indicate spatio-temporal slice ordering for FMRI; - "Complete" set of bit data types; - Standardized way to store vector-valued datasets over 1-4 dimensional domains; - etc Headers now include - affine coordinate definitions relating voxel index (i,j,k) to spatial location (x,y,z); codes to indicate spatio-temporal slice ordering for FMRI; - "Complete" set of bit data types; - Standardized way to store vector-valued datasets over 1-4 dimensional domains; - etc

13 1. Importing Data Matlab DICOM tools in the image processing toolbox, but also plenty of free software including SPM Matlab DICOM tools in the image processing toolbox, but also plenty of free software including SPM Type SPM select fMRI Type SPM select fMRI Import from the directory 3D_dicom Save as one file

14 1. Importing Data

15 Select the newly imported image Select the newly imported image Surf to the front, near the eye Surf to the front, near the eye Check orientation Check the voxel size!! edit spm_defaults edit spm_defaults defaults.analyze.flip = 1; % input data left = right defaults.analyze.flip = 1; % input data left = right

16 1. Importing Data Now simply double click on the nii file – this should bring MRICron Now simply double click on the nii file – this should bring MRICron Again surf to the front near the eyes the white spot is at a different location ?? Check outside the brain MRICron is telling you are on the right side Again surf to the front near the eyes the white spot is at a different location ?? Check outside the brain MRICron is telling you are on the right side BE AWARE OF THE ORIENTATION BE AWARE OF THE ORIENTATION

17 Computational Neuro- anatomy: theory

18 Slice timing and Realignment smoothing normalisation Statistics Anatomical reference kernel fMRI time-series

19 Slice timing: Why? During the scanning, slices of the brain are acquired every TR (x sec) and one wants to correct for this delay between slices. During the scanning, slices of the brain are acquired every TR (x sec) and one wants to correct for this delay between slices. Data can be acquired in ascending/descending order, in this case one realigns first, otherwise one would apply the same time correction to voxels possibly coming from different slices, i.e. acquired at different time. Data can be acquired in ascending/descending order, in this case one realigns first, otherwise one would apply the same time correction to voxels possibly coming from different slices, i.e. acquired at different time. Often one acquires first slices 1, 3, 5, 7, 9 … then 2, 4,6, 8, … (interleaved mode), in this case slice timing is done first otherwise the realignment would move voxels possibly coming from different slices, i.e. acquired at different time (max TR/2), onto the same plane and the slice timing would then be wrong. Often one acquires first slices 1, 3, 5, 7, 9 … then 2, 4,6, 8, … (interleaved mode), in this case slice timing is done first otherwise the realignment would move voxels possibly coming from different slices, i.e. acquired at different time (max TR/2), onto the same plane and the slice timing would then be wrong.

20 Realignment: Why? Subjects will always move in the scanner. Subjects will always move in the scanner. movement may be related to the tasks performed. movement may be related to the tasks performed. When identifying areas in the brain that appear activated due to the subject performing a task, it may not be possible to discount artefacts that have arisen due to motion. When identifying areas in the brain that appear activated due to the subject performing a task, it may not be possible to discount artefacts that have arisen due to motion. The sensitivity of the analysis is determined by the amount of residual noise in the image series, so movement that is unrelated to the task will add to this noise and reduce the sensitivity. The sensitivity of the analysis is determined by the amount of residual noise in the image series, so movement that is unrelated to the task will add to this noise and reduce the sensitivity.

21 Normalization: Why? Inter-subject averaging Inter-subject averaging extrapolate findings to the population as a whole extrapolate findings to the population as a whole increase activation signal above that obtained from single subject increase activation signal above that obtained from single subject increase number of possible degrees of freedom allowed in statistical model increase number of possible degrees of freedom allowed in statistical model Enable reporting of activations as co-ordinates within a known standard space Enable reporting of activations as co-ordinates within a known standard space e.g. MNI e.g. MNI

22 Smoothing: Why? Smoothing is used for 3 reasons: Potentially increase signal to noise (Depends on relative size of smoothing kernel and effects to be detected - Matched filter theorem: smoothing kernel = expected signal - Practically FWHM 3· voxel size ; May consider varying kernel size if interested in different brain regions (e.g. hippocampus -vs- parietal cortex)) Potentially increase signal to noise (Depends on relative size of smoothing kernel and effects to be detected - Matched filter theorem: smoothing kernel = expected signal - Practically FWHM 3· voxel size ; May consider varying kernel size if interested in different brain regions (e.g. hippocampus -vs- parietal cortex)) Inter-subject averaging. Inter-subject averaging. Increase validity of SPM. Increase validity of SPM. In SPM, smoothing is a convolution with a Gaussian kernel, and the Kernel is defined in terms of FWHM (full width at half maximum).

23 Computational Neuro- anatomy: practice

24 Single subject processing Protocol – Imaging parameters spm_data_set\Auditory_data_block_design Each acquisition consisted of 64 contiguous slices (3mm 3 ). Acquisition took 6.05s, with the scan to scan repeat time (TR) set to 7s. 96 acquisitions were made (TR=7s) from a single subject, in blocks of 6, giving 16 42s blocks. The condition for successive blocks alternated between rest and auditory stimulation, starting with rest. Auditory stimulation was bi-syllabic words presented binaurally at a rate of 60 per minute. The functional data starts at acquisition 4, image fM00223_004.

25 2. Slice timing

26 Session – Specify files --> select all functional images -- > 96 files Session – Specify files --> select all functional images -- > 96 files Number of slices? Number of slices? TR? TR? TA? TA? Slice order? Slice order? Reference slice? Reference slice? OUTPUT: a images.. afM00XX.img /.hdr OUTPUT: a images.. afM00XX.img /.hdr [64:-2:1, 64-1:-2:1] 2

27 3. Realignment

28 New session Select the slice timed images afM00XX.img For each session during the scanning, create a session !!

29 Creates the mean of all realigned EPI images – you do not have to write the data, parameters (which comes from the estimate) are kept in the header

30 created in your directory - the mean image -a spm.ps -.txt file = translation and rotation parameters

31 4. Normalize We could normalize on the EPI template but since we have the subjects anatomical scan, we can use it to normalize on the T1 template. We could normalize on the EPI template but since we have the subjects anatomical scan, we can use it to normalize on the T1 template. T1 Mean image T1 like EPI MNI T1 template compute apply EPI Realign and normalize Coregistration

32 4a. Coregister

33 Target image? Target image? mean EPI – this doesnt change Source image? Source image? High resolution T1 (nsM00223_002.img) We want this to be like the EPI Other images? Other images? nothing here Reslice option interpolation Reslice option interpolation trilinear is fine, could improve using b-spline (come back to this latter)

34 4a. Coregistrer Output: Output: rnsM00223_002.img

35 4b. Normalization

36 4b. Normalize Data New Subject Data New Subject Source Image rns...img (compute from the coregistered T1) Images to write all the af…img (normalize all EPI images) we can add the mean.img we can add the mean.img we can add the rns…img (normalize the T1) we can add the rns…img (normalize the T1) Estimation options: Estimation options: Template image SPM5\Template\T1.nii Writing options: interpolation Writing options: interpolation

37 4b. Normlization Output: Output: wa…img wa…img

38 4c. Check the data Check Reg Check Reg Several images at once Several images at once

39 4c. Check the data Select Select wmean…img wmean…img T1 template T1 template

40 5. Smoothing Select the normalized images Select the normalized images Smooth at 6 mm Smooth at 6 mm Output: s…img Output: s…img

41 A word on interpolation

42 Writing down the images What is interpolation? What is interpolation? Interpolation is a process for estimating values that lie between known data points Interpolation is a process for estimating values that lie between known data points exit spm and open/run the script called interp_ex.m exit spm and open/run the script called interp_ex.m z is a 2D matrix and one interpolates between the points defined by z – there are many options, here we use nearest neighbor, bilinear, and bicubic interpolation methods – observe the difference in the results

43 5. Writing down the images

44 Writing down the images Why is it better to compute (estimate) everything 1 st and then apply? Why is it better to compute (estimate) everything 1 st and then apply? While one can compute and write the realigned data and compute and write the normalized one, I suggest here to estimate the realignment parameters and then normalize. The realignment only uses affine transformation (translations and rotations in x, y,z) and this info is stored in the header. Then we compute how to normalize an image (translation, rotation, zoom, shear and non-linear warping) and multiply the two transformation matrix – as a result a voxel (and its contend) is cut only 1 time vs. twice. While one can compute and write the realigned data and compute and write the normalized one, I suggest here to estimate the realignment parameters and then normalize. The realignment only uses affine transformation (translations and rotations in x, y,z) and this info is stored in the header. Then we compute how to normalize an image (translation, rotation, zoom, shear and non-linear warping) and multiply the two transformation matrix – as a result a voxel (and its contend) is cut only 1 time vs. twice.

45 Statistical modelling: theory

46 Slice timing and Realignment smoothing normalisation General Linear Model model fitting statistic image corrected p-values Design matrix Anatomical reference kernel Statistical Parametric Map Multiple comparisons correction fMRI time-series Parameter estimates

47 General Linear Model Regression, t-tests, ANOVAs, AnCovas … are all instances of the same linear modelling. Regression, t-tests, ANOVAs, AnCovas … are all instances of the same linear modelling. Regression: - simple: searching to explain the data (y) by a single predictor (x) such as y = βx + b – multiple: searching to explain the data (y) by several predictors (x 1, x 2, …) such as y = β 1 x 1 + β 2 x 2 + b Regression: - simple: searching to explain the data (y) by a single predictor (x) such as y = βx + b – multiple: searching to explain the data (y) by several predictors (x 1, x 2, …) such as y = β 1 x 1 + β 2 x 2 + b Linear models can be solved by the least squares method, i.e. one looks for a coefficient (Beta) that minimizes the error, i.e. the difference between the model (βx+b) and the data (y)

48 General Linear Model Dummy coding: Dummy coding: Instead of a continuous variable, we have categorical variables Instead of a continuous variable, we have categorical variables for each data point (y) we have a 2 groups, i.e. 1 predictor (x) regarding the group that we code like and we still use the equation y = βx + b ( = t-test) for each data point (y) we have a 2 groups, i.e. 1 predictor (x) regarding the group that we code like and we still use the equation y = βx + b ( = t-test) or we can have several groups/conditions (x1 = , x2 = , x1x2= ) such as y = β 1 x 1 + β 2 x 2 + β 12 x 1 x 2 b (ANOVA) or we can have several groups/conditions (x1 = , x2 = , x1x2= ) such as y = β 1 x 1 + β 2 x 2 + β 12 x 1 x 2 b (ANOVA)

49 General Linear Model Using a matrix notation we can write any models like Using a matrix notation we can write any models like Y = Xβ + e Y = Xβ + e Y a vector for each data point, Y a vector for each data point, X the design matrix where each column is a vector representing groups/conditions/continuous predictor X the design matrix where each column is a vector representing groups/conditions/continuous predictor β a vector (length = nb of column of X) of the coefficients to apply on X in order the minimize e the error (what is not modeled/explained) β a vector (length = nb of column of X) of the coefficients to apply on X in order the minimize e the error (what is not modeled/explained) Matrix algebra offers a unique solution for all models: Matrix algebra offers a unique solution for all models: β = (X T X) -1 X T Y β = (X T X) -1 X T Y using pseudoinverse in matlab: betas = pinv(X*X)*X*Y using pseudoinverse in matlab: betas = pinv(X*X)*X*Y

50

51 General Linear Model Exercise 1: multiple regression with 4 covariates Exercise 1: multiple regression with 4 covariates Load the data called reg_eg.mat: load ('reg_eg') Load the data called reg_eg.mat: load ('reg_eg') Y = reg_eg(:,1); X = reg_eg(:,2:6); imagesc(X); X Y = reg_eg(:,1); X = reg_eg(:,2:6); imagesc(X); X Y=X*B+e B = pinv(X'*X)*X'*Y; Yhat = X*B; Y=X*B+e B = pinv(X'*X)*X'*Y; Yhat = X*B; plot(Y); hold on; plot(Yhat,'r') plot(Y); hold on; plot(Yhat,'r') ss_total = norm(Y - mean(Y)).^2; ss_effect = norm(Yhat - mean(Yhat)).^2; ss_error = ss_total – ss_effect; ss_total = norm(Y - mean(Y)).^2; ss_effect = norm(Yhat - mean(Yhat)).^2; ss_error = ss_total – ss_effect; Rsquare = ss_effect/ss_total Rsquare = ss_effect/ss_total f = (ss_effect/(rank(X)-1)) / (ss_error/(length(Y)-rank(X))) f = (ss_effect/(rank(X)-1)) / (ss_error/(length(Y)-rank(X)))

52 General Linear Model Exercise 2: ANOVA with 4 groups Exercise 2: ANOVA with 4 groups Clear all; close all; clc; load(anova_eg); Clear all; close all; clc; load(anova_eg); Y = anova_eg(:,1); X = anova_eg(:,2:6); imagesc(X); Y = anova_eg(:,1); X = anova_eg(:,2:6); imagesc(X); Y=X*B+e B = pinv(X'*X)*X'*Y; Yhat = X*B; Y=X*B+e B = pinv(X'*X)*X'*Y; Yhat = X*B; plot(Y); hold on; plot(Yhat,'r') plot(Y); hold on; plot(Yhat,'r') ss_total = norm(Y - mean(Y)).^2; ss_effect = norm(Yhat - mean(Yhat)).^2; ss_error = ss_total – ss_effect; ss_total = norm(Y - mean(Y)).^2; ss_effect = norm(Yhat - mean(Yhat)).^2; ss_error = ss_total – ss_effect; Rsquare = ss_effect/ss_total Rsquare = ss_effect/ss_total f = (ss_effect/(rank(X)-1)) / (ss_error/(length(Y)-rank(X))) f = (ss_effect/(rank(X)-1)) / (ss_error/(length(Y)-rank(X))) EVERY ANALYSIS DEPENDS ON X AND THE DOF EVERY ANALYSIS DEPENDS ON X AND THE DOF

53 General Linear Model Application to fMRI: massive univariate approach For each voxel of the brain we have a time series (data points Y) and we know what happened during this time period (experimental conditions X). For each voxel of the brain we have a time series (data points Y) and we know what happened during this time period (experimental conditions X). We also know that after a stimulus or a response, the blood flow increases peaking at 5sec then decreases (hemodynamic response) We also know that after a stimulus or a response, the blood flow increases peaking at 5sec then decreases (hemodynamic response) We thus model the data such as Y(t) = [u(t) h(τ)] β + e(t) where u represent the occurance of a stimulus or a response and h(τ) the hemodynamic response with τ the peristimulus time We thus model the data such as Y(t) = [u(t) h(τ)] β + e(t) where u represent the occurance of a stimulus or a response and h(τ) the hemodynamic response with τ the peristimulus time

54 General linear convolution model X(y) = u(t) h(τ) X(y) = u(t) h(τ) u = [ ]; h = spm_hrf(1) X = conv(u,h);

55 General linear convolution model y(t) = X(t)β + e(t) y(t) = X(t)β + e(t) X as now two conditions u1 and u2 … X as now two conditions u1 and u2 … And we search the beta parameters to fit Y And we search the beta parameters to fit Y Y X

56 General linear convolution model = β1 + β2 + u + e

57 General linear convolution model = β1 β2 + e u

58 fMRI characteristics which may increase error Gain & scanner drift Gain & scanner drift Variations of signal amplitude for each new brain volume and between scanning sessions Proportional & Grand-mean scaling of data High-pass filtering in design matrix Variations of signal amplitude for each new brain volume and between scanning sessions Proportional & Grand-mean scaling of data High-pass filtering in design matrix Serial temporal correlations Serial temporal correlations breathing, heartbeat: activity at one time point correlates with other times adjust error term breathing, heartbeat: activity at one time point correlates with other times adjust error term Temporal and shape uncertainty & slice timing delays: Temporal and shape uncertainty & slice timing delays: model derivatives of HRF model derivatives of HRF

59 Single subject stat modelling: practice

60 5. Single subject stats

61 Directory select a directory to store your data Directory select a directory to store your data Timing parameters Timing parameters Unit for the design: scan Unit for the design: scan Interscan interval: 7 (TR) Interscan interval: 7 (TR) Microtime onset: 3 Microtime onset: 3 (TA = 6.05 and we slice timed on the middle slice) (TA = 6.05 and we slice timed on the middle slice) Data and Design New Subject/Session Data and Design New Subject/Session Scans: images swaf…4.img to waf…99.img Scans: images swaf…4.img to waf…99.img

62 5. Single subject stats Data and Design New Subject/Session Data and Design New Subject/Session Scans: start at 4 to avoid artefacts.. (you should always discard initial scans) = 96 files Scans: start at 4 to avoid artefacts.. (you should always discard initial scans) = 96 files Conditions New condition Conditions New condition Name: activation Name: activation Onsets: Onsets: 6:12:84 (= every 12 scans from 6 to 84) Durations: 6 Multiple regressors: select the realignment parameters (.txt file) The rest is implicitly modelled (goes into the mean)

63 5. Single subject stats Activations Activations Movements Movements Mean Mean Model summary Model summary

64 5. Single subject stats

65

66

67

68

69

70

71 Contrast estimate Contrast estimate (effect size) (effect size) Fitted response Fitted response (model or Y-error)

72 5. Single subject stats SPM outputs SPM outputs beta000X.img /hdr: betas values in each voxel beta000X.img /hdr: betas values in each voxel con000X.img /hdr: contrast (combination of betas) con000X.img /hdr: contrast (combination of betas) spmT000X.ing /hdr: statistics image spmT000X.ing /hdr: statistics image Also Also mask.img / hdr: area analyzed by SPM (binary image) mask.img / hdr: area analyzed by SPM (binary image) RessMS: residual mean square RessMS: residual mean square RPV: Resels-Per-Voxel image; image of roughness RPV: Resels-Per-Voxel image; image of roughness

73 Multiple comparisons correction: theory

74 What Problem? 4-Dimensional Data 4-Dimensional Data 1,000 multivariate observations, each with 100,000 elements 1,000 multivariate observations, each with 100,000 elements 100,000 time series, each with 1,000 observations 100,000 time series, each with 1,000 observations Massively Univariate Approach Massively Univariate Approach 100,000 hypothesis tests 100,000 hypothesis tests Massive MCP! Massive MCP! 1,

75 Solutions for MCP Height Threshold Height Threshold Familywise Error Rate (FWER) Familywise Error Rate (FWER) Chance of any false positives; Controlled by Bonferroni & Random Field Methods Chance of any false positives; Controlled by Bonferroni & Random Field Methods False Discovery Rate (FDR) False Discovery Rate (FDR) Proportion of false positives among rejected tests Proportion of false positives among rejected tests Set level statistic Set level statistic Bayes Statistics Bayes Statistics

76 From single univariate to massive univariate Univariate stat Functional neuroimaging 1 observed data Many voxels 1 statistical value Family of statistical values Type 1 error rate (chance to be wrong rejecting H0) Family-wise error rate Null hypothesis Family-wise null hypothesis

77 Height Threshold Choose locations where a test statistic Z (T, 2,...) is large to threshold the image of Z at a height z Choose locations where a test statistic Z (T, 2,...) is large to threshold the image of Z at a height z The problem is how to choose this threshold z to exclude false positives with a high probability (e.g. 0.95)? The problem is how to choose this threshold z to exclude false positives with a high probability (e.g. 0.95)? To control for family wise error on must take into account the nb of tests

78 Bonferroni Z-scores ; alpha = 5% Z-scores ; alpha = 5% alpha corrected = ; z-score = 4.42 alpha corrected = ; z-score = voxels

79 Bonferroni Z-scores ; alpha = 5% Z-scores ; alpha = 5% 2D homogeneous smoothing – 100 independent observations 2D homogeneous smoothing – 100 independent observations alpha corrected =.0005 ; z-score = 3.29 alpha corrected =.0005 ; z-score = voxels

80 Random Field Theory Z-scores ; alpha = 5% Z-scores ; alpha = 5% Gaussian kernel smoothing – Gaussian kernel smoothing – How many independent observations ? How many independent observations ? 100 voxels

81 Random Field Theory RFT relies on theoretical results for smooth statistical maps (hence the need for smoothing), allowing to find a threshold in a set of data where its not easy to find the number of independent variables. Uses the expected Euler characteristic (EC density) RFT relies on theoretical results for smooth statistical maps (hence the need for smoothing), allowing to find a threshold in a set of data where its not easy to find the number of independent variables. Uses the expected Euler characteristic (EC density) 1 Estimation of the smoothness = number of resel (resolution element) = f(nb voxels, FWHM) 1 Estimation of the smoothness = number of resel (resolution element) = f(nb voxels, FWHM) 2 ! expected Euler characteristic = number of clusters above the threshold 2 ! expected Euler characteristic = number of clusters above the threshold 3 Calculation of the threshold 3 Calculation of the threshold

82 Random Field Theory The Euler characterisitc can be seen as the number of blobs in an image after thresholding The Euler characterisitc can be seen as the number of blobs in an image after thresholding At high threshold, EC = 0 or 1 per resel: E[EC] p FWE At high threshold, EC = 0 or 1 per resel: E[EC] p FWE E[EC] = R · (4 log e 2) · (2 ) 2/3 · Z t · e 1/2 Z 2 t for a 2D image, more complicated in 3D

83 Random Field Theory For 100 resels, the equation gives E[EC] = for a threshold Z of 3.8, i.e. the probability of getting one or more blobs where Z is greater than 3.8 is For 100 resels, the equation gives E[EC] = for a threshold Z of 3.8, i.e. the probability of getting one or more blobs where Z is greater than 3.8 is voxels If the resel size is much larger than the voxel size then E[EC] only depends on the nb of resels othersize it also depends on the volume, surface and diameter of the search area (i.e. shape and volume matter) If the resel size is much larger than the voxel size then E[EC] only depends on the nb of resels othersize it also depends on the volume, surface and diameter of the search area (i.e. shape and volume matter)

84 False discovery Rate Whereas family wise approach corrects for any false positive, the FDR approach aim at correcting among positive results only. Whereas family wise approach corrects for any false positive, the FDR approach aim at correcting among positive results only. 1. Run an analysis with alpha = x% 2. Sort the resulting data 3. Threshold the resulting data to remove the false positives (theoretical problem: threshold any voxels whatever their spatial positions)

85 False discovery Rate Signal+Noise FEW correction FDR correction

86 Levels of inference: theory

87 Levels of inference 3 levels of inference can be considered: 3 levels of inference can be considered: - Voxel level (prob associated at each voxel) - Cluster level (prob associated to a set of voxels) - Set level (prob associated to a set of clusters) The 3 levels are nested and based on a single probability of obtaining c or more clusters (set level) with k or more voxels (cluster level) above a threshold u (voxel level): P w (u,k,c) The 3 levels are nested and based on a single probability of obtaining c or more clusters (set level) with k or more voxels (cluster level) above a threshold u (voxel level): P w (u,k,c) Both voxel and cluster levels need to address the multiple comparison problem. If the activated region is predicted in advance, the use of corrected P values is unnecessary and inappropriately conservative – a correction for the number of predicted regions (Bonferroni) is enough Both voxel and cluster levels need to address the multiple comparison problem. If the activated region is predicted in advance, the use of corrected P values is unnecessary and inappropriately conservative – a correction for the number of predicted regions (Bonferroni) is enough

88 Levels of inference Set level: we can reject H0 for an omnibus test, i.e. there are some significant clusters of activation in the brain. Set level: we can reject H0 for an omnibus test, i.e. there are some significant clusters of activation in the brain. Cluster level: we can reject H0 for an area of a size k, i.e. a cluster of activated voxels is likely to be true for a given spatial extend. Cluster level: we can reject H0 for an area of a size k, i.e. a cluster of activated voxels is likely to be true for a given spatial extend. Voxel level: we can reject H0 at each voxel, i.e. a voxel is activated if exceeding a given threshold Voxel level: we can reject H0 at each voxel, i.e. a voxel is activated if exceeding a given threshold

89 Inference in practice

90 Levels of inference and MCC

91 From single subjects to random effects: theory

92 From single subjects to random effects Why random effect (also called pseudo-mixed)? Why random effect (also called pseudo-mixed)? Basic stats: compute the mean for each condition for each subjects and do the stats on these means (inter-subject variance) Basic stats: compute the mean for each condition for each subjects and do the stats on these means (inter-subject variance) Random effect: compute the beta parameters for each condition (intra-subject variance) and do the stats on these beta parameter (inter-subject variance) Random effect: compute the beta parameters for each condition (intra-subject variance) and do the stats on these beta parameter (inter-subject variance)

93 From single subjects to random effects: practice

94 Face data set Repetition priming experiment performed using event-related fMRI 2x2 factorial study with factors `fame and `repetition' where famous and non-famous faces were presented twice against a checkerboard baseline Four event-types of interest; first and second presentations of famous and non-famous faces, which are denoted N1, N2, F1 and F2 TR=2s TA = 1.92s 24 descending slices (64x64 3x3mm2) 3mm thick with a 1.5mm gap

95 Single subject modelling Here we consider a more sophisticated model in which we use the hrf and its derivatives. Here we consider a more sophisticated model in which we use the hrf and its derivatives. In the folder, spm_data_set\Face_data_event_related_design\ single_subject\Preprocessed, you can find the smoothed, normalized, realigned, and slice timed images In the folder, spm_data_set\Face_data_event_related_design\ single_subject\Preprocessed, you can find the smoothed, normalized, realigned, and slice timed images Try to model by yourself Try to model by yourself

96 Single subject modelling Stimulus Onsets Times sots.mat Cond 1 to 4 are F1, F2, N1, N2 with the respective onset time sot{1} sot{2} sor{3} and sot{4}

97 Single subject modelling Directory stats Directory stats Timing parameters: Units (sec), Interscan interval (2), Microtime resolution (24), Microtime onset (12) Timing parameters: Units (sec), Interscan interval (2), Microtime resolution (24), Microtime onset (12) Data and design New Subject/Session: Scan (all EPI swa…img), Condition create 4 conditions, each time enter name and sot (F1 sot{1} F2 sot {2} N1 sot{3} N2 sot{4}), Multiple regressors: enter the.txt file from realignment Data and design New Subject/Session: Scan (all EPI swa…img), Condition create 4 conditions, each time enter name and sot (F1 sot{1} F2 sot {2} N1 sot{3} N2 sot{4}), Multiple regressors: enter the.txt file from realignment Factorial Design create 2 factors (famous, level =2, and repetition, level =2) Factorial Design create 2 factors (famous, level =2, and repetition, level =2) Basis function: Canonical HRF, model derivatives (time and dispersion) Basis function: Canonical HRF, model derivatives (time and dispersion)

98 Single subject modelling Result select the SPM.mat Result select the SPM.mat Because we specified the factorial design, the variance has been partitioned in a specific way and contrasts are already there Because we specified the factorial design, the variance has been partitioned in a specific way and contrasts are already there Select contrast nb 5 Select contrast nb 5

99 Single subject modelling

100

101 Define a new F contrast called effect of interest Define a new F contrast called effect of interest (any effect of any regressor and combinations) ok done

102 Single subject modelling Plot contrast estimates and 90% CI select effect of interest Plot contrast estimates and 90% CI select effect of interest F1F2N1 N2

103 Single subject modelling Plot event-related response / fitted response Plot event-related response / fitted response

104 Single subject modelling In the matlab workspace In the matlab workspace Y = fitted response, y = adjusted response Y = fitted response, y = adjusted response Exercise: plot for 4 fitted responses on 1 figure Exercise: plot for 4 fitted responses on 1 figure Each time save using e.g. N1 = Y; then N2 = Y;.. then plot(N1); hold on; plot(N2,--) … Each time save using e.g. N1 = Y; then N2 = Y;.. then plot(N1); hold on; plot(N2,--) …

105 Multi-subjects All data were analyzed and are stored in the folder Face_data_event_related_design\multisubjects\cons_informed We have all the con images from 12 subjects, data were modelled with Famous and Non famous faces (2 conditions only) with the hrf and the two derivatives (12*6 files)

106 Random effects

107 Analyze Faces vs baseline Analyze Faces vs baseline For each subject we have the con images for the hrf, the 1 st derivative and 2 nd derivative For each subject we have the con images for the hrf, the 1 st derivative and 2 nd derivative A full analysis will thus be a repeated measure ANOVA (we have 3 measures per subject) A full analysis will thus be a repeated measure ANOVA (we have 3 measures per subject) SPM allows to correct for non-sphericity, i.e. it will take into account the correlation between regressors – here regressors are by inception correlated SPM allows to correct for non-sphericity, i.e. it will take into account the correlation between regressors – here regressors are by inception correlated

108 Random effects Design Full factorial create a new factor Design Full factorial create a new factor Name: Basis functions Name: Basis functions Levels: Levels: Independence: Independence: Specify cells create 3 cells, 1 per level of the factor (cell 1 = con 3 to 14 / cell 2 = 15 to 26 / cell 3 = 27 to 38) Specify cells create 3 cells, 1 per level of the factor (cell 1 = con 3 to 14 / cell 2 = 15 to 26 / cell 3 = 27 to 38) Run Run Estimate Estimate 3 No

109 Random effects In the contrast manager, enter a new F contrast: effect of interest (eye(3)) In the contrast manager, enter a new F contrast: effect of interest (eye(3)) Evaluate and look at the result with a correction Evaluate and look at the result with a correction

110 Random effects

111 In the contrast manager, enter a new T contrast for the hrf only: In the contrast manager, enter a new T contrast for the hrf only: Evaluate and look at the result with a correction Evaluate and look at the result with a correction

112 Random effects Select an image to display (e.g. SPM /canonical/T1) Add blobs select the SPM.mat and the 2 contrasts

113 Random effects The display is surfable The display is surfable MNI and voxel coordinates available MNI and voxel coordinates available Voxel value Voxel value }

114 Random effects F Contrast [0 1 0] F Contrast [0 1 0] Time dispersion (+/- 2 sec) Time dispersion (+/- 2 sec) F Contrast [0 0 1 ] F Contrast [0 0 1 ] Duration dispersion Duration dispersion Earlier response (- = delayed) Narrower response ( - = wider)

115 Random effect Paired t-test Paired t-test 12 pairs 12 pairs 3 vs 39 3 vs 39 4 vs 40 4 vs 40 … Independence: No Independence: No Variance: equal Variance: equal

116 Visualizing the data SPM and other software

117 Rendering with SPM

118 Segmentation

119 Segmentation Input coregistered image in \spm_data_set\ Face_data_event_related_de sign\single_subject\Structur al rs …img Input coregistered image in \spm_data_set\ Face_data_event_related_de sign\single_subject\Structur al rs …img Output Output grey / white matter tissues grey / white matter tissues bias corrected image bias corrected image affine normalization parameters (and inverse) affine normalization parameters (and inverse)

120 Rendering with SPM Select the grey and white matter (c1 and c2) images and save the rendering

121 Rendering with SPM Select the SPM.mat from the individual subject and then 2 sets / contrasts

122 Rendering in SPM For random effects analysis you can use the render in SPM/render which is in the MNI space For random effects analysis you can use the render in SPM/render which is in the MNI space For individual subjects, best is to not normalize and make a render.. Results are better with smaller voxel size (i.e. you could interpolate the 1mm 3 ) For individual subjects, best is to not normalize and make a render.. Results are better with smaller voxel size (i.e. you could interpolate the 1mm 3 ) Overall, better to use slices / section – poor rendering capabilities although new plug in are appearing.. Overall, better to use slices / section – poor rendering capabilities although new plug in are appearing..

123 Surface visualization with Caret

124 What does it do? Surface visualization Surface visualization Display experimental data (activation maps, connectivity patterns, etc) Display experimental data (activation maps, connectivity patterns, etc) View data in flexible combinations (cortical surface, flat maps, contours, outlines, etc) View data in flexible combinations (cortical surface, flat maps, contours, outlines, etc) Surface manipulation and data analysis Surface manipulation and data analysis generate inflated maps, spherical maps, and flat maps generate inflated maps, spherical maps, and flat maps probabilistic maps, surface based analysis probabilistic maps, surface based analysis On-line search for fMRI maps, comparisons, etc.. On-line search for fMRI maps, comparisons, etc..

125 The Software my experience is that it works better with linux / mac but windows does the job my experience is that it works better with linux / mac but windows does the job From David Van Essen lab – Washingtom University in St Louis – School of Medicine – Dpt of Anatomy & Neurobiology From David Van Essen lab – Washingtom University in St Louis – School of Medicine – Dpt of Anatomy & Neurobiology Most famous paper from this guy? Most famous paper from this guy? Felleman, D.J. and Van Essen, D.C. (1991) Distributed hierarchical processing in primate visual cortex, Cerebral Cortex, 1: Felleman, D.J. and Van Essen, D.C. (1991) Distributed hierarchical processing in primate visual cortex, Cerebral Cortex, 1: 1-47.

126 Caret File Open Spec File … File Open Spec File … In Caret\ HUMAN.COLIN.ATLAS\ LEFT_HEM\ …spec In Caret\ HUMAN.COLIN.ATLAS\ LEFT_HEM\ …spec

127 Caret

128 Caret

129 Caret Attributes Map Volume(s) to Surface(s) … leave the Metric option ticked and press next Attributes Map Volume(s) to Surface(s) … leave the Metric option ticked and press next

130 Caret Add Volumes From Disk select the spmT_0005.hdr file from the single subject analysis (Face data set) Add Volumes From Disk select the spmT_0005.hdr file from the single subject analysis (Face data set)

131 Caret Map to Caret Map to Caret

132 Caret Chose your algorithm Average Voxel Neighbor Box Size 1 Next.. Chose your algorithm Average Voxel Neighbor Box Size 1 Next..

133 Caret

134 Caret

135 Caret

136 Individual visualization with Anatomist

137 Brain Visa / Anatomist Caret as well as BrainVisa / Anatomist works better with clean data … Caret as well as BrainVisa / Anatomist works better with clean data … 1 st – data are usual better handled with isotropic voxels (same dimensions in x, y, z) better acquire isotropic voxels, at least for the T1 1 st – data are usual better handled with isotropic voxels (same dimensions in x, y, z) better acquire isotropic voxels, at least for the T1 2 nd – there is usual a bias in one direction (often Z), i.e. for a given concentration of tissue, the gray scale is slightly different 2 nd – there is usual a bias in one direction (often Z), i.e. for a given concentration of tissue, the gray scale is slightly different Solution: correct and resample Solution: correct and resample My favourite tools for this: FSL My favourite tools for this: FSL

138 Quick Tour into FSL Depending on what you want to do Depending on what you want to do ApplyXFM reinterpolation using the identity matrix ApplyXFM reinterpolation using the identity matrix FSL brings the interface BET / SUSAN / FSL View FSL brings the interface BET / SUSAN / FSL View

139 Back to BrainVisa / Anatomist

140 Back to Anatomist

141 Anatomist

142 Resources

143 IdoImaging: IdoImaging: SPM: SPM: Caret: Caret: FSL: FSL: BrainVisa / Anatomist: BrainVisa / Anatomist: Cambridge imaging wiki: cbu.cam.ac.uk/imaging/CbuImaging Cambridge imaging wiki: cbu.cam.ac.uk/imaging/CbuImaginghttp://imaging.mrc- cbu.cam.ac.uk/imaging/CbuImaginghttp://imaging.mrc- cbu.cam.ac.uk/imaging/CbuImaging Russ Poldrackswiki on Matlab: Russ Poldrackswiki on Matlab: Digital signal processing in general: Digital signal processing in general: Maths in general: Maths in general:


Download ppt "SINPASE fMRI course Dr Cyril Pernet, University of Edinburgh Dr Gordon Waiter, University of Aberdeen."

Similar presentations


Ads by Google