Tuesday, April 29, 2014

Running Current Through Your Brain Improves Performance, Not As Likely To Kill You As You Think

For many people placing a nine-volt battery on their tongue, like sex, can be a fun, exciting activity, sometimes resulting in death. Based on this observation, Reinhart and Woodman (2014) decided to turn the brain into an improvised battery by placing electrodes on different areas of the skull and zapping it with enough current to toast a frozen hotpocket. If this sounds insane to you, then you are obviously not a cognitive neuroscientist - as I have said before, we live for these kinds of experiments.

However, the researchers had good reasons for doing this. First of all, they are scientists, and they did not spend nine years on their doctorate only to justify themselves to the likes of you. Second, directly messing with brain activity can lead to valuable scientific insights, such as how much you have to pay an undergraduate to have them consent to turn their brain into a microwave oven. But third, and most important, delivering direct current through a pair of electrodes can increase or decrease certain patterns of neural activity - specifically, the error-related negativity (ERN) following an error trial.

The ERN is a negative deflection in voltage over the medial frontal lobes that correlates with behavior adjustment and error correction in the future. For example, if I commit what some narrow-minded, parochial individuals consider an error, such as asking out my girlfriend's sister, the larger my ERN is, the less likely I am to make that same mistake in the future. Similarly, with experiments such as the Stroop task, or any performance task, the larger the ERN after committing an error, the greater the probability of making a correct response on the next trial. Furthermore, whereas the ERN usually occurs immediately after the response is made, another related signal, the feedback related negativity (FRN) occurs once feedback is received. In sum, larger ERNs and FRNs generally lead to better future performance.

This is exactly what the experimenters manipulated when they sent current through the medial frontal area of the brain, corresponding to the dorsal anterior cingulate cortex (dACC) and supplementary motor area (SMA) cortical regions. The electrode over this area was changed to either a cathode (i.e., positively charged, or where the electrons flowed toward) or an anode (i.e., negatively charged, or where the electrons flowed away from). If the electrode was a cathode, the ERN decreased significantly, whereas if the electrode was an anode, the ERN significantly increased.

Figure 1 from Reinhart & Woodman (2014). Panels A and D represent the current distribution throughout the medial prefrontal cortex. B: Stop-signal task used in the experiment. A stop signal leads to a greater chance of screwing up, and the longer the delay between the cue and the stop signal, the more difficult it is to stop a response. This is what physicists and individuals with severe incontinence refer to as an "event horizon." C: Placement of Cathode or Anode on the medial frontal surface, along with a sham condition. Lower panel: Difference in ERN and FRN dependent on whether the fronto-medial electrode is an Anode or Cathode.

As interesting as these neural differences are, however, the real punch of the paper lies in the behavioral changes. Participants who had an anode placed over their cingulate and SMA areas not only showed greater ERN and FRN profiles, but also steep gains in their accuracy and improvements in reaction time. For regular trials which did not include a distracting stop signal, anode subjects were markedly faster than in the cathode and sham conditions, and in both regular and stop-signal trials, accuracy nearly reached a hundred percent.

Nor were these gains limited to the duration of the experiment; in fact, behavioral improvements could last as long as five hours after switching on the current. These results make for wild and reckless speculations about what could be done with this kind of setup; one could imagine creating caps for students which get them "juiced up" for exams, hats for the elderly to help them find their Mysteriously Disappearing Reading Glasses, or modified helmets for soldiers which allow them get even better at BSU (blowing stuff up). Because, after all, what's the use of a scientific result if you can't weaponize it?

More figures and results from experiments further extending and confirming their results can be seen in the paper, found here.

Wednesday, April 23, 2014

Reordering DICOM Files

Many grant cycles ago, an alert reader asked how to numerically reorder DICOM files that come from the scanner out of order. I said that I didn't know; but, not wishing to overtly display my ignorance, I kept it relegated to the comments section, away from the eye of public scrutiny.

However, another reader recently pointed out that this problem can be rectified by a script available on the UCSD website. Apparently DICOM files are generated in an out-of-order sequence by General Electric scanners (and possibly others) after an equipment upgrade. After a thorough investigation into why this was happening - why dozens, if not hundreds, of researchers were needlessly suffering from a hardware upgrade that was supposed to make their neuroimaging lives easier, not more difficult - the CEO of General Electric saw no alternative but to take action and jack up executive bonuses. We can all now rest easier.

The link to the script (which is in Perl) is here; I've also copied and pasted the script below, both to take away their Internet traffic, and to season this post with the flavor of programming rigor.

#! /usr/bin/perl
 use Shell;
 use Cwd; # module for finding the current working directory
$|=1;    # turn off I/O buffering

print "\n";

if ($#ARGV == -1) { # if no arguments are entered
print "\n";
else { # read in the arguments
 for ($j=0; $j<$#ARGV+1; $j++) {
  $tempdir = $ARGV[$j];
  if ($tempdir eq "."){
   $tempdir = &cwd
  opendir(DIR,$tempdir) or die "$tempdir does not exist or I can't open it\n"; # check the directories inputted
  @dirlist = $tempdir;
  foreach my $name (@dirlist) {
   print "\n";

sub ScanDirectory {
    my ($p) = 0;
 my ($workdir) = shift; 
    my($startdir) = &cwd; # keep track of where we began
 print "Processing Directory $workdir \n";
    chdir($workdir) or die "\nUnable to enter dir $workdir:$!\n";
    opendir(DIR, ".") or die "\nUnable to open $workdir:$!\n";
    my @names = readdir(DIR);
 $command = "mkdir backupimg";
 system ($command); 
    foreach my $name (@names){
        next if ($name eq "."); 
        next if ($name eq "..");
  next if ($name eq "backupimg");
        if (-d $name){                     # is this a directory?
  #do something with file
  if (grep(/\.MRDC\./, $name)){
   $p = $p + 1;
   $command = "cp $name backupimg/";
   system ($command); 
   $old_name = $name;
   $name =~ s/i(.*)\.MRDC\.(.*)/i\.CFMRI\.$2/;
   $num = "";
   $num = sprintf("%5d", $2);
   $num=~ tr/ /0/;
   $name = "i$num\.CFMRI\.$2";
   rename("$old_name", "$name") || die "Cannot rename $old_name: $!";
 print "     Directory $workdir has $p files processed \n"; # print size
 $command = "rm -rf backupimg";
 system ($command); 
    chdir($startdir) or die "Unable to change to dir $startdir:$!\n";

sub instructions {
print "This program renames and reorders the dicom files acquired on the GE scanners at UCSD - CFMRI.\n";
  print "Usage: imseq [directories to convert] \n";
  print "Example:  imseq directory1 directory2 directory3 \n\n";



Wednesday, April 16, 2014


Out of the Files of a Psychologist

There is no hypothesis incredible enough, no argument weak enough, no idea ridiculous enough, that cannot be made palatable by its presentation. The enduring popularity of FMRI pictures attests to this. Thus the battle is won not by the men-at-arms, the wielders of the gun and the blade, but by the drummers, flag-bearers, and musicians of the army.


An acquaintance of mine once told me, with apparent self-satisfaction, that nothing offended him. I took this to mean that he had no deep-rooted beliefs, no worldview that mattered to him, no principles that he would defend or - more ridiculous still - even die for. What he was trying to advertise, in other words, was that he was uninteresting.


I abhor sentimentality, and I cannot forget that its name is pop culture.


One of the great errors of modern education is to mistake being well-read with being widely-read. There is no more irritating fellow than the one who blitzes through books (or, worse, online articles) as though they were something to be "got through," and then sits and expects wisdom to follow. The Greeks had a word for such learned fools: They were called sophomores.


If one were to ask me how to live, I would respond: Observe dogs at the park. Even a dog knows that play is nobler than work.


Ask any scientist why he is in this or that area of research, and, pushed for an answer, he will say "to help society," or possibly "to find the truth." But by this they always imply, consciously or not, that "success" is somewhere in the offing and sure to follow. Any observation of someone helping society or pursuing truth shows the opposite.


What one doesn't realize is that for something to be a fine art does not necessarily mean that it is fine, or even refined - merely that it is an end in itself (finis). The fine arts taught in our studios and universities, in other words, are useless; useless, however, in the best way possible.


The most sublime moment in all of art: The final dinner scene in Don Giovanni. Here the bow of feeling is stretched to its ultimate limit; here the dark theme from the overture reappears in all of its terrible glory; here Mozart at last brings all his musical artillery to the highest mountains of emotion, and need only fire blindly to inspire terror all around. The argument between Don Giovanni and the Commendatore - Don Giovanni as the impulse towards life, towards gratification of desire, eros personified, unwilling to surrender his hedonism and at last saying No, against the Commendatore's unyielding Yes. Have two words juxtaposed together ever been more pregnant with meaning?

Thursday, April 3, 2014

The Hunt for the Paracingulate Sulcus

Within the disgusting recesses of your brain all of you have a cingulate sulcus: a deep groove that runs front-to-back along the medial sides of your hemispheres, just above he corpus callosum. You are neither interesting nor special if you have a cingulate sulcus - you are average.

However, there is a subset of individuals who have another groove running above and parallel to their cingulate sulcus. This additional groove is called the paracingulate sulcus, and it confers great honor upon its possessor. Before, all of you had a mere cingulate sulcus - but behold, I teach you the oversulcus; and those who overcome themselves are the bridge to the oversulcus.

As shown in the following video, the paracingulate sulcus is often readily visible, although I recommend using the sagittal and coronal slices to zero in on it; and to look about 15-20 millimeters anterior of the anterior commissure, and about 4-8 millimeters to the left and right of the longitudinal fissure. In particular, within the coronal section look for double invaginations stacked like pancakes. These folds correspond to the cingulate sulcus (ventral) and the paracingulate sulcus (dorsal). Furthermore, be aware that there are four possible combinations that you can see: Either there is no paracingulate sulcus; there is only one paracingulate sulcus, and it is either on the left hemisphere, or on the right hemisphere; or there are two paracingulate sulci, one on each hemisphere.

Regardless of whether a paracingulate sulcus makes you special or not, you may be wondering what the hullabaloo is all about; everyone's brain has some variability, you may say, and these differences wash out at a higher-level analysis. That may be true; but several experiments have also shown that the presence of a paracingulate suclus can significantly alter your results, as well as make the location of your results more uncertain (cf. Amiez et al, 2013). To remove these sources of variability, you can classify your subjects according to whether they are paracingulate-positive or not, and extract your beta weights from different regions of the medial prefrontal cortex.

I am doing an analysis like this right now, so feel free to follow me as I puzzle out how to apply this to my own dataset. I promise that the results will be, if not shockingly scandalous, at least spicy enough for your curiosity's appetite.

Tuesday, April 1, 2014

Removal of Physiological Noise from FMRI Data

A couple of weeks ago, as I wrapped up the series on resting-state analyses, one of my alert readers asked whether I would be willing to go through a demonstration of removing physiological artifacts - for example, breathing, heart rate, sweating, growth of nasal hair, etc. - in other words, all of those things necessary for life that nevertheless can interfere with FMRI analyses.

Unfortunately, I do not have any breathing or heart rate data available, so I cannot adequately demonstrate what this looks like. In fact, in this post I'm not even going to explain it very concretely; I'm simply going to describe what my comes to mind when someone talks about removing physiological signals - to take you by the hand and guide you through my thought process. This may leave you unsatisfied, and you may have legitimate quarrels with my reasoning. However, it is also an opportunity to show how I think through things, which you may find helpful when tackling your own problems, or when evaluating how much you should trust my explanations on other matters.

Let's say that we had just collected an FMRI dataset along with respiratory and heart rate data. My advisor then calls me to his office, and tells me to figure out how to remove these sources of variance from the neuroimaging data. Failure to do so will result in receiving a vasectomy with a weed-whipper. After considering several ways to leave graduate school and finally concluding that it would not be feasible, the first thing that would come to mind is how to model these additional data.

Keep in mind that everything that you collect in an imaging experiment - well, almost everything - can be modeled. When we talk about creating a model in FMRI, often we mean including our regressors of interest, and inserting other sources of variance, such as head motion, into the model as "nuisance" regressors. This is not always an apt distinction, as it matters what you are interested in, and how you intend to model your data. Typically we convolve our regressors of interest with a gamma-shaped waveform, because we assume that whatever area of the brain is sensitive to that condition or stimulus will show a corresponding wave in MRI signal. However, in the case of head motion, or nuisance regressors, we don't convolve these regressors with anything; we simply enter them into the model as they are, one value per timepoint. My first thought would be to do something similar with any respiratory or heart rate data, and possibly resample it to be on the same timescale as the neuroimaging data. A few options available within AFNI come to mind, such as 1dUpsample and the stim_files option in 3dDeconvolve, that would allow entering this physiological data into the model.

However, upon further research I find that there is a function specifically built for removal of such artifacts, 3dretroicor, and that cardiac and respiratory data can be entered separately or together. I then look into programs such as afni_proc.py, which can automatically generate the appropriate code to place this command where it belongs; and, notwithstanding reading up on the options within 3dretroicor and some of the original literature it is based on, my search is finished. I and my vas deferens can rest easily.

This may all seem an indirect, roundabout way of doing things; and you may say that it would be more efficient and straightforward to do an online search for the terms of my problem, to look through the AFNI message boards perhaps, and then be done with it. That is doubtless true is many cases. However, I would still have questions about what exactly is being done to the data at what step; and, in the present case, if the nuisance data is not being modeled, how it is being removed or filtered out of the imaging data. Then there are further issues about how this compounds with other processing steps, and what other precautions must be taken; and the list could go on. In any case, the user needs to know what is being done, and why.

For example, would there ever be any case where one would want to resample physiological data to the same timegrid as the imaging data, and remove it that way? Other physiological responses, such as galvanic skin response (GSR; broadly speaking, the amount of sweat secreted on the palms) can also be measured and inserted into a model, sometimes as parametric modulators if they are thought to capture any information beyond what the regressors provide; would this ever be appropriate in the case of breathing or heart rate measurements? Or does the slower periodicity of breathing and heart rate make only certain methods of modeling appropriate, but not others?

In the case of heart rate and breathing data, I can't say, because I haven't analyzed any; however, the question of what to do with it is an important one, and what is outlined above is a rough sketch of what I would think when presented with that problem. You can put away the weed-whipper now.