Education, tips and tricks to help you conduct better fMRI experiments.
Sure, you can try to fix it during data processing, but you're usually better off fixing the acquisition!

Thursday, June 23, 2011

Physics for understanding fMRI artifacts: Part Six

Practical issues arising from the use of the Fourier transform in MRI

Here's the plan for this post. We will complete our look at functions undergoing Fourier transformation; there are some really useful relationships to see and to commit to memory (even when the figures are hand drawn for expediency!). Then we will look at the effects of the FT on real signals. We have two issues to consider: 1) a finite sampling window, and 2) digitization. Off we go!

Fourier pairs

We saw in the last post (Part Five) how a single frequency - a sinusoid - can be represented by a single line - a delta function - in a frequency domain plot. This is an example of a Fourier pair because the relationship holds both ways, i.e. if you take a delta function in the time domain and FT it you get a sinusoid in the frequency domain, and vice versa:

What about other useful Fourier pairs? Here's a useful relationship. An exponential decay Fourier transforms into what's known as a Lorentzian line:

Again, remember that the exponential can be in either the time domain or the frequency domain, although in MRI we generally deal with exponential decays (signals) in the time domain. It's also worth pointing out here that the faster the exponential decay, the broader the Lorentzian line in the other domain. This inverse relationship has a number of practical consequences for fMRI. I'll come back to this point below.

I found an interactive online tool on the National High Magnetic Field Lab's website that allows you to change the rate of decay as well as the frequency of an oscillation in the time domain, and see the resulting Lorentzian line in the frequency domain. Tinker with it here. (It's Java, it takes a couple of seconds to load.)

Next, let's look at what could be arguably the most useful Fourier pair for MRI. A boxcar (or top hat) function Fourier transforms into a sinc function, where sinc(x) = sin(x)/x:

Wednesday, June 15, 2011

Physics for understanding fMRI artifacts: Part Five

An introduction to the Fourier transform - what it does and how it works

Moving along from bathroom design and complex numbers, it's time to look at one of the most fundamental mathematical relationships underpinning all of modern MRI: the Fourier transform (FT). Accordingly, I would strongly suggest that you make sure you fully understand everything in this post before continuing into future posts.

You may not believe it by looking at us, but take it from me that MR physicists do "mental FTs" every day as we compare pulse sequences, try to understand artifacts and so on. Many of us (me) are not mathematically inclined, either. But being able to switch your mind between domains, as they are called, is a really useful skill if you want to be good at artifact recognition. An MR physicist will see something in one domain and will immediately try to imagine how it would appear in the alternate domain. Thus, if an image contains an artifact - an intense stripe, say - the MR physicist tries to imagine what signal-acquisition domain feature is implied by it, then tries to track it down. Alternatively, when comparing two different pulse sequences - GRAPPA on versus GRAPPA off, perhaps - the MR physicist will project the implications of each into the image domain in order to comprehend the likely practical consequences. You don't have to remember the equations or even understand the maths itself, but it is really useful to grasp the concepts!

Fourier analysis: the art of decomposition

As you have seen in your introductory texts and in previous video lectures, MRI signals are actually time-varying voltages that are induced in receiver coils as a result of magnetization oscillating (precessing) about the polarizing magnetic field. The detection of time-varying signals has several implications for obtaining MR images, the very first of which is choosing a representation for the information content in the signals.

Consider the two waveforms on the left-hand side of the figure below, which have the same amplitude but differ in their frequency:

Courtesy: Karla Miller, FMRIB, University of Oxford.

It is possible in principle - and in practice for simple examples such as these - to take a ruler and measure the amplitude and frequency and then draw a graph representing the time varying signals as a plot of amplitude (along y) against frequency (along x), as shown on the right-hand side of the above figure. Piece of cake, right?

Monday, June 13, 2011

Discriminate equally when recruiting subjects

Inclusion and exclusion criteria possibly don't get the scrutiny in fMRI studies that they should. After all, who reports the complete criteria in the methods sections of articles? At best we get headline exclusions. Without the full questionnaires we, as readers (and reviewers), must trust that no biases were introduced accidentally. Yet, like subtle parameter (mis)settings on the scanner, precisely how experimental and control groups are established is going to have profound effects on your results. They'd better!

A study included in Neuroskeptic's extremely useful weekly roundup of neuroscience makes the point of group bias quite clearly with a hypothetical example, and highlights the possibility that in selecting healthy controls we might accidentally set the bar higher than for the target group, introducing a potential confound to the experiment: Beware the "super well" - why the controls in psychology research are often too healthy.

Obvious? It should be, to a careful experimentalist. But there are insidious ways this selection bias can creep into your studies, making the point worth repeating ad nauseam in my opinion, especially to the waves of newcomers to our field. (Preach this lesson to all incoming students!) I'm going to make the unsubstantiated statement that subject selection (and its alliteration!) ranks above both acquisition and post-processing methods when it comes to biases and the ability to get an incorrect result with fMRI. It's critically important to balance physiological as well as psychological profiles as closely as possible between experimental and control groups.

The insidious biases? Whenever one or other group is difficult to recruit, for demographic reasons or whatever, there is a tendency to let certain things slide in order to net the requisite total. Don't cut this corner! Match as many factors as you possibly can, then note any factors that you can't match and include them in your experiment as covariates of no interest. In this way you might avoid the embarrassment of interpreting a neural difference for something that is better explained by physiology; hematocrit levels, say.

