From CNI Wiki

Jump to: navigation, search

This page describes "preprocessfmri_CNI", a set of MATLAB routines written by Kendrick Kay that implements several pre-processing steps needed to analyze EPI fMRI data. The code implements slice time correction, motion correction, and field map distortion measured during the data acquisition process.

Suggestions: Perhaps the code could be separated out into its different components, and these could be explained here.


To use the "preprocessfmri" code, you will need the following:

  1. MATLAB 7.6 or later.
  2. Kendrick's GITHUB repository of MATLAB code (e.g. "git clone"). You will need to setup your MATLAB path accordingly. The preprocessfmri_CNI*.m files are included in this repository.
  3. The ba_interp3 and NIFTI_20110215 MATLAB toolboxes. Included in Kendrick's GIT repository.
  4. SPM5. I know that SPM2 will not work, but I'm not sure about other versions. You will need to setup your MATLAB path accordingly. A simple check is to type "which spm_realign". Only the portions of SPM related to motion correction are used.
  5. FSL. Only the prelude utility of FSL is used. I have tested FSL version 4.1.6, but I'm not sure about other versions. Make sure that your shell resource file (e.g. .bashrc, .cshrc) has the appropriate FSL environment variables set, such as FSLDIR and PATH, and that the FSL configuration file is sourced. A simple check is to type "prelude" at the Unix command prompt.

Code Overview

"Preprocessfmri_CNI" consists of three main files

  1. preprocessfmri.m - This is the core code, intended to be generic and non-specific to any particular data format. You will probably not need to call this function directly. However, the function includes extensive documentation which you should probably read.
  2. preprocessfmri_CNIscript.m - This is a template script file tailored for the CNI workflow. You should use this script as a starting point for processing your data. Copy and paste the script into a new file and edit as necessary.
  3. preprocessfmri_CNI.m - This is a helper function called by preprocessfmri_CNIscript.m.

Once you have everything installed, have a look at preprocessfmri_CNIscript.m to see how to run the code.

Personal tools