Download presentation
Presentation is loading. Please wait.
1
fMRI Image Analysis SPM
2
fMRI Processing steps Conversion from DICOM to NIFTI
Organization of folders Visual Inspection (Quality control of a) Structural and b) Functional images) Pre-processing Motion correction – Realign and Unwarp (U) Slice time correction (a) Segmentation Get Pathname Image Calculator Coregister and Estimate Normalization and Write (w) Smoothing Pre-processing flowchart
3
Online tutorial Preprocessing in SPM12
4
1. Conversion from DICOM to NIFTI
SPM12 uses NIFTI file format so you will need to convert your DICOM images into NIFTI format. You can use SPM to convert the images or you can use other programs such as MICROGL Go to folder mricroGL and double click MRIcroGL application. Go to import convert DICOM to NIFTI. 4D files can be used in SPM, FSL and AFNI. However, compressed 4D is most common in FSL (*.nii.gz), although it recognizes the non-compressed 4D file (*.nii) (FSL would then write everything in *.nii.gz). But for SPM, it has to be non-compressed, so make sure you uncheck the box “compress”. Also should check the BIDS format (Brain Imaging Data Structure) while converting. Drag the DICOM folder onto the GUI. You can look at what the various options of dcm2nii
5
2. Organization of folders
Create new folders for: Raw_Directory (you can keep it untouched) NIFTI Directory Subj_001 anat func dwi Log Pre-processing Subj_001 DICOM Task Log files 1st level analy Subj_002 DICOM Task Log files Subj_002 anat func dwi Log You can use the subject ids with group info as prefix. For eg. HC – C000; MDD – D000; or you can use numbers as identifiers. All HC starts with 1; MDD starts with 2; rMDD starts with 3, etc. When you come to pull subjects for groups analyses, it becomes easier naming all functional and structural data the same, eg. Resting.nii.gz, stroop.nii.gz, T1.nii.gz across all subjects, makes it easier for batching, then you just can loop across subjects.
6
3. Visual inspection using MRICROGL
It is very important to check your images (quality control) before performing any type of analysis. MRICROGL is particularly useful when checking for any abnormalities in your structural images (T1). For inspecting functional images, fslview allows you to see a video of your functional images, to search for any serious movement. Note: to view the data in mricrogl, change default by clicking on “Display” to Multiplanar, or press Ctrl + M. Select Multiplanar under Display, and then just open your T1 by going to File open and navigate through your data until you reach your structural. Above is an exemple of a good T1.
7
a. Quality Control Structural Data
Aim is to check the Quality of the structural data Check for any weird abnormalities, such as big holes, stripes, etc. Structural MRI hardware related artifacts RF bias (B1 inhomogeneity) Non-uniform RF field causes smooth variations in intensity Need to compensate in analysis
8
a. Quality Control Structural Data
Structural MRI hardware related artifacts RF interference RF spikes Ghosting Wrap-around Hardware/settings Serious but uncommon, easily identifiable
9
a. Quality Control Structural Data
Structural MRI Motion related artifacts MOTION is very hard to correct, so try to minimize at acquisition.
10
b. Quality Control Functional Data
Aim is to check the Quality of the functional data If you can get fslview and play it in video mode, look for jumps, nods and stripes If looking using mricroGL, open couple of volumes and look for stripes, artefacts, etc Check if you have the entire brain coverage Few examples are on the next slides
11
b. Quality Control Functional Data Functional MRI artifacts
DISTORTION Due to Bo inhomogeneity (air in sinuses) Fieldmap are used for correcting these Signal Loss Nothing we can do, except selecting good acquisition methods, like 30deg angle, Z-shimming, etc Phsyiological Noise Acquire physiological measurements Remove from your signal by covarying these measures MOTION is very hard to correct, so try to minimize at acquisition.
12
4. Preprocessing in SPM Preprocessing has 2 major goals: remove uninteresting variability from the data (motion correction, slice timing, smoothing) and to prepare the data for the statistical analysis (Normalizing). To prepare the data for analysis we should match all scans of an individual subject and match all subjects into a standard space. The overall goal is to increase the quality of the images. Open SPM/batch. You find pre-defined batches inside the SPM folder, subfolder batches. To used them, open the Batch editor on the SPM for functional MRI box and load/open the SPM folder that contains a subfolder called Batches, then select the Preprocessing fMRI.m file. Then another SPM window opens. You are asked to do slice time correction and then you are asked to choose the number of sessions. Add image of where to get the SPM batch
13
4.1 Motion correction People always move in the scanner. Even with padding around the head, there is still motion. However, it is important that every voxel corresponds to the same anatomic point across scans and subjects. Motion correction realigns all images to a common reference. The reference can be the first (one) image or mean of all images. Small motion (e.g. 1% of voxel size) near strong intensity boundaries may induce a 1% BOLD signal change. Each image is registered individually with the target reference image. Uses rigid body (6 DOF).
14
4.1 Motion correction – Realign and Unwarp (u)
Realign is the most basic function to match images. It is used to correct for motion during the functional scans. Uses a ridged body transformation to manipulate the scans, so it only allows translations and rotations in the x, y and z directions that are then incorporated in the nii files. Tries to minimize the difference between 2 scans. It can only be used in scans that have been acquired with the same pulse sequence. Unwarp should only be used if you believe your scans are warped. Usually realignment takes care of the distortions. When you have movements up and down and also the shape of the volume changes as a function of time, then realignment cannot take care of these changes.
15
4.1 Motion correction – Realign and Unwarp (u)
Click on Data – New Session If we have several sessions, we can preprocess them all together, by selecting different sessions Click on Images – navigate to the folder where your NIFTI images are. Choose all the functional files for the session or sessions. Note, on filter you can write faces.* and all the images show up. Select them all.
16
4.1 Motion correction – Realign and Unwarp (u)
Change default Num Passes – from “Register to First” to “Register to Mean” Change default Interpolation – from 2nd degree interpolation to 4th degree interpolation Keep rest as default
17
4.1 Motion correction – Realign and Unwarp (u)
Effect of Motion Correction
18
4.1 Motion correction – Realign and Unwarp (u)
Motion Correction Output Relative = time point to next time point – shows jumps Absolute = time point to reference – shows jumps & drifts Note: large jumps are more serious than slower drifts, especially in the relative motion plot
19
4.1 Motion correction – Realign and Unwarp (u)
Motion Correction Remedies Motion correction eliminates gross motion changes but assumes rigid-body motion Other motion artefacts persist including Spin-history changes, B0 (susceptibility) interactions & interpolation effects Such artefacts can severely degrade functional results Worse for stimulus correlated motion Potential analysis remedies Including motion parameters as regressors in GLM (covariates of no interest) Removing artefacts with ICA denoising Outlier timepoint detection and exclusion (via GLM) Excluding subjects with excessive motion No simple cut off for “too much” motion
20
PengFei please write about the “Fixing program”
21
4.2 Slice time correction (a)
Almost all fmri scanning takes each scan separately, so each slice is acquired at slightly different times: Data acquisition / Slice acquisition Data are acquired using pulse sequences using radiofrequency excitation followed by data collection from throughout that slice. To collect data from the entire brain, a typical pulse sequence might acquire 30 slices within a TR of 1.5 to 3.0 s depending on the scanner. Ascending/descending slice acquisition: data is acquired in a consecutive order or sequentially from one end of the imaging volume to the other. Interleaved: data is acquired in an alternating order, so data are acquired first from the odd numbered slices and then from the even numbered slices. This minimized the influence of excitation pulses on adjacent slices. A problem might be that adjacent parts of the brain are acquired at non adjacent time points within the TR. So, if slice 1 was acquired at 0 second, the 2 slice would not be acquired until 1.5 seconds later, so the same BOLD response would seem to occur earlier in the latter slice. That means that the same hemodynamic response will have different time courses within the slices. This is a problem especially in event-related designs. Temporal interpolation: Estimate the amplitude of a signal at a time point that was not originally collected, using data from nearby points. But when we do analysis, we assume that the entire brain volume is imaged at the same time, which is not true.
22
4.2 Slice time correction (a)
Without any adjustment, the model timing is the same
23
4.2 Slice time correction (a)
…but the timing of each slice’s data is different
24
4.2 Slice time correction (a)
Can get consistency by shifting the data
25
4.2 Slice time correction (a)
And then interpolating the data = Slice Timing Correction
26
4.2 Slice time correction (a)
Slice timing correction changes the data – degraded by the interpolation
27
4.2 Slice time correction (a)
Alternatively, we can get consistency by shifting the model
28
4.2 Slice time correction (a)
Batch Click Data / New Session Click on Dependency Select Realign & Unwarp: Unwarped Images (sess 1) As you want all the images to be slice time corrected and not only the mean image.
29
4.2 Slice time correction (a)
Batch All slice information comes from the protocol TA – acquisition time is calculated = TR – TR/nslices Reference slice – usually slice that was collected at middle of the TR, here it is 45, as the slice order here was interleaved Slice order – …45 2,4,6….44 Eg to write on the slice order 1:3:45 2:4:44
30
4.3 Segmentation Is used to separate the distinct tissues such as grey matter (GM), white matter (WM) and CSF in anatomical scans. This can also be used for normalization. This step is performed with the anatomical image (T1- weighted).
31
4.3 Segmentation Batch Click Volumes
Navigate to T1 NIFTI folder and select your T1 image Change default Save bias corrected – from “save nothing” to “save field and corrected” Change default native tissue – from “native space” to “native + Dartel imported” Change default Warped tissue – from “none’ to “modulated + unmodulated” ***last two changes are because these files are useful if we plan to do structural analyses later. **change the last defaults for all tissue probability map (1 – 6)
32
4.3 Segmentation Batch Change default Deformation Field - from “None” to “inverse + forward” This step moves segmented grey matter into the MNI space (ICBM space template – European brains) Forward deformation – represents the transformation needed to move subject space to MNI space Inverse deformation – represents the transformation needed to move MNI space to subject space
33
4.4 Get Pathname This step is really only to get the pathname of your T1 folder where segmentation outputs are saved.
34
4.5 Image calculator This step put together the WM+GM+CSF images into one and corrects for bias field by multiplying this added image by bias corrected image (output from segmentation step) It is just to create a mask corrected for intensity changes, so co-registration with functional images are more accurate. It is not needed for normalization, as deformation filed is already created in segmentation step using T1 (GM)
35
4.5 Image calculator Input images – c1 (GM), c2 (WM), c3 (CSF) and bias corrected All of them are outputs of segmentation steps, so we can choose using dependency Output name – T1_bias_brain Output Directory: Directories Unique Expression = (i1 + i2 + i3).* i4 Adding WM, GM, CSF And multiply with bias corrected image Leave all the rest as default.
36
4.6 Coregister and Estimate
Coregistration is done to match scans of different modalities (eg., T1 and T2) and like realignment it only allows rigid body transformations. Estimation determines the transformation parameters without changing the bitmap. It incorporates them into the nii file. As a reference image you should select the scan to which another scan is going to be compared. As a source image, you should select the scan that is going to be transformed onto the reference scan. In this step we take care of the connection between structural and functional images within the subject.
37
4.6 Coregister and Estimate
Coregister mean functional image (Unwarped mean, source image) to T1_bias_brain (reference image) Other images, slice timming corr Images session1. Use dependency to choose these images. It moves functional images in the space registration as T1.
38
4.7 Normalization and write (W)
Functional During the normalizing step we connect our functional data with the normative data from MNI. This step requires smoothing. Importantly, you should consider using a “bounding box” which defines the amount of MNI space that will be incorporated in your new files. Structural During the normalizing step we connect our structural data with the normative data from MNI. This step does not require smoothing.
39
4.7 Normalization and write (W)
Move functional data and T1_bia_brain into MNI space (use dependency in these steps). Need to do in two Normalize – Write steps (functional on the left, structural on the right).
40
4.8 Smoothing Smooth data –rule of thumb twice as your voxel size Smoothing is one of the last steps and aims at blurring the functional images to correct for any remaining functional and anatomical differences between subjects. Nevertheless the more you smooth the less resolution you get. If you are interested in small regions you should not smooth that much.
41
Pre-processing flowchart
Preparing functional data Combining func + struc Preparing Structural Data SEGMENTATION REALIGN & UNWARP 3 1 Realigned Images GM (C1) WM (C2) Source CSF (C3) Bias Corrected CO-REGISTRATION Realigned Mean Image 5 Reference Forward + Inverse Deformations Other SLICE TIMING CORRECTION 2 Co-registered STC images (not saved) Create Bias corrected T1 mask Forward Deformation 4 Forward Deformation NORMALIZATION (MNI) 6 NORMALIZATION (MNI) Normalized functional Images 7 SMOOTHING 8 Normalized T1_bias_brain Images
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.