Wallace:fMRI

From OpenWetWare
Revision as of 11:00, 30 January 2014 by Sarah Baum (talk | contribs) (→‎AFNI)
Jump to navigationJump to search

<html><style type='text/css'> .tabs {

 width: 640px;
 font-family: arial;
 color:#ffffff;

}

.tabs strong{

 color: #851e21;

} </style></html>

Wallace Lab


Experiment Design

Types of fMRI design

There are 3 main types of scan series that you will use in an fMRI experiment.

Rapid Event-Related

Block Design

Resting State

Creating Code

To run an fMRI experiment you'll need to write some code that will interface with the scanner and present stimuli in the right order at the right time. For the most part, creating new code will involve taking someone's old code and updating the stimulus array variable. It's a good idea to test things out at the mock scanner in case the scanner software was updated in a way that no longer works well with the code, or if an errant comma or semi-colon found its way into the the code.

When creating a stimulus array for a rapid event-related fMRI experiment, you'll need to pseudo-randomize the stimulus order in a way that is compatible for deconvolution analysis. The best way to do this is a program called optseq2.

AFNI

AFNI is a software package for processing, analyzing, and displaying fMRI data. It is freely available from the NIH. Other packages for fMRI data analysis exist, but Sarah can't help you with them.

It's a good idea to get AFNI up and running before you begin data collection and analysis. You can download the latest version of AFNI at

  http://afni.nimh.nih.gov/afni/download/afni/releases/latest

When the file finishes downloading, you will need to double click the file to un-zip the tar file. Drag the newly created folder to the Applications directory. To more easily access the folder, rename it "afni".

Next you'll need to download XQuartz since X11 is no longer automatically included in new Mac operating systems. You can download it here

 http://xquartz.macosforge.org/landing/

Set up

It's a good idea to have a .cshrc file, which will help you set up your path every time you open terminal. If you don't already have one, you can create one with the following command

 touch ~/.cshrc

If you've already created a .cshrc file, enter the following command into terminal:

 open -e ~/.cshrc

The following path commands are good to have in your .cshrc file. Be sure to double check that these path locations are where each program is located on your computer, and make adjustments as needed.

 set path = ( $path /sw/bin /Applications/AFNI/ /Applications/MATLAB_R2011a.app/bin)
 setenv DYLD_FALLBACK_LIBRARY_PATH /Applications/afni

Any time you make changes to your .cshrc file, these changes will only apply to "new" terminal windows. If your problem isn't solved after you make .cshrc changes, be sure you're working in a new window.

If you haven't already done so, be sure to change the shell that terminal uses. By default, terminal opens with bash, but tcsh is more useful for AFNI. To change the default shell, go to Terminal > Preferences. Under "Shells open with", click "Command (complete path)" and replace it with the following:

 /bin/tcsh

Updating

Many problems can occur if your afni verion is not up to date. To update, first type the following command into terminal:

 afni -version

If your afni version is more than a month old, it's time to update. To update, type:

 @update.afni.binaries -defaults

Finally, after you update you must enter the command

 rehash

FreeSurfer

FreeSurfer is another software package that will be used mainly for cortical surface reconstruction. Their download page also includes a wiki that may help with troubleshooting if necessary. To download FreeSurfer, go here:

 https://surfer.nmr.mgh.harvard.edu/fswiki/Download

It may take a long time to download. You will also need to add FreeSurfer to your .cshrc file. You can do so with the following commands:

 echo ‘setenv FREESURFER_HOME /Applications/freesurfer‘ >> ~/.cshrc
 echo ‘source $FREESURFER_HOME/SetUpFreeSurfer.csh' >> ~/.cshrc

You'll note that there are multiple ways to add text to the .cshrc file, either directly through the terminal window or by manually opening the file. Both ways work, it just depends on what you're comfortable with.

You'll also need a FreeSurfer license, which is free but requires requesting one from their website. The license should go in the same folder that FreeSurfer is located in. If you cannot find the license file later (it's a hidden file), you can type the following into terminal

 open -e /Applications/freesurfer/.license

Data Analysis

Getting raw data from the scanner

After a scan you will need to get the data from the scanner to our server.