Basic fMRI Preprocessing Scripts

This page provides a basic description of the set of "default" fMRI preprocessing scripts that are maintained on the CoreB machines (most likely CoreB1).  Note that although these scripts are designed to be useful for a general fMRI experiment, the exact preprocessing steps you apply, especially after anatomical alignment, depend on the experimental design and types of analyses that you wish to perform.

General Overview

The directory /Volumes/cbs/CLAB/MR_DATA/LATEST_SCRIPTS/ provides a set of (hopefully maintained) tsch scripts for preprocessing fMRI data and templates for performing some basic analyses such as a General Linear Model (GLM) or Fourier analysis.  Why are these located here?  Because it will provide a single location from which you should be able to reasonably assume you can find the most up-to-date scripts.  As we revise, fix, and improve these scripts, these changes will be able to propagate to new experiments if you use this as your source.  And if there is an important fix to a particular script, you will know where to find it. 

In general, the first three-four preprocessing steps for any experiment are the same: (0) convert data from dicom to AFNI BRIK/HEAD, (1) time-slice correction and motion correction, [(2) fieldmap correction], and (3) alignment of anatomical volume with EPI volume.  But note that step (2), fieldmap correction, is often skipped unless you are getting bad distortions in your data as a result of the scanner and scanning parameters.  For the data we've been collecting at Davis, we have not seen bad distortions (except for individual cases in which the subject has a retainer or other metal sources), so we typically skip this step.  As such it is not outlined below.

After those steps, the remaining preprocessing steps that you perform are generally driven by the type of analysis you wish to perform.  In most cases, we have tried to maintain the numbering of scripts across 'prep' and 'other' scripts so that the order of scripts is more obvious.  Currently, we have scripts that are specific to our localizer datasets (MT localizer, Obejct localizer, and Retinotopy scans).  The MT and Object scripts are good examples of GLM analyses; the Retinotopy scripts are good examples of Fourier analyses.  In addition, since the GLM is so common, we also have template scripts for performing a GLM analysis in either volume- or surface-space.

"Latest Scripts" and their Directory Structure 

The location of the "latest" (meaning, hopefully updated and maintained) scripts is the following directory on CoreB1:

/Volumes/cbs/CLAB/MR_DATA/LATEST_SCRIPTS/

This includes various subdirectories as follows:

/Volumes/cbs/CLAB/MR_DATA/LATEST_SCRIPTS/prep/

Scripts for the first 3-4 preprocessing steps outlined above, which are common to essentially all experiments.  Also includes the global_vars.sh file, which defines shared variables that are referenced by many of the other scripts. global_vars.sh is subject-specific and you will need a copy of it for each subject in their scripts folder.

/Volumes/cbs/CLAB/MR_DATA/LATEST_SCRIPTS/volglm/

Template scripts for a basic GLM in volume space.  Need to be customized for your own experiment (currently setup based on the MT localizer).  These would follow the "prep" scripts.

/Volumes/cbs/CLAB/MR_DATA/LATEST_SCRIPTS/surfglm/

Template scripts for a basic GLM in surface space.  Need to be customized for your own experiment (currently setup based on the MT localizer).  These would follow the "prep" scripts.

/Volumes/cbs/CLAB/MR_DATA/LATEST_SCRIPTS/mt/

Scripts for the surface-based GLM analysis of the MT localizer data.  These scripts follow the "prep" scripts.  Also includes the template global_vars.sh file for the MT localizer.

/Volumes/cbs/CLAB/MR_DATA/LATEST_SCRIPTS/obj/

Scripts for the surface-based GLM analysis of the Object localizer data.  These scripts follow the "prep" scripts. Also includes the template global_vars.sh file for the Object localizer.

/Volumes/cbs/CLAB/MR_DATA/LATEST_SCRIPTS/ret/

Scripts for the surface-based Fourier analysis of Retinotopy data, including the necessary Matlab scripts.  These scripts follow the "prep" scripts.  Also includes the template global_vars.sh file for the standard Retinotopy localizer.

/Volumes/cbs/CLAB/MR_DATA/LATEST_SCRIPTS/rois/

Scripts for creating local copies of the centralized/shared ROIs (e.g., ret and mt-obj ROIs) and for projecting those ROIs into the coordinate system that is specific to your experiment (for volumen-based analyses).  Typically run after a GLM analysis to extract means.

/Volumes/cbs/CLAB/MR_DATA/LATEST_SCRIPTS/group_analysis/

Scripts for performing basic group-level analysis in AFNI, including spatial normalization to Talairach or MNI space and group stats such as a t-ttest.  Typically run after a GLM analysis to combine results across subjects, rather than doing an ROI-based analysis.  Warning: these scripts were created quickly for one project and may need a little cleanup / debugging.

What Do I Need For My Experiment?

First, decide what type of analyses you want to run for your particular experiment.  For example, will you run a volume- or surface-based GLM?  Will you use a Fourier analysis?  Will you do something that is highly customized, or will you generally be following the templates provides by the localizer datasets?  Once you have a plan, you can compile the scripts you will need.  In general:

You will almost always need the 'prep' scripts (prep0_to3d.sh, prep1_tscvr.sh, prep3_anat.sh) for any experiment, including the global_vars.sh file for defining shared variables.  In addition, you will need all of the scripts in the volglm or surfglm directory, for example, if you are running a volume- or surface-based GLM (the most common analysis), respectively.

COPY (DO NOTE MOVE) all of the scripts you need to a directory called scritps_defaults, which you will need to create in your experiment's directory (i.e., where you will analyze your data).  At this stage, you will not have subdirectories for 'prep', 'volglm', etc.  All scripts can reside in the scripts_defaults directory. (note, if you are doing a GLM, you will still have a stim_times subdirectory).

global_vars.sh is a subject-specific script. You will need a copy if it in each of your subjects' scripts directories: /Volumes/cbs/CLAB/MR_DATA/yourExpt/S1/scripts/

Now you are ready to analyze the data from your experiment!!!

Wondering how you should organize your experiment directory, setup the scripts for a new subject, and/or run them to actually process your data?  Check out the example in the Basic fMRI Analysis Tutorial, which shows you how to use many of these scripts to analyze one subject's MT localizer data using a surface-based GLM.