fMRI Primer

02 Basic Theory

Section I: EVs (Regressors) and Contrasts – the Foundation of FSL

Information Flow from Stimulus to Scanner to Server to Final Image: A Conceptual Overview

This primer begins not with detail but overview. If you do not understand what it means, conceptually, to analyze fMRI data, you are going to have difficulty in understanding how to fill out the FSL GUIs (graphic user interfaces) that you will be presented with in FEAT, the centerpiece of FSL. In particular, you are going to be stymied when it comes to determining EVs (explanatory variables) and contrasts. An investment of conceptual energy now will pay off in speedy data analysis later.

Broadly put, data analysis in fMRI requires an understanding of how information flows, is streamlined, and is modeled as it passes from a subject’s brain to the scanner (k-space) to the server, through FSL, and into a final image. Developing an intuitive feel for how you, the experimenter, will manipulate and manage this information is crucial.

Stimulus Presentation, and the Elicitation of Brain Activity
All information manipulated by FSL ultimately (should) have its roots in a subject’s brain, though sadly a great deal of the ‘noise’ in fMRI data comes from elsewhere. Nevertheless, the first step in developing fMRI data is to administer an experiment to a subject. As will be explained at length below, the mathematical aim of an experiment is to produce variation in brain activity, and therefore BOLD signal, over the course of the scan. Without variation there cannot be signal, without signal there cannot be data, without data there cannot be publications, and without publications there cannot be career.

Figure 1: Information flow begins – A task produces a BOLD response

Figure 1

Please be aware that the scanner DOES NOT CARE how good (or preposterous) your study design may be. It will make loud banging noises and cost money and produce k-space data regardless. This is important because, psychologically, many people who do not understand fMRI data analysis appear to believe that as long as they acquire a scan they are going to have data. This is wrong. As important as data analysis is, a poor study design cannot be overcome. Tragically, the realization that your design is a bad one dawns slowly, over the course of months, because it requires multiple subjects, pooled in a group analysis, before the quality of the data, or lack thereof, becomes clear. For this reason, heads-up design is imperative: you need to maximize the chances that your group analysis will be interesting. As a final word of advice, because many published studies use poor designs (compensated for by suspect analysis techniques that slip past poorly informed, or worse, similarly guilty reviewers) it is prudent to carefully examine any study, even one designed by a famous name in the field, before administering it. On inspection, most have problems, or at least have made tradeoffs that may not be optimal for your purposes.

Scan Acquisition: Volumes, Slices and Voxels
Study design is irrelevant to scan acquisition. As shown in Figure 2,



Figure 2: A volume is comprised of slices



during image acquisition, the scanner acquires slices of the brain (in this image, the whole brain is comprised of 26 slices). These 26 slices,are called a volume. The TR (time-to-repeat) determines the number of seconds it takes to acquire a single volume. Volumes are numbered sequentially in the order in which they are acquired, eg volume 1, 2, 3 and so forth.

As shown in Figure 3 below, each slice is dived into voxels. Each voxel has a length, width and height. In the figure below, a slice of a coronal section has 16 voxels, numbered in the upper left hand corner. A second value, written in purple ink in the center of each voxel, represents the numerical value of its BOLD signal. Please note that this number is unknown at the time of scanning. That is, while each voxel has a BOLD intensity in ‘reality’ at the time of scan acquisition, this value cannot be recorded directly by the scanner. Rather, the scanner records radiofrequency information produced by the brain as a whole, which is recorded in k-space, as described below. Phase manipulations of this radiofrequency information, across a gradient, are necessary to determine voxel intensity. Thus be aware that Figure 2 represents information that cannot be known until data is reconstructed from the k-space image (using inverse Fourier transformation).

Figure 3: A slice consists of voxels, each with a BOLD intensity


K-Space: Storing BOLD signal as radiofrequency data

K-space, like purgatory, represents an intermediate holding-area for fMRI information; it is not the information’s ultimate destination, it is not amenable to analysis, and is never actually seen by most experimenters. Most people tend to forget about it, as it is irrelevant to analysis. However the ‘needs’ of K-space are fundamentally important to image acquisition. A poor experimental result on an important question will lead most people who previously have ignored K-space, to think carefully about how to improve the quality of information entering it, typically by altering radiofrequency sequences, subject movement, experimental design, and magnet field strength.

Radiofrequency data is recorded using the a branch of mathematics involving Fourier Transform, which takes advantage of the fact that even the most complex, random-looking radiofrequency ‘squiggle’ can be resolved into a finite number of overlapping sine/cosine waves, each of which has a frequency and amplitude. In addition, each of these waves can be in one of (essentially) 360 phases with respect to a reference wave. This phase and frequency information is a) created by the scanner using gradients and changing pulse sequences b) mapped into K-space. Note a few basic features of K-space:

  1. K space exists independently of any data. Like a room standing empty before furniture is brought in, it is simply a Cartesian matrix in which each point has a value that represents, along its X axis, a range of K numbers, and along its Y axis, a range of phase possibilities for each of these K numbers. The point stands empty, waiting to record the intensity of the data that could, potentially, be there. There can be no signal at a k-space point, or there can be intense signal. Each point in k-space encodes ‘spatial frequency’ information – about the frequency and phase of the various sine waves that, together, comprise the radiowave recorded by the detector.
  2. The “k” of K-space is wave number = number of complete wave cycles in one meter
  3. Recall that a given wave can be in various phases with respect to another identical wave – it can be identical (zero degree phase shift) or inverse (180 degree phase shift).
  4. The more informative points in k-space are a) the ones at the center b) the bright ones

