fMRI Analysis in 1000 Words

By Neuroskeptic | August 19, 2010 11:45 am

Following on from fMRI in 1000 words, which seemed to go down well, here’s the next step: how to analyze the data.

There are many software packages available for fMRI analysis, such as FSL, SPM, AFNI, and BrainVoyager. The following principles, however, apply to most. The first step is pre-processing, which involves:

  • Motion Correction aka Realignment – during the course of the experiment subjects often move their heads slightly; during realignment, all of the volumes are automatically adjusted to eliminate motion.
  • Smoothing – all MRI signals contain some degree of random noise. During smoothing, the image of the whole brain is blurred. This tends to smooth out random fluctuations. The degree of smoothing is given by the “Full Width to Half Maximum” (FWHM) of the smoother. Between 5 and 8 mm is most common.
  • Spatial Normalization aka Warping – Everyone’s brain has a unique shape and size. In order to compare activations between two or more people, you need to eliminate these differences. Each subject’s brain is warped so that it fits with a standard template (the Montreal Neurological Institute or MNI template is most popular.)

Other techniques are also sometimes used, depending on the user’s preference and the software package.

Then the real fun begins: the stats. By far the most common statistical approach for detecting task-related neural activation is that based upon the General Linear Model (GLM), though there are alternatives.

We first need to define a model of what responses we’re looking for, which makes predictions as to what the neural signal should look like. The simplest model would be that the brain is more active at certain times, say, when a picture is on the screen. So our model would be simply a record of when the stimulus was on the screen. This is called a “boxcar” function (guess why):
In fact, we know that the neural response has a certain time lag. So we can improve our model by adding the canonical (meaning “standard”) haemodynamic response function (HRF).
Now consider a single voxel. The MRI signal in this voxel (the brightness) varies over time. If there were no particular neural activation in this area, we’d expect the variation to be purely noise:Now suppose that this voxel was responding to a stimulus present from time-point 40 to 80.
While the signal is on average higher during this period of activation, there’s still a lot of noise, so the data doesn’t fit with the model exactly.
The GLM is a way of asking, for each voxel, how closely it fits a particular model. It estimates a parameter, ?, representing the “goodness-of-fit” of the model at that voxel, relative to noise. Higher ?, better fit. Note that a model could be more complex than the one above. For example, we could have two kinds of pictures, Faces and Houses, presented on the screen at different times:
In this case, we are estimating two ? scores for each voxel, ?-faces and ?-houses. Each stimulus type is called an explanatory variable (EV). But how do we decide which ? scores are high enough to qualify as “activations”? Just by chance, some voxels which contain pure noise will have quite high ? scores (even a stopped clock’s right twice per day!)

The answer is to calculate the t score, which for each voxel is ? / standard deviation of ? across the whole brain. The higher the t score, the more unlikely it is that the model would fit that well by chance alone. It’s conventional to finally convert the t score into the closely-related z score.

We therefore end up with a map of the brain in terms of z. z is a statistical parameter, so fMRI analysis is a form of statistical parametric mapping (even if you don’t use the “SPM” software!) Higher z scores mean more likely activation.

Note also that we are often interested in the difference or contrast between two EVs. For example, we might be interested in areas that respond to Faces more than Houses. In this case, rather than comparing ? scores to zero, we compare them to each other – but we still end up with a z score. In fact, even an analysis with just one EV is still a contrast: it’s a contrast between the EV, and an “implicit baseline”, which is that nothing happens.

Now we still need to decide how high of a z score we consider “high enough”, in other words we need to set a threshold. We could use conventional criteria for significance: p less than 0.05. But there are 10,000 voxels in a typical fMRI scan, so that would leave us with 500 false positives.

We could go for a p value 10,000 times smaller, but that would be too conservative. Luckily, real brain activations tend to happen in clusters of connected voxels, especially when you’ve smoothed the data, and clusters are unlikely to occur due to chance. So the solution is to threshold clusters, not voxels.

A typical threshold would be “z greater than 2.3, p less than 0.05”, meaning that you’re searching for clusters of voxels, all of which has a z score of at least 2.3, where there’s only a 5% chance of finding a cluster that size by chance (based on this theory.) This is called a cluster corrected analysis. Not everyone uses cluster correction, but they should. This is what happens if you don’t.

Thus, after all that, we hopefully get some nice colorful blobs for each subject, each blob representing a cluster and colour representing voxel z scores:

