SPM Tutorial: Creating Contrast Images

Those of you who have ever entered a string of ones and negative-ones in SPM's contrast manager were creating contrast images (simultaneously converted into T-maps or F-maps), whether you knew it or not. It can be difficult to see exactly what is going on, but as part of creating a statistical map, SPM calls upon its mathematical tool, spm_imcalc_ui (or just spm_imcalc; but I find spm_imcalc_ui easier to understand and to use, and therefore I will focus on it).

While using the contrast manager is useful for creating relatively simple single-subject maps, you may want to then create images from those simpler images; for example, let's say you have created functional connectivity maps, but want to take the difference between two of those maps and feed the resulting contrast map into a second-level analysis. spm_imcalc_ui allows you to do this easily, and can be scripted, saving you precious time to do more important things, like take pictures of that cucumber salad sandwich or whatever you're eating and load it onto Twitter.

spm_imcalc_ui requires at least three inputs:

  1. A matrix of input filenames;
  2. An output file;
  3. A mathematical operation to perform on the input images.

As a simple example, let's say we use the contrast manager to create two contrast images, con_0001.img and con_0002.img. Let's then say that we want to take the difference of these image to use in a second-level analysis. First, it is usually easier to assign a variable name to each file:

P1 = 'con_0001.img'; P2 = 'con_0002.img'

And then input these into spm_imcalc_ui:

spm_imalc_ui([P1; P2], 'outputImage.img', 'i1-i2'

Note that the third argument, i1-i2, calls upon reserved SPM keywords, i.e., "i1" and "i2". i1 refers to the first input image, i2 refers to the second input image, and so on.

That's really all there is to it; and from this example you can simply add more images, and perform more complex operations if you like (e.g., make one an exponent of the other, i1.^i2). Furthermore, when you have several runs, using the contrast manager can quickly become unwieldy; you can use the contrast manager to first create an image for a single regressor by positively weighting only those betas in each run corresponding to your regressor, and then when these images are created, use spm_imcalc_ui to make your contrast images. As stated previously, this allows for more flexibility in scripting from the command line, potentially saving you thousands of man-hours in cucumber-sandwich-photo-taking endeavors.



FSL Tutorial: Creating ROIs from Coordinates

Previously we covered how to create regions of interest (ROIs) using both functional contrasts and anatomical landmarks; however, FSL can also create spheres around voxel coordinates, similar to AFNI's 3dcalc or SPM's marsbar.

  1. Step one is to find the corresponding voxel coordinates for your MNI coordinates, which may be based on peak voxel activation from another study, for example; to do this, open up FSLview, type in your MNI coordinates, and write down the corresponding voxel coordinates (these are shown in the bottom-left corner of FSLview). 
  2. After you have written down your voxel coordinates, create a point at those coordinates using the fslmaths command. This command requires the template space that you warped to, as well as the actual x-, y-, and z-coordinates corresponding to the MNI coordinates. Give the output file a name, and make sure that the output data type ('odt') is set to float. (Example command: fslmaths avg152T1.nii.gz -mul 0 -add 1 -roi 45 1 74 1 51 1 0 1 ACCpoint -odt float)
  3. Using fslmaths again, input the file containing the point created in the previous step, and specify a sphere of radius N (in millimeters) to expand around that point. Use the -fmean command, for reasons that are to remain mysterious, and provide a label for your output data set. (Example command: fslmaths ACCpoint -kernel sphere 5 -fmean ACCsphere -odt float)
  4. Update on 5/18/2016: To make it a binary mask, execute one more command: fslmaths ACCsphere.nii.gz -bin ACCsphere_bin.nii.gz. The previous step creates a sphere, but with small intensities; this can be problematic if you do a featquery analysis that allows weighting of the image.

Once that is all done, use fslview to open up a template in your normalized space, and overlay your newly created sphere; double-check to make sure that it is in roughly the location where you think it should be. Now you can extract data such as parameter estimates from this ROI, using techniques similar to those covered in previous tutorials about ROIs.

Thanks to alert viewer danieldickstein, which, due to its juvenile reference to the male member, cannot possibly be his real name. Grow up, Daniel.


Abstraction and Integration in Lateral Prefrontal Cortex



Recently the journal Cerebral Cortex accepted one of our lab's papers for publication, which has made me ecstatically, deliriously happy. This represents one of the highwater marks of my publishing career, even greater than the erotically-tinged agitprop novel I published serially in my college's Pravda-inspired newspaper. Entitled A Long Caress: Twilight of the Capitalist Idols, the book followed the lives of two dreamy radicals pursued by the CIA, of which I provide an excerpt:

Boris laid aside his Chernyshevsky pamphlet and looked at Olga. Hearing his declaiming against the capitalist dogs had brought her to a fever heat; and now, as he watched her, he noticed the graceful curves of her neck, brought into relief by the delicate strands of jet-black hair gently brushing against her collarbone and the edges of her heaving bosom. She gazed at him adoringly, sloe-eyed, her cheeks flushed, the glistening sweat making her Party-issued uniform cling to her skin like fuzz on a peach. Around her waist he wrapped his strong, powerful arms, and she offered herself up like a prize.

A few miles away in an underground bunker, all of this was transmitted through a hidden wire to CIA agent John Davies. Pressing his headphones closer to his ears, Davies frowned. "Blimey," he said.

While our new paper does not come close to the rhapsodic heights of A Long Caress, it still goes a long way to resolving fundamental issues with studying different forms of abstraction. One form of abstraction, temporal abstraction, refers to maintaining information over time, with more remote events requiring correspondingly greater levels of temporal abstraction; while a related form of abstraction, relational abstraction, refers to processing higher-level information, such as complex features of stimuli. Unhappily, they are often confounded in the same experiment. This study attempted to tease apart both of these forms of abstraction, as well as independently assess the effects of integration, wherein several different pieces of information need to be collectively processed in order to make a correct response. Temporal abstraction was nonexistent, while relational abstraction effects were found in lateral premotor cortex and rostrolateral prefrontal cortex. Integration was associated with increased activation in superior frontal sulcus and frontopolar cortex, consistent with this region's handling more abstract representations between items.

A link to the paper can be found here. Documentary footage of Stalin ordering the deaths of his generals and field marshals can be found in the following video.


The Noose Tightens: Scientific Standards Being Raised

For those of you hoping to fly under the radar of reviewers and get your questionable studies published, I suggest that you do so with a quickness. A new editorial in Nature Neuroscience outlines the journal's updated criteria for methods reporting, which removes the limit on the methods section of papers, mandates reporting the data used to create figures, and requires statements on randomization and blinding. In addition, the editorial board takes a swipe at the current level of statistical proficiency in biology, asserting that

Too many biologists [and neuroscientists] still do not receive adequate training in statistics and other quantitative aspects of their subject. Mentoring of young scientists on matters of rigor and transparency is inconsistent at best. In academia, the ever-increasing pressures to publish and obtain the next level of funding provide little incentive to pursue and publish studies that contradict or confirm previously published results. Those who would put effort into documenting the validity or irreproducibility of a published piece of work have little prospect of seeing their efforts valued by journals and funders; meanwhile, funding and efforts are wasted on false assumptions.

What the editors are trying to say, I think, is that a significant number of academics, and particularly graduate students, are most lazy, benighted, pernicious race of little odious vermin that nature ever suffered to crawl upon the surface of the earth; to which I might add: This is quite true, but although we may be shiftless, entitled, disgusting vermin, it is more accurate to say that we are shiftless, entitled, disgusting vermin who simply do not know where to start. While many of us learn the basics of statistics sometime during college, much is not retained, and remedial graduate courses do little to prepare one for understanding the details and nuances of experimental design that can influence the choice of statistics that one uses. One may argue that the onus is on the individual to teach himself what he needs to know in order to understand the papers that he reads, and to become informed enough to design and write up a study at the level of the journal for which he aims; however, this implies an unrealistic expectation of self-reliance and tenacity for today's average graduate student. Clearly, blame must be assigned: The statisticians have failed us.

Another disturbing trend in the literature is a recent rash of papers encouraging studies to include more subjects, to aid both statistical reliability and experimental reproducibility. Two articles in the last issue of Neuroimage - One by Michael Ingre, one by Lindquist et al - as well as a recent Nature Neuroscience article by Button et al, take Karl Friston's 2012 Ten Ironic Rules article out to the woodshed, claiming that small sample sizes are more susceptible to false positives, and that instead larger samples should be recruited and effect sizes reported. More to the point, the underpowered studies that are published tend to be biased to only finding effects that are inordinately large, as null effects simply go unreported.

All of this is quite unnerving to the small-sample researcher, and I advise him to crank out as many of his underpowered studies as he can before larger sample sizes become the new normal, and one of the checklist criteria for any high-impact journal. For any new experiments, of course, recruit large sample sizes, and when reviewing, punish those who use smaller sample sizes, using the reasons outlined above; for then you will have still published your earlier results, but manage to remain on the right side of history. To some, this may smack of Tartufferie; I merely advise you to act in your best interests.

CNS 2013 Review

Last weekend marked my second attendance of the Cognitive Neuroscience Society conference, and I had a terrific time, each night full of drinking, wenching, gaming, brawling, dancing, freethinking, casuistry, and innumerable other vices. I dined on the best seafood that San Francisco had to offer, devouring breadbowls of clam chowder and pots of carmelized catfish and platters of sushi. I witnessed fights between sea lions, observed the Golden Gate bridge expand and contract in proportion to its temperature, and toured the Ghiradelli chocolate factory complex. Having access to a television for the first time in months, I watched the last half of S.W.A.T. and the first half of Face/Off, which, taken together, made for a satisfying, full-length action movie.

However, I also managed to find the time to go to some talks and posters detailing the latest findings in my field. A few trends I noticed:

1. Development and aging are hot right now, particularly since a large segment of the population is approaching old age and beginning to experience the effects of dementia, senescence, and increased irritability at perceived injustices, such as when your children fail to call you when they say that they will. I saw several posters looking at cognitive control effects over time, and how different interventions affected measures of executive function; and since the baby boomers are funding a large part of this research, so the importance of this field will continue to grow in proportion to their collective terror in the face of aging and its associated infirmities, creeping maladies seen from a distance yet unstoppable, as a man bound to a stake in the middle of a desert might feel as he is approached by irate wildlife.

2. Cognitive strategies such as mindfulness meditation and reappraisal are also hot right now; and although they might seem a bit faddish, the evidence of their efficacy is compelling. Expect to see more of these and their ilk increasingly applied across a wider variety of pathologies, such as depression, chronic pain, tinnitus, and addiction.


Lastly, while supping at the Ghiradelli chocolate factory with a postdoc, he mentioned that he was miffed by the lack of theory-driven experiments in several of the posters he saw. That is to say, several posters would lead in with a statement such as "Much research has been done on topic X. However, relatively little is known about Y...", with an experiment devoted to the effects of Y. In my colleague's opinion, this leads to a broadening of the field without refining or testing any of the existing theories. Indeed, if any think his fears to be unfounded, here I reprint an abstract seen at the conference which would appear to support his apprehensions about unfocused research endeavors:


Title: The neural correlates of pooping
Author: Will Brown, M.D., Ph.D.
Abstract: Pooping is an adaptive evolutionary behavior observed to occur across a wide range of species, including dogs, birds, armadillos, and humans, with evolutionary psychologists believing it to serve as a biomarker for fitness and reproductive success. Much research has been done on pooping, but to our knowledge this has not yet been systematically examined using FMRI. In our first study we scanned 28 participants while pooping. Robust activation was observed in bilateral pre-SMA, dorsal ACC, and bilateral insula, which we have dubbed the "pooping network". The second study scanned the same participants while they watched videos of other humans or robots either reading or pooping, creating a 2x2 factorial design. All poops were controlled for size, pungency, luminance, texture, and nuttiness, using the Jeff Goldblum Excrement Control Scale. The contrast of HumanPoops - RobotPoops was associated with activity in the superior temporal sulcus, consistent with this region's role in processing socially relevant actions. By contrast, a main effect of observing poops collapsed across humans and robots led to increased activation in the inferior frontal gyrus, premotor cortex, and parietal cortex, a finding similar to other studies investigating mirror neurons, suggesting that mirror neurons may be essential for helping organisms learn how to poop. These results better inform our understanding of pooping, and may lead to mindfulness meditation and cognitive reappraisal treatments for pooping-related disorders, such as constipation, irritable bowel syndrome, and explosive diarrhea.


Clearly, some restraint is necessary when deciding what experiments to carry out, as there are an infinite number of questions to study, but which must, from time to time, be bound together under cohesive theories.

Overall, I had a great time, and am looking forward to CNS 2014!

CNS 2013: San Francisco



Readers and fellow brain bloggers,

I will be presenting a poster at CNS this Monday from 8:00am-11:00am, session D, poster 57. Featuring electrical shocks, a spatial Stroop task, passion, love, and good and evil, these FMRI results are so hot they would defy the pen of a Sappho to eroticize them. Feel free to stop by and say hi!


As a teaser/foreplay, here is a picture of one of my results:


Stats Videos

Over the past semester, I have been using online tutorials as a supplement for my Introductory Statistics course. Partly to share my knowledge with the rest of the world, partly to deflect any questions from students by asking "Well, did you watch the video yet?" While there is the possibility that such easy access to statistical concepts may reinforce truancy, absenteeism, and sloth, as well as fostering society's increasingly pathological dependence on technology, I try to be a bit more sanguine, thinking that it will serve as a useful tool for learning and memorization.

One reason behind making these is to make sure that I actually understand the concepts; another reason is to provide a reusable source of statistics material for students who do not fully grasp everything in one class sitting (and who does?); and yet another reason is to show off my wardrobe. (Hint: I rotate about two, maybe three shirts. You can see where my priorities are.)


Tonight's Entertainment

For those of you in the Bloomington area, I'll be accompanying for a senior cello recital at the Jacobs School of Music Recital Hall. The program includes, among other pieces, the Strauss Cello Sonata. This piece is rarely recorded or performed, due to some tricky passagework for both instruments and a notoriously difficult piano part (see, for example, the stormy middle section in the following video starting at about 3:10). But, I also happen to be kind of stupid, so I play stuff like this regardless. No fear, baby!


Where: Recital Hall, Jacobs School of Music
When: Saturday, March 23rd, 10:00pm


==============Program==============

J. S. Bach: Suite No. 5 for Unaccompanied Cello in C Minor, BMV 1101

Gaspar Cassado: Suite for Solo Cello


Richard Strauss: Sonata for Cello and Piano in F Major, Op. 6

     I. Allegro con brio
     II. Andante ma non troppo
     III. Allegro vivo




Video Games Can Increase Cognitive Ability, Make You Dangerous

As an adult, when I look back on my childhood and consider the ungodly number of hours I put into video games - Command & Conquer, Counter-Strike, Diablo II, Starcraft, Halo, Legend of Zelda, Tetris, Space Quest, Myst, Civilization, just to name a few - I shake my head in disbelief at how much time I frittered away. If I had spent half that amount of time in the gym, for example, I would have been one buff mamma jamma. Instead, all I have to show for it are several deeply ingrained but practically useless motor reflexes - such as the ability to buy an AWP and two flashbang grenades along with kevlar (but no helmet) in record time - and perfect recall of lines of dialogue from Metal Gear Solid and the finer plot points in Final Fantasy VII. In addition, I also developed a thick skin in response to the flood of insults, invectives, put-downs, and unending verbal abuse from other online players with names like AznMaGiC and Legali$e_iT. At the time, all of this seemed incredibly important; now, not so much.

However, a recent study suggests that this may not have all been an entire waste; and that video games relevant to specific cognitive processes, such as attention, spatial working memory, and decision-making, can actually improve these functions and show crossover to different cognitive domains.

A research group from Singapore recruited a sample of non-gamers - people I once would have looked down upon with contempt - and had them play a variety of different games, such as Bejeweled, Hidden Expedition, and The Sims (remember that?). The participants were tested on a battery of tasks tapping into abilities such as working memory and filtering out distracting stimuli. After completing these measures, subjects were randomly assigned to play one of five games (for a total of five groups), and to play that game for an hour a day over the course of four weeks. The subjects were then retested on the same tasks as before.

Participants improved markedly on those tasks most related to the game that they played - for example, those who spent time playing a memory matrix game showed significant improvement in the working-memory task. However, there was some cross-over between tasks as well, such as action-game playing associated with both improved filtering of task-irrelevant stimuli and increased ability to track multiple objects. Overall, the findings corroborated other studies focused on habitual gamers who primarily played first-person shooters, but showed that these improvements could be extended to non-gamers and to non-violent games. Taken together, this suggests that daily video game practice can both improve your cognitive abilities, and also make you a more efficient hunter of the most dangerous prey of all - man.

So, should we all start shelling out more money for video games and less money for books, poetry, and exercise equipment, such as whiffle balls? Not quite. First, there was no mention of how long the effects lasted - whether it was just for the post-test, or whether the effects could last for weeks or months. Second, although there was a considerable interval between the pre-test and post-test (one month), since this was a repeated-measures design, there is the possibility that there may have been some carryover effect; i.e., some effect of practice from the pre-test. Although there were significant differences between groups, it is unclear how this was affected by the testing before the training period. Lastly, there was no mention about playing an hour of video games a day affected other aspects of life, such as proportionally less time devoted to exercising, social interaction, and your girlfriend getting pissed off that you forgot to pick her up for your two-year anniversary date because you got so caught up in one of those three-hour Metal Gear Solid cutscenes that time seemed to stand still. Chicks, they'll never understand. (Guys, amiright?).

The paper can be found here. And, in case you were wondering, deals for the latest Starcraft II expansion can be found here.



Birthday Post

A strange thing happened to me in my dream. I was transported to the Seventh Heaven. There sat all the gods assembled. As a special dispensation I was granted the favor to have one wish. "Do you wish for youth," said Mercury, "or for beauty, or power, or a long life; or do you wish for the most beautiful woman, or any other of the many fine things we have in our treasure trove? Choose, but only one thing!" For a moment I was at a loss. Then I addressed the gods thusly: "Most honorable contemporaries, I choose one thing — that I may always have laughter on my side." Not one god made answer, but all began to laugh. From this I concluded that my wish had been granted and thought that the gods knew how to express themselves with good taste; for it would surely have been inappropriate to answer gravely: Your wish has been granted.