Contrasts in SPM (with Outtakes!)

We have come to the end of the preprocessing pipeline, and lurch across the finish line with a discussion of contrasts. Often researchers will calculate the difference in beta estimates between two conditions (in SPM, the beta_000?.img files), and also determine whether the difference is significant or not. At the single-subject level both the magnitude of the beta estimate and the variance of the estimate is calculated for each condition, and then t-tests can be performed on these beta estimates by weighting them. For example, the contrast of [1 -1] for Left vs. Right button presses will subtract the beta estimates for the Right button presses from the Left button presses, similar to a paired t-test. A t-statistic is then calculated at each voxel using the following formula:


Where gamma represents the contrast vector (in this example, [1 -1]) and B-hat represents the beta estimates for each condition. The degrees of freedom for a single-subject analysis is based on the number of time points; although, since nearby timepoints share a high degree of correlation, the actual degrees of freedom is pared down to compensate. With most standard processing streams, the variance associated with a beta estimate is discarded when carried to a higher-level analysis, although programs such as FSL's FLAME and AFNI's 3dMEMA take this variance into account when weighting group-level estimates.

Details about how to perform a simple t-contrast in SPM are shown in the following video. The first twenty seconds or so is an outtake where my microphone fell over; we sure like to have fun around here!



Insights into the Vegetative State Using Humor


A few days ago I stumbled upon an article talking about Adrian Owen's work with vegetative state patients, and in an instant I was mentally transported to my sophomore year of college, when I first read one of his papers. I remember it like it was just yesterday; an unseasonably warm and humid May afternoon in my cognitive psychology class; just outside the window, you could hear the whine of the midges intermingling with the screams of children, and everywhere the Minnesota foliage was pullulating into life, those emerald prairies and celadon canopies of the Arboretum soaking up as much water and air and oxygen as they required. And in front of us at the head of the classroom stood imperious Professor Brockton, his left hand bepurpled with a chemical burn from an unknown wetlab incident, that crazed stain traveling up his palm and disappearing within the cuff of his neatly pressed Stafford shirt, leaving us to wonder exactly how far it went before terminating.

But above all, I remember discussing in class that day how neuroimaging had provided some evidence that patients supposedly in comas and vegetative states could still process information from the outside world, such as being asked to imagine playing tennis, which, to me, was astonishing. It was at that moment I had an epiphany and realized what I wanted to do with my life; I wanted to be - a professional tennis player.

No, wait! I meant, a cognitive neuroscientist. Kind of like a regular neuroscientist, except with an additional term to set us apart and let everyone know how special we are.

In any case, Owen has gotten a lot of press in the past few years conducting these types of experiments on people in vegetative states. Specifically, he uses paradigms where he scans individuals while asking them to imagine doing different tasks, such as playing tennis, going around different rooms of their house, and neuroscience blogging. The results were striking: subjects in a vegetative state, who otherwise have no way of communicating with anyone else, showed similar patterns of brain activity to healthy controls who imagined the same scenarios, suggesting that they actually could understand what was going on around them, even though they couldn't talk or move their limbs. A similar procedure was then used to ask yes/no questions to the patients, and see whether they could respond by selectively increasing blood flow to certain regions of the brain through thinking about specific things; and now, the next obvious step - at least in my mind - is to use this to figure out which part of the patient's body is itchy. (Seriously, think about it; you talk about helping people, this is where you start.)

More recently, Owen has investigated whether these same subjects are able to understand and appreciate humor. For example, he scanned the subjects while presenting them with humor - puns, wordplay, reading Andy's Brain Blog - and observed whether the patients responded similarly to how normally functioning individuals process humor. Elevated levels of activity were found in the frontal lobes and limbic system the funnier the joke was; and once you start throwing around terms like "limbic system", you know it's gotta be true.


SPM Design Specification and Estimation

At long last, after several long minutes - perhaps hours - or grueling preprocessing, you are ready to specify your general linear model. The concept is straightforward enough: Specify when a certain condition happened, input how long that condition took to happen (zero duration in the case of an instantaneous event), and what kind of basis function you want to convolve with that condition. Basis functions is a topic all on its own (you'll find out more when you're older!), but for the time being, realize that the canonical hemodynamic response function will suffice for most of your cases; even though sometimes it is a laughably wrong assumption about the shape of your hemodynamic response. But hey, it's the best we've got.

More details on the ins and outs of model specification, along with an example of what might be going through your head as you do this, can be found in the following video.


SPM Official (!) Videos

Now in video form!


I don't know how I missed this, but apparently there are official SPM videos up on the SPM website (if you can believe it) - very similar to what I have been producing the past few months. It still eludes me how they managed to steal my idea over a year before I implemented it, but there you go. I haven't actually watched the casts; more like, I've skipped around to a few points in each, with the sound off, because I'm considerate and I don't want to disturb my labmates. (They have also threatened to beat me up and give me a swirly if I unmuted the volume on my computer.)

