Region Of Interest analysis of BOLD data

spm
For my research I do Region-Of-Interest (ROI) analyses of BOLD fMRI data. That is, we look at how brain activity develops in certain predefined brain regions during an experiment. On this site I describe a script that automates these analyses, using SPM, MarsBaR, Matlab, & R.

Let’s start with a short example of an Region-Of-Interest analysis: When you let a person look at a stimulus, you will find a certain pattern of brain activation in the fusiform gyrus (the ROI here, it does visual processing):
fusiform
At scan 1 the stimulus was presented; you can see that the BOLD response is sluggish, only 3 scans later (= 4.5 seconds) the activity reaches its peak. How do we get from the raw scanner data to such graphs, how are these ROI-analyses done?

fMRI analyses are often performed using the software package SPM (Statistical Parametric Mapping, Wellcome Trust Centre for Neuroimaging). For doing Region-Of-Interest analyses in SPM, the toolbox MarsBaR was developed. MarsBaR can be used to define ROIs, and to get the raw BOLD data from such regions (MarsBaR can also be used for more sophisticated analyses, see the MarsBaR website).

While MarsBaR is really useful as it is, it gets a little tedious to do the analyses by hand. As I often do the same sort of analyses (analyzing 16 predefined regions, see http://act-r.psy.cmu.edu/mri/), I automized the whole procedure as a shell script, called jpbplot. The script calls an R file, which, in turn, executes a matlab function that calls SPM and MarsBaR.

The script takes as input four arguments: the design of your experiment (more on that below), the ROI(s) you want to analyze, the names of your conditions, and the scans you want to use as a baseline. For example, to analyze a visual and a manual ROI with a two condition design, you could execute the following in a terminal window:

jpbplot experimentDesign.df visual_roi.mat,motor_roi.mat condition1_condition2 1,2

which will give you two pdf-files: the average bold response in each ROI
exampleOutputJpb
(see the example on the right) and the bold response per participant in each ROI. Furthermore, it will output a data file with the raw bold values in your ROI(s), per participant and condition, which can be used for further analyses.

As described above, you have to tell the script which ROIs it has to analyze. The ROIs that can be used have to be made with MarsBaR, 16 example ROIs are included in the zip-file containing jpbplot. These are the regions that are used for ACT-R fMRI research; as a shortcut you can use ‘ACT-R’ instead of these ROI-names when you call the script. For example, this will analyze all ACT-R regions:

jpbplot experimentDesign.df ACT-R condition1_condition2 1,2


You also have to provide the script with a ‘design’-file, containing your experimental design. The design-file contains a list of your raw scan-files on disk, linking those files to participant number, condition, and scan within a trial. Thus, say one trial takes 3 scans (= 6 seconds), and you have two conditions that can both be EASY and HARD, the top of the design file may look like this (the first 5 trials of the first participant):

1 EASY HARD 1 /Volumes/fMRI/pp1/functional/smoothed_00001
1 EASY HARD 2 /Volumes/fMRI/pp1/functional/smoothed_00002
1 EASY HARD 3 /Volumes/fMRI/pp1/functional/smoothed_00003
1 EASY EASY 1 /Volumes/fMRI/pp1/functional/smoothed_00004
1 EASY EASY 2 /Volumes/fMRI/pp1/functional/smoothed_00005
1 EASY EASY 3 /Volumes/fMRI/pp1/functional/smoothed_00006
1 HARD HARD 1 /Volumes/fMRI/pp1/functional/smoothed_00007
1 HARD HARD 2 /Volumes/fMRI/pp1/functional/smoothed_00008
1 HARD HARD 3 /Volumes/fMRI/pp1/functional/smoothed_00009
1 EASY HARD 1 /Volumes/fMRI/pp1/functional/smoothed_000010
1 EASY HARD 2 /Volumes/fMRI/pp1/functional/smoothed_000011
1 EASY HARD 3 /Volumes/fMRI/pp1/functional/smoothed_000012
1 HARD EASY 1 /Volumes/fMRI/pp1/functional/smoothed_000013
1 HARD EASY 2 /Volumes/fMRI/pp1/functional/smoothed_000014
1 HARD EASY 3 /Volumes/fMRI/pp1/functional/smoothed_000015
...


Thus, each line contains the participant number, the two conditions, the scan-within-a-trial, and the filename of the scan file (in that order; trials are not numbered, it is assumed that the the scan-files are listed in the order in which they were acquired). If you have more or less than two conditions you simply include more or less columns: if you have only one condition, you could leave out the 3rd column, if you have 12 conditions, columns 2-13 would describe the conditions. The list should contain all scan-files you want to analyze; each trial must have the same number of scans (you can remove scans for subsequent analyses using the raw data file that is part of jpbplot’s output). A complete example.df is included in the zip-file.

jpbplot is based on jmfplot, which can be used for the same kind of analyses, but uses different analysis and ROI software than SPM and MarsBaR. jmfplot was developed by Jon M. Fincham.

If you would like to use jpbplot, you can find a zip-file here with the scripts and ROIs. The zip-file also contains a readme.txt which explains how to install jpbplot and describes the design file in a little more detail. If you have any questions, don’t hesitate to email me!

In case you use jpbplot, please cite following paper:

Borst, J.P., Taatgen, N.A., Stocco, A., & Van Rijn, H. (2010). The Neural Correlates of Problem States: Testing fMRI Predictions of a Computational Model of Multitasking. PLoS ONE 5(9): e12966. doi:10.1371/journal.pone.0012966. (pdf) (url)

marsbar


The disappearing mouse pointer...

While designing an fMRI experiment, I ran into the problem that the mouse pointer disappears as soon as you start typing on a mac. In itself it is actually a handy feature -- hiding the mouse pointer makes sense as long as you’re typing -- but not in this particular case.

To synchronize the behavioral data with the fMRI data, a Siemens mri-scanner sends a pulse at the start of every scan, and this pulse is picked up by your mac as a ‘^’-keypress. This makes it really easy to log the scan times, but it also hides the mouse pointer every two seconds, which is extremely annoying for your participants if they have to use the mouse. I had to find a solution for this...

When google didn’t provide an answer, I came to realize that there is no way (as far as I know - please correct me if I’m wrong) to not hide the mouse pointer in OS X when you’re typing. To solve this, I came up with the following solution. First, download pinpoint, a tiny application from macchampion that displays a graphic around your mouse pointer. Then, pay the 10$ fee which allows you to add your own graphics, and add a standard mac cursor as a graphic. Now, make sure this cursor is displayed at the exact same location as your own mouse pointer, and you fixed your problem. While the real mouse pointer still disappears on every scanner pulse, the graphic stays in place, and your participants won’t even notice that the real pointer disappeared.


02_facilitiesbk