This is called a first-level, or single-subject, analysis. Comparing the activations across multiple subjects is called the second-level or group-level analysis, and it relies on similar principles to find clusters which significantly activate across most people.

This discussion has focused on the most common method of model-based detection of activations. There are other “data driven” or “model free” approaches, such as this. There are also ways of analyzing fMRI data to find connections and patterns rather than just activations. But that’s another story…

CATEGORIZED UNDER: bad neuroscience, fMRI, methods
  • bsci

    Nice overview. Obviously there's a lot more that can be written and many more ways to analyze the data even within the GLM framework, but you're writing a post, not a book. My only quibble is that you mention motion correction, but not slice-timing correction (i.e. adjusting the values from each slice to extimate what they would be if all slices were collected at the same time). It's probably worth mentioning because almost everyone does it and, with usually hidden can be the source of interesting problems… particularly in volunteers or populations who move their heads more frequently.

    By the way, are you going to start tagging all your fMRI posts “bad neuroscience”?

  • Neuroskeptic

    No, I tagged this one only because it mentions the dead fish study.

  • petrossa

    If i understand your various posts well when all is said and done, fMRI is a computer model of the brain in the same way NCAR's climate model is that of the climate.

    What you see is not reality nor a representation thereof, but the interpretation. And as with all interpretations, it's by definition subjective and completely dependent on getting the parameters right.

    Since we all have more or less the same brain i'm sure it can serve as an indication. However in view of the enormous subtle differences between brains it'll be a while before it starts to approach any level of reliability across all brains.

    Nice toy, makes pretty pictures and serves as a good confirmation bias machine.

  • Anonymous

    fMRI analysis in ONE word: BULLSHIT!

  • bsci

    I'm not going to get into a comparison with climate science, but you're inaccurate regarding fMRI. From the data analysis point of view there are robust findings that are reliable and replicable across hundreds of subjects with substantially different analysis methods. Results definitely vary with analysis method, but if you shine a light in someone's eyes, they'll all show a clear visual cortex response. If someone moves their hand, you'll see a strong motor cortex response.

    Some of these signal changes you can see by looking at the raw time series without any processing or statistics (beyond converting the spectra data from the scanning into an image)

    As in all research, you need statistics when noise is larger or the effect sizes are smaller. In those cases, the purpose of all these processing steps is to optimally interpret the data while making as few assumptions as possible.

    Also, fMRI has the benefit of many people performing similar experiments. Findings that can't be replicated using different volunteers/scanners/analysis options tend to disappear from the discussion.

    I'm not saying that all or even most fMRI publications are phenomenal science, but, used correctly and understanding the assumptions behind the data and methodology, current analysis methods are a powerful tool for understanding brain function.

  • petrossa


    Well that's pretty much what i said isn't it? It's ok for very coarse observations, but useless for accumulating meaningful data for higher order functions.

    As soon as one starts draw far reaching conclusions from computer models representing a very complex reality you typically end up with GiGo.

  • Neuroskeptic

    It's not really a computer model. It's a statistical model, but so is everything. If I say the average height of a British man is 180 cm with a standard deviation of 10 cm that's a model. Albeit a simple one.

    In some parts of the brain, even a very simple boxcar model is an extremely good fit for the data, e.g. if you ask someone to open their eyes for 30 s, close them for 30 s, open them again etc. then the response in their primary visual cortex is pretty much a boxcar plus a bit of noise.

    What is true about the kind of GLM-based analysis I've described is that you can't use it to discover new hypotheses aka models, only to test existing models.

  • bsci

    Like neuroskeptic said, your beef is with the entire field of statistics, not computer models. If you don't think we can use statistics to identify significant signals beneath noise or separate different aspects of signals, then you don't believe pretty much all of modern science and engineering.

    The statistical tools of fMRI aren't very different from the tools in every other field.

  • petrossa

    I beg to differ with both of you. The statistical model gets manipulated by a computer model in order to visualize it.

    The data in numbers wouldn't really be very workable. The data has to be rendered, hence a computermodel. The rendering needs parameters to correctly place the false colors, color intensity and shade, limits etc.

    That together with the shortcomings of statistical methods in general doesn't make for a really viable method. A confirmation bias generator.

    But still, nice pictures

  • bsci


    I don't think you know what a computer model is. When people use that phrase, they are often describing a way to make a model that includes predictive abilities that can be tested.

    What you seem to be complaining about is data visualization. Do you think that anything short of looking at a string of numbers is a confirmation bias generator? Even for a line graph you need to set the axis sizes and scales. Why is defining a range of colors to represent the numbers from 0 to 1 any different?

    There are, of course, ways to manipulate data visualization, but a good description of image visualization parameters along with standards in the field can prevent a good bit of bias.

  • petrossa

    Please don't patronize. I retired at 45 after making a small fortune building computer models for a living.

    Trust me, i know what a computer model is, and fMRI is one. It models the oxygenation of the brain based by analyzing a stream of noise interspersed with 'relevant' data. What's 'relevant' get's decided by the various parameters.
    This introduces vast opportunities for confirmation bias by tweaking those parameters.

    It's not reality, it's a model of reality. Done by a mathematical model captured in a computer program. I.e. a computer model.

  • bsci

    Since you are obviously an expert on computer models, could you give me an example from any quantitative finding in modern science that you wouldn't consider a computer model?

  • petrossa

    Look, you are using a tool. It uses statistical methods among many other systems to produce a visualization of what is supposedly happening 'realtime' in the brain.

    Evidently what you see on the screen isn't really what's happening 'realtime' in the brain. It's an approximation produced by a theoretical model, driven by a hefty computer program.

    It isn't the brain you see, it's the virtualization of the brain you see. You see the result of the model of the brain in software superimposed with extremely massaged data.

    You have absolutely no way of knowing what really goes on in there, without cutting it open and pushing electrodes in the thing.

    This for example:

    I’ve been recently working with a colleague in Holland named Jack van Honk who's a physiologist, psychophysiologist, who's discovered a very unique population in South Africa. This is a population with a genetic disorder called Urbach-Wiethe. This is a development disorder where, early in development, no one yet knows how early, the amygdala, which I mentioned before, begins to calcify bilaterally, both sides of the brain. By the time these people are adults, they have no amygdala.

    Now if you put these people under your fMRI and show them fear invoking images you can be very sure the amygdala isn't going to light up. Still they have fear responses.

    How on earth or you going to find out where to look with your fMRI? It could be anywhere, it could be a distributed neural network that has taken over the role of the amydala that falls below the threshold. Or maybe the amygdala doesn't do what everyone assumes it does.

    So you'd conclude from the data available they don't respond to fear invoking images. Still they do. Your 'model' of the brain doesn't work.

  • Neuroskeptic

    You have absolutely no way of knowing what really goes on in there, without cutting it open and pushing electrodes in the thing.

    Unless you, say, had some way of measuring blood oxygenation via the use of magnets and… oh hang on.

    As I said in a previous comment, in some areas of the brain, the BOLD signal is manifestly tracking the stimulus. You don't even need stats to see that it's happening in the primary sensory cortex. You just look at the line.

    fMRI has been used alongside other ways of measuring neural activity like electrophysiology and PET; the results are complex but confirm that BOLD is doing roughly what we think it is.

    “Still they have fear responses.”

    Actually people with Urbach-Wiethe disease have abnormal fear responses. Here's a quote from a recent paper:

    “There is evidence that the medial temporal calcifications caused by Urbach-Wiethe disease are not entirely congenital, but progressively develop over the course of childhood and adolescence … there is a growing consensus that the intracranial calcifications typically begin to emerge sometime around 10 years of age … This estimate is also consistent with what we know about the history of our two participants. Both reported occasional abnormal sensations (associated with feelings of anxiety or panic, as well as olfactory sensations) … around this age. SM’s autobiographical recollection suggests that she experienced fear prior to age 10, but not thereafter.”

  • bsci

    So recording some selective aspects of electrical activity in 50 of 1,000,000 neurons within a single brain region and extrapolating about what that region does relies on less assumptions than fMRI? What's worth analysing? Spiking rates? local field potentials? Frequency bands of LFP? Which method are you using to create the frequency bands? Don't forget about differences in phase synchronization between regions, but that would require selecting multiple brain areas and hoping you picked the right ones.

    Electrophysiology is definitely important, but, like fMRI, it has it's limits and assumptions. Measures of regional metabolism (fMRI, optical imaging, oxygen sensitive electrods) are another way to look at brain activity. Sometimes they match aspects of the electrical signal and sometimes they don't, but they're measuring something interesting that's changing in the brain.

    I also find the example of the Urbach-Wiethe is potentially a great example of fMRIs uses. If the amygdala is degenerating, what other areas are responding to events where we usually expect the amygdala? Unlike electrical methods we really can look at the whole brain to see what changes. It's also worth asking how one is supposed to study neural activity in a rare human population using electrodes.

    I know it doesn't take away from the actual example, but you realize you linked to a piece by Marc Hauser who was just found guilty of fairly serious academic dishonesty.

  • Johan Strandberg

    Thank you for an illuminating introduction to the field of fMRI analysis. My bogometer has always responded when fMRI was used as “conclusive proof” one way or another, and now I understand in more detail why I have to be skeptic, even when a study “confirms” one of my pet theories.

    Given that the data gets generated from ~10,000 voxels, that would mean that there are on average 10,000,000 neurons per voxel. (I'm probably off by an order of magnitude or two, but apparently that too would be in the noise.)

    Yowza! You can hide anything in that — intentionally or not!

    It reminds me of debugging a program with an AM radio with its antenna inside the computer. Yes, you can sort of tell what the computer is doing, and in some cases you can catch it in a loop, but the mental image you get from listening is so completely biased by what you expect to hear, that actual solid provable conclusions are naught.

    This is not unexpected. The ratio of gates to AM signal back in the late 1970's when I last tried this was maybe 100,000 to 1 — to be generous. The neurons to voxels ratio is far greater than that. And even though the data sets are not comparable, I suspect the risks of deluding yourself are.

    Neuroskeptic, when you wrote: “No, I tagged this one [“bad neuroscience”] only because it mentions the dead fish study.“, I assume you meant that the study points out the dangers in analyzing fMRI data, not that the study itself is bad neuroscience.

  • Neuroskeptic

    Johan: Right. The fish study is great – but it warns us about bad neuroscience.

    There are indeed many cells in each voxel. But what makes you think the single cell is the only useful level of analysis? A single cell is a simple machine. It takes some inputs, and produces an output. We understand the behaviour of single cells in a lot of detail. But we don't understand the brain – because the brain is a collection of lots of cells.

    Plus, the brain is organized topographically – different areas of the brain do different things. Visual input goes right to the back of the brain. Then more and more complex visual processing occurs as you move further forward – first lines and colors, then objects, then whole scenes. The brain isn't a homogeneous mass of cells.

  • petrossa

    @bsci & Neurosceptic

    1) Looking at oxygenation levels of the brain doesn't tell you AT ALL the same thing like sticking a needle in the messy blob. All it tells you there's more activity, not what that activity is busy doing. You infer that it's doing X, whilst it might be busy inhibiting another part of the brain doing Y.
    2) The Hauser link is the only english language link which alludes to the amygdala research being done by the dutch guy. I speak/read dutch and had the opportunity to listen to one of his lectures. He is firmly convinced and has the proof that brain plasticity is so omnipresent that you can't really pinpoint universally area's which do X or Y. His bitter complaint is that he can't get his work published because it doesn't even get past the editorial board. 'Not of interest' he gets as answer.
    3) There is no way you going to find out a distributed neural network at work using present day fMRI. Just no way. You'd need a couple of months of supercomputer time to sift through the data for just one frame.
    4) fMRI is a crude way to somewhat guess what a brain is generally up to. The only way it can be used to determine higher order processes is by the researcher inventing a result and backfitting to the data.

  • Niv

    @ Petrossa

    The interpretation problem exists with measuring activity with electrodes as well. While in fMRI you measure the neuronal activity indirectly with blood oxygenation levels, which are affected from both pre- & post- synaptic activity (and other things as well) and with EEG electrodes you measure mainly local field potentials (LFPs), which are sensitive to pre-synaptic activity, with depth electrodes you measure mainly the spike activity.
    So, it turns out that you measure mainly the neuronal spikes, and not how they are created or later processed.
    Who's to say that's the relevant measure? Or the only measure?

    And the hypothesis checking issue (your #4) is relevant for all other measuring methods as well. The assumptions are simply made in different stages (like – where you insert the electrode, or what aspect of EEG is analyzed).

  • petrossa

    I guess I should have made more clear that 'sticking needles in a messy blob' was meant somewhat frivolous. To my mind the only way to fully get to grips with a brain is via the the 2 current major computer /brain simulations. I slightly favor the system were they grow the brain, as opposed the the method were they copy the brain.

    Given a basic neural network resembling that of a primate one should be able to make it develop faster then in nature and in so doing get an understanding of how it works.

    To my mind, whilst all very fascinating, the playing around with fMRI isn't the road to get to the bottom of how the brain functions.

    Still it makes for pretty pictures and quite out there conclusions. I read one were they 'concluded' that religious belief used the same modules as reason……

  • bsci


    You're making a reductionism argument. Why not take it further. We really won't understand how neurons grow in a petri dish if we don't know how all the ion channels work and we won't know they work until we fully understand atomic theory.

    It is completely possible to study multiple levels of a system in parallel. In fact, it's the only way science has ever advanced.

    Also, are you serious about computer modeling of neurons and growing brains in culture at the current pinnacle of research? They're being done and can make important contributions to knowledge, but I wouldn't consider either the gold standard for anything.

    I'll also note that you seem to be a bit confused on the difference between assigning specific functions to brain regions and plasticity. There's no question that given a shock to the normal system (genetic, disease, or trauma), the brain, particularly in children, is great at reorganizing. That doesn't mean “you can't really pinpoint universally area's which do X or Y” in healthy people.

    You knock out the visual cortex and vision will be severely disrupted. A neurologist sees a certain combination of symptoms and can be pretty sure there's a tumor near the hypothalamus. The mappings aren't perfect, but we can do a darn good job pinpointing universal areas for quite a few functions.

  • petrossa

    I'm talking about the projects were neural networks are grown using software.
    Blue Brain Project, Brain-i-net

    Which is a quite realistic way, at this time only limited by the capacity of the computers involved.

    Growing biological networks is pretty pointless. It grows by the trillions in animals already.

  • bsci

    Which is a quite realistic way, at this time only limited by the capacity of the computers involved.

    And limited by our knowledge of: cellular structures and cellular organization and anatomical connections between regions and functional connections between regions and interactions between neurons and the body, etc. All of which, many measurement methods (including fMRI) play a vital role in our understanding.

    I suspect even the blue brain project people would laugh you out of the door for suggesting computer simulations don't depend on empirical measurements.

  • petrossa

    The 'computerpeople' GROW the neural network. As in nature. The only difference is the substrate. That's how neural networks work. They selfteach. Or are you under the impression that the live brain was created by 'measurements'?

    There are 2 major projects going on, the one were they have neural networks grow in software and the one where they copy literally neuron by neuron slices of brain into software.

    The latter might fit your vision, but it will please you to know it's not a fast starter.

    The other one already has working mammal brains on a virtual basis and as the creator himself stated: all it needs is computerpower and lot's of money.

  • Neuroskeptic

    Petrossa: But how is growing a brain (on a computer or a dish) going to advance our understanding of the brain?

    I could grow a brain: get my cat to have kittens. That would be five or six little brains actually. But they wouldn't teach me very much unless I did some experiments on them.

    Growing a brain would make it possible to do some very interesting experiments but it's not going to suddenly reveal all the mysteries of the brain in itself.

  • bsci

    The concept of growing networks in software is good. Still, from the neuroscience perspective, it's at best a hypothesis generation machine. They grow as realistic a network as possible. Examine the outputs compared to real neuron networks and try to make the two systems as close as possible. It still relies on data collection.

    If the goal is just to make an interesting automated learning system, that's cool and can be practically useful, but it doesn't tell us anything about how the brain works.

  • petrossa

    It's real actual growth. It grows, it does really exactly the same what wetware does. It's not a copy of, but an original.
    The goal is to make a working functional autonomous brain. Sofar they have a part of a rat's brain working. Baby steps due to lack of processing power and still immature software.
    But the proof of concept is there and working, so as with any endeavor it's only bound by money and time.

    Imo for neuroscientists this is the motherlode. You can mess about in a real brain without ethical issues. If you mess it up, you just restore the original and recommence.



No brain. No gain.

About Neuroskeptic

Neuroskeptic is a British neuroscientist who takes a skeptical look at his own field, and beyond. His blog offers a look at the latest developments in neuroscience, psychiatry and psychology through a critical lens.


See More

@Neuro_Skeptic on Twitter


Discover's Newsletter

Sign up to get the latest science news delivered weekly right to your inbox!

Collapse bottom bar