In any case, although conspicuously lacking the raw sex appeal of my tutorials, these guys still seem to do a good job in explaining the software and the concepts behind it, even if they do tend to speak at times with an accent. "If the sound is off, how do you know they speak with an accent?" It's called being cultured. (Turns up Enya; begins getting pummeled by labmates.)


A link to the videos can be found here; not that I'm insecure or anything, but please don't allow them to replace me.

Smoothing in SPM: The Do's, Dont's, and Maybes


Different sized smoothing kernels applied to a functional dataset. Note that larger smoothing kernels cause a loss of spatial resolution by turning the relatively high resolution, jagged-edged dataset in the upper left, into the soft, puffy, amorphous cotton ball in the lower right.



Smoothing is one of the most straightforward processing steps, simply involving the application of spatial filtering to your data. Signal is averaged over a range of nearby voxels in order to produce a new estimate of the signal at each voxel, and the range can be narrowed or extended to whatever range suits the researcher's delectation. It is rare for this step to fail, as it is not contingent on overlapping modalities; nor is it susceptible to typical neuroimaging landmines such as entrapment in local minima. Furthermore, the benefits are several: True signal tends to be amplified while noise is canceled out, and power is therefore increased. As a result, often this step is thrown in almost as an afterthought, the defaults left flicked into the "On" position, and quickly forgotten about, as the researcher scampers out of the lab and into his Prius for a quick connection before dinner.

However, smoothing can also be deceptively treacherous. For those researchers intending to tease apart discrete cortical or subcortical regions - for example, the amygdala, if you're into that kind of thing - will find that smoothing tends to smear signal across a wide area, leading to a reduction in spatial specificity. Furthermore, ridiculously large smoothing kernels can actually lead to lower t-values in peak voxels. This may appear to be counterintuitive at first; however, note that increasing the range of voxels can begin to recruit voxels which have nothing to do with the signal you are looking at, and can even begin to average signal from voxels which have an opposite deflection to the signal you are interested in.

Effect of smoothing kernels on statistical results. Here, a contrast of left-right was performed on datasets smoothed with a 4mm kernel. Note that as the smoothing kernel increases, the peak t-value decreases, as depicted by the thermometer bar.
8mm kernel
15mm kernel


For example, let's say we are interested in the contrast of left button presses minus right button presses, as pictured above; as we increased the smoothing kernel, more and more voxels become part of the big blog - I mean, blob! - and it appears that our power increases as well. However, as we extend our averaging over a wider expanse over the fields and prairies of voxels, we risk beginning to smooth in signal from white matter and increasingly unrelated areas. At the most extreme, one can imagine smoothing in signal from the opposite motor cortex, which, for this contrast, will have strongly negative beta estimates.

Your sensitive FMRI antennae should also be attuned to the fact that smoothing can be applied at different magnitudes in the x-, y-, and z-directions. For example, if you are particularly twisted, you could smooth eight millimeters in the y- and z-directions, but only six millimeters in the x-direction. This also comes into play when estimating the smoothness of a first- or second-level analysis, as the smoothing extent may differ along all three coordinates.

For more details, along with a sample of my writing style as a younger man, see the following posts:

Group Level Smoothness Estimation in SPM

Smoothing in AFNI



Stage Fright



And there you idly sit by the exit sign off of stage right, waiting for the auditorium to fill up; a gradual crescendo in mutterings, greetings, tappings on keypads as the audience swells and the air becomes charged with a strange electricity. Check your watch; only a few minutes remaining. No time to go get a drink or squeeze the lemon; everything you have on you and inside you, goes with you out onto the stage. In a cruel trick of nature, the hands become clammy and cold; those precious extremities that you need under these extreme conditions seem to rebel against you, as the lily-livered blood is able to squirrel itself away deep within your core while the rest of your exposed, unfortunate flesh has nowhere to hide while it faces the enemy. Deserters! Turncoats! Traitors!

Suddenly you become aware of the stage technician repeating a question to you, his tone more insistent; he could have been talking for ages, as far as you're concerned. You nod to him, and the house lights are extinguished - ker-chunk, ker-chunk - you take one deep breath - make that two deep breaths, an additional one for good measure - and walk out onto the stage. The applause rumbles and swells and for a few moments it is a supremely pleasant experience, standing there in the blinding klieg lights and completely unable to see anyone in the audience, only hearing the disembodied plaudits and cheers of the crowd. The walk-on and bow is incredibly easy for any fully functioning, ambulatory being, and were it up to me I would continue to stand there and bow, and let the applause continue.