Figure 4: A slice consists of voxels, each with a BOLD intensity


Reconstruction: Performing a double inverse-FFT on k-space to make a BOLD signal Image-Space
Ice-skating’s triple Salchow can’t hold a candle to fMRI’s double inverse FFT. As an experimenter, your first interaction with data hot-off-the-scanner is to convert it into image-space through two consecutive inverse Fourier transformations (FFTs, for ‘fast fourier transforms’), one along the x-axis and one along the y-axis of k-space.

The product of the double inverse FFT on the k-space is a matrix of BOLD signal values, specifying the BOLD signal of each voxel in the brain over the course of the scan. (See Figure 5 below). Although this information is about a three dimensional space, it is easier to understand how it is analyzed by conceptualizing it as a 2-D matrix. In the image matrix each voxel is represented by a row, and each volume (eg time-point) is represented by a column. Thus the y-axis represents space – with one row per voxel – while the x-axis represents time – with one column per time point. The evolution of a voxel’s BOLD signal over the course of the scan can be read across the matrix left to right. The number in each cell represents the value of the BOLD signal for that voxel at that point in time. It is conceptually crucial to realize that the matrix contains no information about thestudy design. The whole purpose of FSL is to apply the study design to this matrix and to see what emerges from the analysis. But the matrix itself is neutral with respect to design.

Figure 5: Image-space: BOLD signal intensity, by voxel, as reconstructed from k-space


In Figure 6 below, a sample matrix is displayed. Notice how the voxels, numbered 1-16, are arrayed down the first column (in light blue). In the first volume acquired in the scan (which for illustrative reasons is in this example a single slice), the values (purple numbers in Figure 4) are arrayed in the second colummn. As the scan progresses, each voxel’s BOLD signal changes.

Figure 6: A matrix in which each column represents a whole volume, and each row represents a voxel; values are BOLD intensities


Of note, you may in any given day of scanning acquire multiple matrices. Typically you acquire at least 2 – one for the structural T1 SPGR image, and at least one functional image. But if you do two experiments, you will acquire two functional matrices, if you do three, three, and so forth.

Individual results: When application of regressors to the matrix leads to signal extraction
The real conceptual work of fMRI analysis begins now. Up until this point, raw data has simply been formatted in a way that is amenable to signal extraction. The purpose of all this formatting is to determine if a) there is any numerical pattern of activation in the matrix b) if this pattern corresponds to the experimental design. It is heuristic, however, to avoid thinking about your experiment in psychological terms, and instead to think of your experiment in mathematical terms. The way to do this is to convert your psychological hypothesis into a mathematical prediction about the distribution of numbers in a matrix. And the way to do this is to construct one or more regressors. Your regressors are your hypotheses, translated from psychobabble into curvilinear equations.

Figure 7a: A regressor is not implicit in the data; it is a rather a product of the experimenter’s hypotheis.


7b OLS Calculation – Sample showing only 2 voxels at 8 time points


The ‘fit’ of the regressor to the data is determined by multiple linear regression, the mechanism of which is beyond the current understanding of the author of this primer. However a basic conceptual understanding will help in the construction of studies.


Where y is the dependent data (eg, from the scanner) a is the ‘demeaning term’ that corrects for the fact, for example, that all BOLD signal terms hover around an intensity value of 10,000.

Note to Pete and Ted – what needs to be explained
1) Data = regressor * PE (parameter estimate) + error
2) Step 2: fit regressor to each voxel’s time-series as best possible (change in BOLD signal over course of experiment) by multiplying the regressor by some value and minimizing OLS – the regressor value that best minimizes the OLS score is called the parameter estimate
3) Step 3: divide the parameter estimate by the variance = z-score
4) Step 4: use a gaussian distribution to determine which z-scores are to call ‘significant’ – this determines which voxels will be active on image.

Figure 8: to be drawn!!!

This produces a much smaller (and more elegant) amount of information than is contained in the matrix. Now each voxel in the brain doesn’t have (# volumes) values associated with it, bur rather only a single value: – its OLS score. As might be expected, only a small number of the voxels in the brain will have low – eg, highly significant – OLS scores. These winners win the right to become colored blobs on the visual images – but importantly, this color (and its intensity) is simply a reflection of their statistical status as a result of the OLS analysis.

Figure 9: OLS Calculations on each voxel in the brain produces a functional image


The details of the left tail (colored yellow-orange) in Figure 8 are to be found in the real product of the OLS analysis: a size-of effect matrix, which becomes the substrate for within-subject group , and group, analyses.

Figure 10: Size of Effect (Z-stat) Matrix



Note to Pete and Ted
Now a challenge is to explain contrasts. Ted will do this.

Group Analysis:

Note to Pete and Ted

1. Now explain how group analysis works, by
Information has been massively reduced at this point in the experiment. We have gone from each voxel in the brain having many hundreds of observations associated with it, to having only a single value – its z-stat. Group analysis consists in looking at the relationship between a) z-stat scores for the same voxel in the same subject during different runs (eg, before and after SSRI treatment for depression) b) z-stat scores for the same voxel in different subjects undergoing identical experimental procedures.

1. Sum all the z-scores for a single voxel, and divide by N. This is the new z-score for that voxel across the groupl
2. If you expect parametric modulation, you do OLS of the z-score to the predicted variation
3. If you want to do a subtraction, predict that one will be positive and one negative (a variation on the above)
? what is FLAME?


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: