GLM for fMRI data analysis Lab Exercise 1 March 19, 2015 Medical - - PowerPoint PPT Presentation

glm for fmri data analysis
SMART_READER_LITE
LIVE PREVIEW

GLM for fMRI data analysis Lab Exercise 1 March 19, 2015 Medical - - PowerPoint PPT Presentation

AUDIO 1st level Getting Started The Batch Interface GLM for fMRI data analysis Lab Exercise 1 March 19, 2015 Medical Image Processing Lab Medical Image Processing Lab GLM for fMRI data analysis AUDIO 1st level Getting Started The Batch


slide-1
SLIDE 1

Getting Started AUDIO 1st level The Batch Interface

GLM for fMRI data analysis

Lab Exercise 1

March 19, 2015

Medical Image Processing Lab

Medical Image Processing Lab GLM for fMRI data analysis

slide-2
SLIDE 2

Getting Started AUDIO 1st level The Batch Interface

Outline

1 Getting Started 2 AUDIO 1st level

Preprocessing Model Specification, Review and Estimation Inference and Results

3 The Batch Interface 2 / 26

slide-3
SLIDE 3

Getting Started AUDIO 1st level The Batch Interface

Getting the Software and Data

  • get the SPM software package and the two data sets from

http://miplab.epfl.ch/teaching/micro-513/download/ or from the the direct links below

  • SPM toolkit
  • Dataset (single subject)
  • For this practical, three files are required:

spm8.zip glm data1.zip

3 / 26

slide-4
SLIDE 4

Getting Started AUDIO 1st level The Batch Interface

fMRI Data Set

AUDIO single subject auditory data, 16 blocks, TR=7s, 1st level analysis, SPM8 manual Chapter 28, available at http://www.fil.ion.ucl.ac.uk/spm/data/auditory/

4 / 26

slide-5
SLIDE 5

Getting Started AUDIO 1st level The Batch Interface

Medical Imaging Datatypes

DICOM (Digital Imaging and Communications in Medicine)

  • file name suffix .dcm
  • one file per slice
  • meta information stored in every file
  • vendor-specific meta-information
  • standard for archiving in hospital environment
  • incompatible with SPM8

ANALYZE

  • file name suffix header/matrix .hdr,.img
  • header contains voxel-to-world mapping
  • matrix contains the raw data matrix
  • compatible with SPM8

NIfTI (Neuroimaging Informatics Technology Initiative)

  • file name suffix .nii
  • matrix and voxel-to-world mapping in one file
  • standard format of SPM8

5 / 26

slide-6
SLIDE 6

Getting Started AUDIO 1st level The Batch Interface

Start SPM8

  • extract glm spm8.zip into /tmp
  • verify that there is a folder /tmp/spm8
  • add SPM8 to the Matlab path and

start it

% add SPM8 path to Matlab path v a r i a b l e addpath ( genpath ( ' /tmp/spm8 ' ) ) ; % s t a r t SPM8 g r a p h i c a l u s e r i n t e r f a c e spm

  • choose fMRI
  • alternatively, start fMRI mode directly

after adding path

% s t a r t d i r e c t l y i n fMRI mode spm( ' fMRI ' ) ;

6 / 26

slide-7
SLIDE 7

Getting Started AUDIO 1st level The Batch Interface

SPM8 Interface

  • access the most used

functions

  • status messages, progress

bar, selections, etc.

  • view results, images, etc.

Figure : SPM8 “Menu” (top-left), “Interactive” (bottom-left) and “Graphics” (right) window.

7 / 26

slide-8
SLIDE 8

Getting Started AUDIO 1st level The Batch Interface

File Selection Window

  • one click to select/deselect files
  • Ed button allows manual change or entering
  • f path
  • Done button confirms selection
  • keeps history of previously visited paths
  • regexp-like filtering
  • works also in scripts, e.g. files=spm select;
  • current Matlab path is the default path

Figure : SPM select dialog.

8 / 26

slide-9
SLIDE 9

Getting Started AUDIO 1st level The Batch Interface

Inspect the Data

AUDIO see SPM8 manual, chapter 28, for detailed tutorial using this data set

  • Decompress glm data1.zip into /tmp.
  • Verify that there is a folder

/tmp/GLMLAB/AUDIO

  • Browse the files, there is one folder containing

the structural image (i.e. sM00223) and one folder for the functional volumes (i.e. fM00223).

  • start the check registration tool from

command line

% check the image r e g i s t r a t i o n q u a l i t y s p m c h e c k r e g i s t r a t i o n

  • or click Check Reg button
  • choose one or more images, e.g. one functional

and the structural

Figure : Functional and structural images before co-registration.

9 / 26

slide-10
SLIDE 10

Getting Started AUDIO 1st level The Batch Interface Preprocessing

Headers, Pre-, and Suffixes

