Skip to content

10. fMRI data preprocessing

Fa-Hsuan Lin edited this page May 25, 2021 · 4 revisions

These are procedures to 'unpack' DICOM images into NIFTI (nii) format. The scripts were tested at /space/maki7/users/fhlin/smsini_array_nccu/063019/unpack on July 7 2019.

1. Check locations of files

Unpacked DICOM images are at three folders:

/space/maki7/users/fhlin/smsini_array_nccu/063019/unpack/bold/005
/space/maki7/users/fhlin/smsini_array_nccu/063019/unpack/bold/007
/space/maki7/users/fhlin/smsini_array_nccu/063019/unpack/bold/009

2. Create session directory and folder files

Two files are needed for FsFast pre-processing. They are session directory (sessdir) and session folder (sessid) files. The content for session directory (sessdir) is

/space/maki7/users/fhlin/smsini_array_nccu/063019

THe content for session folder (sessid) is

unpack

3. Create analysis template

rolle10:/space/maki7/users/fhlin/smsini_array_nccu/063019/unpack> mktemplate-sess -sf sessid -df sessdir
...
...

writing to /autofs/space/maki7/fhlin/smsini_array_nccu/063019/unpack/bold/009/template.nii.gz...
Sun Jul  7 23:05:55 EDT 2019
mktemplate-sess completed 

4. Motion correction

rolle10:/space/maki7/users/fhlin/smsini_array_nccu/063019/unpack> mc-sess -sf sessid -df sessdir -per-run
...
...
Writing to /autofs/space/maki7/fhlin/smsini_array_nccu/063019/unpack/bold/009/tmpdir.mcdat2extreg.141447/pca.nii
mcdat2mcextreg done


Sun Jul  7 23:10:40 EDT 2019
mc-sess completed SUCCESSFULLY

New zipped fMRI images named "fmcpr.nii.gz" will be created in each folder.

5. Slice timing correction

For multi-slice sequences, the slice timing needs to be corrected for different slices such that they are synchronized. Here we specified that slice timing correction is applied to motion-corrected images (fmcpr.nii). The slice order is specified to be "Siemens" (-so option).

rolle10:/space/maki7/users/fhlin/smsini_array_nccu/063019/unpack> stc-sess -sf sessid -df sessdir -i fmcpr -o fmcprstc -so siemens
...
...
writing to /autofs/space/maki7/fhlin/smsini_array_nccu/063019/unpack/bold/009/fmcprstc.nii.gz...
stc.fsl Done
Started at Sun Jul 7 23:12:49 EDT 2019
Ended   at Sun Jul  7 23:16:02 EDT 2019
stc-sess Done

New zipped fMRI images named "fmcprstc.nii.gz" will be created in each folder.

6. Spatial smoothing

Smoothing fMRI images can improve the sensitivity if the smoothing kernel matches the fMRI activation size. Here is the script to do so by applying a Gaussian smoothing kernel with full-width-half-maximum (FWHM) of 8 mm.

rolle10:/space/maki7/users/fhlin/smsini_array_nccu/063019/unpack> spatialsmooth-sess -sf sessid -df sessdir -i fmcprstc -o sfmcprstc -outfmt nii -fwhm 8 -no-mask
...
...

Saving to 009/sfmcprstc.nii
SmoothOnly requested, so exiting now
Started at Sun Jul 7 23:21:40 EDT 2019
Ended   at Sun Jul  7 23:23:44 EDT 2019
spatiallysmooth-sess Done


New fMRI images named "sfmcprstc.nii" will be created in each folder.

7. Convert volume EPI onto values at cortical surfaces

This is the optional step for surface-based fMRI analysis. The EPI files after pre-processing can be "painted" over a cortical surface such that subsequent analysis will be performed in a 2D space.

7.1 register EPI volumes to anatomical MRI

[This script] calls the fslregister in FSL to perform registration. The output is a registration file named `register.dat', including parameters for the linear affine transformation.

7.2 Convert EPI volumes to values over a cortical surface

[This script] calls mri_vol2surf to convert the values in each EPI volumes to values in a cortical surface. The output file format is .stc format, which is essentially a 2D matrix of [# of cortical surface] x [# of time points].

7.3 Convert EPI volumes from a native space to a template

[This script] calls mri_vol2vol to morph EPI volumes in the native space of an individual to EPI volumes in the template, MNI305, space. The output will be MGH files with 2 mm isotropic resolution (76 x 76 x 93 voxels in coronal slices).

The underlay image for morphed EPI data can be accesssed at the mni305.cor.subfov2.mgz file in FreeSurfer. At MAC, it is /Applications/freesurfer/average/mni305.cor.subfov2.mgz.

Clone this wiki locally