But it is only a short bow - two bows, an additional one just to make sure - and then its time to seat yourself down on the firm black vinyl of the bench, briefly imagining what other callipygian musicians have sat there as you mindlessly twist the adjustment knobs on the sides. Up a little, down a little, to the side a little, if that option were present. Place your hands upon those surprisingly cool keys, while wondering whether the tremors quivering throughout your body are noticeable by anyone else, or merely insensate. Lastly - and this is the benefit of performing chamber music with a fellow sufferer - you make eye contact with your partner and nod. And then away you go.

As I am happy to rediscover every time, the actual performance is never as horrific as it is played out in my most disturbed nightmares; and although it presents its fair share of anxieties and mistakes and recoveries, it is, on the whole, tremendous fun. The well-timed execution of choreographed looks and gestures, the spontaneous phrasings that you would never have imagined possible, the beautiful chiaroscuro of the piano keys from the angled light, the feeling of having the audience completely enthralled - this is all that is needed to form a healthy and robust stage addiction.

And when the last note is played and the final cadence still reverberates through the air, those few pregnant moments before the cascade of applause are some of the most savory, delicious seconds I have ever had the pleasure of tasting. And even after all of that backbreaking preparation, the cold and windy walks to and from the practice building, the anxiety and worry and the acrid taste of adrenaline in the back of my throat - all I can do is look forward to the next time I hold such ecstatic, terrifying congress with the Muse.

Livestream Link

Just a quick update on the cello recital post yesterday: We have a livestream link for the show which will begin streaming at 5pm EST. http://www.ustream.tv/channel/ryanfitzpatrick

It begins with a solo Bach suite, then the Debussy cello sonata (which Wendelin will accompany), and then a couple of pieces by Respighi and Schumann (which I'll be accompanying for). Click on the link at 5pm, and you should be able to see everything that's going on!

AFNI Bootcamp: Feburary 25th - March 1st


A spectre is haunting America - The spectre of AFNI. A few times every year the good people at the National Institutes of Health (NIH) hold an AFNI bootcamp at various locations around the country and around the world, attempting to teach, persuade, proselytize, inveigle, and coax young FMRI neophytes into using their product. And, fortunately for the rest of us, sometimes these bootcamps are held at the NIH itself, and these are open to any interested researcher.

I went to one of these bootcamps last spring, and it was an eye-opening, pupil-dilating, sphincter-tightening experience. For five full days we talked about, discussed, and analyzed data; and the nerd bacchanalia continued to rage underneath the carmine streaks of the westering sun. Normalization, connectivity analyses, surface mapping, carousing, bear-baiting, and wenching followed upon these lectures as surely as gout follows upon vice; and although I cannot remember anything that was said or taught during these sessions, I do vividly remember how I felt, which was - kind of sore.

Your ticket to paradise can be found here. Registration tends to fill up very fast, so I recommend submitting an application as soon as possible. Most important, the entire event is free (minus your tax dollars). You will, however, have to pay for your own travel, meals, Nutella, and sketchy Travelodge room.

Senior Cello Recital



Tomorrow, Saturday, December 1st, at 5:00pm, I will be accompanying a cellist for his senior recital at Recital Hall. We've put a lot of work into the program, and we think it'll be a great show! (Actually, it has to be, or we don't get paid.) In any case, the music is guaranteed to entertain, enliven, edify, etiolate, and shock the listener; and we hope that you enjoy it as much as we've enjoyed putting it together!

What: Senior Cello Recital, featuring the music of Bach, Debussy, Respighi, and Schumann
Where: Recital Hall, Jacobs School of Music (1201 E. 3rd Street)
Who: Ryan Fitzpatrick (cello), Andrew Jahn & Wendelen Kwek (piano)

Link to the Facebook invite can be found here; we're working on getting up a livestream, which will be posted as soon as it's available.

Manual Talairach Normalization in AFNI

Back in olden times, before the invention of modern devices such as computers and slap bracelets, brain researchers relied on standard coordinate systems as a guide to brain anatomy. One of the most enduringly popular of these was the Talairach coordinate system, based on the brain of a deceased elderly Frenchwoman; the origin of this space was located at the anterior commissure, and both the anterior and posterior commissures were then set on an even plane. Other brains could then be similarly oriented, warped, squashed, stretched, and subject to varied forms of torture and abuse until they roughly matched the Frenchwoman's.

These days, we have computer algorithms to do that for us; and although all of the leading FMRI packages have tools to perform these transformations automatically, there are still ways to do it by hand with AFNI. The following tutorial video shows you how to do it in excruciating detail, including how to locate the AC/PC line with ease, how to find the mysterious "Define Markers" button, and why the Big Talairach Box should be checked - no matter what.

Experience the way they used to do it, either out of a desire for nostalgia or masochism. The video is rather long (I try to keep them bite-sized, delicious, and under five minutes), but long procedures require long demonstrations; if nothing else, you may find the nascent stirrings of intimacy you begin to experience with your data a satisfying surrogate for the painful void of intimacy in your own life.