SPM functions modify the data in different ways

  • change affine world-to-voxel mapping stored in header *.hdr
  • write new file, often pre- or suffixed

Prefixes r* re-sliced and usually also realigned mean* mean image c1* gray matter c2* white matter c3* cerebro-spinal fluid m* bias-field corrected structural image w* warped (non-linearly transformed) image, e.g. into MNI s* spatially smoothed image Suffixes * seg sn.mat non-linear forward transformation from subject to MNI space * seg inv sn.mat non-linear reverse transformation from MNI to subject space

10 / 26

slide-11
SLIDE 11

Getting Started AUDIO 1st level The Batch Interface Preprocessing

Preprocessing Overview

Preprocessing Step Inputs Outputs Realign (Estimate & Reslice) Coregister (Estimate) Segmentation Normalise (Write) Smooth fM00223 *.{img,hdr} meanfM00223 004.{img,hdr} sM00223.{img,hdr} sM00223 004.{img,hdr} sM00223 seg sn.mat rfM00223 *.{img,hdr} wrfM00223 *.{img,hdr} rfM00223 *.{img,hdr} meanfM00223 004.{img,hdr} sM00223 002.hdr c{1,2,3}sM00223 002.{img,hdr} sM00223 002 seg sn.mat sM00223 002 seg inv sn.mat msM00223 002.{img,hdr} wmsM00223 002.{img,hdr} wrfM00223 *.{img,hdr} swrfM00223 *.{img,hdr}

11 / 26

slide-12
SLIDE 12

Getting Started AUDIO 1st level The Batch Interface Preprocessing

Spatial Normalization

Realignment

  • rigid-body transform (translation and rotation)
  • within modality
  • within subject

Co-registration

  • affine transform (translation, rotation and scaling)
  • across different modalities
  • within same or across subjects

Normalize

  • non-linear invertible transformation
  • usually to reference space, i.e. MNI

12 / 26

slide-13
SLIDE 13

Getting Started AUDIO 1st level The Batch Interface Preprocessing

1st Level Analysis

Dataset AUDIO /tmp/GLMLAB/AUDIO/

13 / 26

slide-14
SLIDE 14

Getting Started AUDIO 1st level The Batch Interface Preprocessing

Realignment of functional volumes

Perform realignment of the volumes of the time series to the mean image.

  • select Realign (Est & Res) from the

Realign pull-down menu

  • highlight data, select New Session , then

highlight the newly created Session option.

  • Select Specify Files and use the SPM file

selector to choose all of your functional images fM000*.img. There should be 96 files

  • Save the job file as eg. ./jobs/realign.m.
  • Press the ▶ button in the batch editor
  • headers will be rewritten
  • mean image meanfM00223 004.img will be

created

Figure : Rigid body realignment parameters.

14 / 26

slide-15
SLIDE 15

Getting Started AUDIO 1st level The Batch Interface Preprocessing

Co-registration

Co-register the structural to the mean functional image.

  • Select Coregister (Estimate) from the

Coregister pulldown menu.

  • Highlight Reference Image and then select

the mean fMRI scan from realignment meanfM00223 004.img.

  • Highlight Source Image and then select the

structural image sM00223 002.img.

  • Press the Save button (floppy disk symbol)

and save the job as coreg.m.

  • Then press the ▶ button.
  • Verify that alignment is correct.

Figure : Image coregistration result.

15 / 26

slide-16
SLIDE 16

Getting Started AUDIO 1st level The Batch Interface Preprocessing

Segmentation

Create tissue probability maps of gray matter (GM), white matter (WM) and cerebro-spinal fluid (CSF), and obtain normalization parameters to warp image into MNI space.

  • Press the Segment button.
  • Highlight the Data field and then select the

subjects registered anatomical image sM00223 002.img.

  • Highlight . Cerebro-Spinal Fluid and choose

Native Space .

  • Save the job file as segment.m, and then press

▶ button.

  • Open the tissue probability maps

c1sM00223 002.img (GM), c2sM00223 002.img (WM), c3sM00223 002.img (CSF), and msM00223 002.img (bias-field corrected T1).

Figure : Segmentation result.

16 / 26

slide-17
SLIDE 17

Getting Started AUDIO 1st level The Batch Interface Preprocessing

Normalized

Normalize volumes of time series into MNI space and re-slice to 3mm isotropic voxel size.

  • Select Normalise (Write) from the

Normalise pull-down menu.

  • Highlight Data , select New Subject .
  • Highlight Parameter File and select the

sM00223 0020 seg sn.mat.

  • Highlight images to write and select all of

the realigned functional images rfM000*.img and the structural image sM00223 0020.nii.

  • Open Writing Options , and change

Voxel sizes from [2 2 2] to [3 3 3].

  • Save the job as normalise.m and then press

the ▶ button.

Figure : wmsM00223 0020.img (top) and single subject T1 template /spm8/canonical/single subj T1.nii