Remember, your fMRI experiment starts when you start recruiting subjects. And the less rigorously you do this fundamental, crucial step the more likely you are to get big error bars, or worse. Even I can't help your data at that point!

Friday, June 10, 2011

If Blogger designed bathrooms... can bet they would insist on power outlets over the bathtub. And two in the shower. (You never know when your laptop might get low on battery.)

Until they move into the construction industry, however, we must content ourselves with their software design skills, such as this gem: 

The "Screw your career six ways from Sunday button," a.k.a. the Publish Post button, is carefully placed well away from any button that you might want to use on a repeated basis for other reasons entirely. This layout is cunningly designed for blogging highly contentious posts; the sort where in your draft you might write reminder notes to yourself. Like, say, "Make sure you reference Mike Dood's crappy article on neologisms. Utter bollox!" These notes are, like Tweets from a congressman to female college students, designed to be confidential. You don't want them accidentally distributed to three billion random strangers just because you pushed your finger on the click pad a little too far to the left after that second glass of red wine, for instance. (Yeah, picky I know.) And you'd rather Mike Dood - a colleague in your department - didn't know your true feelings on his work, either. *

Ah, Blogger. Bless. Did James Bond ever have to put up with this sort of crap from Q, I wonder? I don't recall the eject button ever appearing in between the seek button on the radio and the cigarette lighter. Not even on the Lotus Esprit. And I'm sure James would have pointed it out if it had. Not exactly the most robust design, to be honest. ("Ah! Country music! I can't handle that. Let's see what else we can get out here in...  Fuuuuuu...!")

* Recovering from accidental publication is as simple as rushing to the Edit Posts page and deleting the offending post, then starting again from scratch now that you have just trashed all your work, all the while praying that not too many people just got e-notified of your new post and managed to see it (and cache it!) before you were able to hit Delete.

Physics for understanding fMRI artifacts: Part F(f)our

(Wondering why the title has F(four) in it? It's so that Blogger can't trash this post for a third time! I'm giving it a new, unique name. Ha!)

It's finally time to get back to the series of posts on the essential physics concepts that will allow you to interpret and differentiate between acquisition artifacts. There are another five or six posts in this background series, so bear with me. After that we will shift gears and look at "good data," taking some time to assess the normal variations that you can expect to see in time series EPI, and then I promise we'll look at artifacts themselves.

When reality meets imagination

Before we go any further there are a few mathematical properties we need to review. These are actually quite simple relationships that, for the most part, can be explained via a handful of pictures. Like this one....

Maths dude, chillin'.

Complex numbers

The name notwithstanding, complex numbers are quite straightforward to understand from a physical perspective, with a tiny bit of explanation. By the time you've finished reading this post you should have a basic idea of what complex numbers mean and where they come from (they arise quite naturally, as it happens), but for now I am simply going to define some relationships. Hang in there.

We start by defining a so-called imaginary number as any number for which the square is negative. The squares of real numbers - the ones you're used to in everyday life, such as 2, 8.73, -7, pi, and so on - are always positive, whether the number being squared is positive or negative. Thus 2x2 = 4, 8.73x8.73 = 76.2129, -7x-7 = 49 and so on. Squaring a negative number results in a positive number. So how could we possibly get an answer of -4 or -25 out of any square?

Open letter to Blogger

Blogger, you suck. You utterly suck. You have some major bugs in your software which have caused me to waste inordinate amounts of time recreating posts that oscillate between draft and published status. And when I submit a technical help request I hear nothing. For weeks.

Just now I hit SAVE AS DRAFT on a published post. No big deal you would think, right? I simply went back and hit PUBLISH POST again. And voila! The post showed up on the blog still marked as having been published on Sunday 5th June.... Ah, except that now the post's *content* has reverted to a draft from before 15th May! This, even though I have the archive frequency set to "Daily" after tuifu (Google it) on Friday 13th May. WTF?????

Lucky for you, rather than get in my car and drive down to Mountain View to find out who is in charge of this fiasco, I have a backup of my own. So "all" I have to do is re-type the content and re-upload those images that your bug sought to send back into the ether. Doubly lucky for you, I have an extra few hours of time this morning, having canceled a meeting earlier on. So this isn't nearly the crisis that it could have been, and it is only mildly increasing my blood pressure.

Now that I know what a piece of crap your software really is, I shall be taking other remedial steps to avoid similar snafus in the future; such as never, ever actually publishing a draft with the same name as a real post. Instead, I shall create drafts with names like, oh "Draft," and then when I am ready to actually publish the post I shall create a brand new one, with the intended title, and push that puppy out there. I want to see you bite me in the ass then, Blogger. Come on, give it your best shot!



Sunday, June 5, 2011

Memorial to an old post

This used to be the post entitled "Physics for understanding fMRI artifacts: Part Four." I had so many problems getting the draft published that I decided I wouldn't risk deleting this actual post, even though I have changed the title and the content. Wherever this thing points inside the "cloud" at Blogger, I want to seal it off like a leaky nuclear reactor and leave it for eternity, hopeful that it will be unable to infect any subsequent posts once it's buried in metaphorical concrete.

The replacement post, "Physics for understanding fMRI artifacts: Part F(f)our" is here.

I hadn't realized til recently just how flaky cloud computing can be. Clearly xkcd is way ahead of me, as usual:

 The Cloud.

(Stolen with his blanket permission from