17 / 26

slide-18
SLIDE 18

Getting Started AUDIO 1st level The Batch Interface Preprocessing

Smoothing

Apply spatial smoothing with isotropic Gaussian filter with 6mm FWHM.

  • Press Smooth button.
  • Select Images to Smooth and then select the

spatially normalised files created in the last section i.e. ^wrf.*

  • Highlight FWHM and change [8 8 8] to [6 6

6]. This will smooth the data by 6mm in each direction.

  • Save the job as smooth.m and press the ▶

button.

Figure : wrfM00223 004.img (top) and swrfM00223 004.img (bottom)

18 / 26

slide-19
SLIDE 19

Getting Started AUDIO 1st level The Batch Interface Model Specification, Review and Estimation

Model Specification

To avoid T1 effects in the initial scans of an fMRI time series we discarding the first cycle (12 scans, 04-15), leaving 84 scans, image files 16-99.

  • Press Specify 1st-level button.
  • Open the Timing parameters option.
  • Highlight Units for design and select Scans .
  • Highlight Inter-scan interval and enter “7”.
  • Highlight Data and Design and select New Subject/Session .
  • Open the newly created Subject/Session option.
  • Highlight Scans and use SPM’s file selector to choose the 84 smoothed,

normalised func- tional images ie. swrfM00223 {016..099}.img. (use ^s.*).

  • Highlight Conditions and select New condition .
  • Open the newly created Condition option. Highlight Name and enter “active”.

High-light Onsets and enter “6:12:84”. Highlight Durations and enter “6”.

  • Create a directory named results.
  • Highlight Directory and select the results directory you just created.
  • Save the job as specify.m and press the ▶ button.

19 / 26

slide-20
SLIDE 20

Getting Started AUDIO 1st level The Batch Interface Model Specification, Review and Estimation

Review

Y = Xβ + ε (1) Y: observed signal, X: regressors, β: parameter estimates, ε: zero-mean Gaussian noise

Figure : Design matrix. Figure : Orthogonality. Figure : Explore session 1.

20 / 26

slide-21
SLIDE 21

Getting Started AUDIO 1st level The Batch Interface Model Specification, Review and Estimation

Estimation

  • Press the Estimate button.
  • Highlight the Select SPM.mat option and then choose the SPM.mat file saved in

the classical subdirectory.

  • Save the job as estimate.m and press the ▶ button.
  • SPM will write a number of files into the selected directory including an SPM.mat

file.

21 / 26

slide-22
SLIDE 22

Getting Started AUDIO 1st level The Batch Interface Inference and Results

Contrast Prompt

  • Press Results .
  • Select the SPM.mat file created in the last

section.

  • This will invoke the contrast manager.
  • Select Define new contrast . One sided main

effects for the active condition (i.e., a

  • ne-sided t-test) can be specified as “1”

(active > rest) and “-1” (rest > active).

  • Select the contrast name e.g., “active > rest”.
  • Press Done .

Figure : Contrast prompt.

22 / 26

slide-23
SLIDE 23

Getting Started AUDIO 1st level The Batch Interface Inference and Results

Thresholded Statistical Parametric Map

  • Select “sections” from the overlays pulldown

menu.

  • Choose wmsM00223 002.img as background.

Figure : Statistical parametric map of AUDIO single subject activation (p<0.05, FWE).

23 / 26

slide-24
SLIDE 24

Getting Started AUDIO 1st level The Batch Interface

The Batch Interface

Batch interface allows to define processing pipelines linked by dependencies.

  • Press Batch .
  • Choose menu “File” then “Open File ..”
  • Select realign.m, coregister.m and

segment.m (in this order).

  • Select the Coregister: Estimate module and

then Reference Image .

  • Press Dependency , highlight

Realign: Estimate & Reslice: Mean Image , and then OK.

  • Select the Segment module, highlight Data ,

press Dependency , highlight Coregister: Estimate: Coregistered Images and Press OK .

Figure : Batch editor including the first three steps of the preprocessing pipeline.

24 / 26

slide-25
SLIDE 25

Getting Started AUDIO 1st level The Batch Interface

Preprocessing Overview

View of the various processing steps as a single box with only few in- and outputs.

Preprocessing Step Inputs Outputs Preprocessing fM00223 *.{img,hdr} sM00223 004.{img,hdr} swrfM00223 *.{img,hdr}

25 / 26

slide-26
SLIDE 26

Getting Started AUDIO 1st level The Batch Interface

Resources

  • SPM8 Documentation, http://www.fil.ion.ucl.ac.uk/spm/doc/
  • Friston, K.J., 2007. Statistical parametric mapping, the analysis of functional

brain images. Academic Press. Acknowledgements Thanks to Ahmed Abdulkadir and Jonas Richiardi for helping in putting together this lab exercise.

26 / 26