Monday, December 31, 2012

2012: Year In Review

To manage my day-to-day affairs, dealings, connections, and errands, I keep a planner - an honest-to-god, pen-and-paper planner. Nothing digital. I began keeping one two years ago to the day, in the hopes of better managing my time, and in the hopes of feeling more accomplished at the end of the day as I reviewed what I had finished. It is rather bulky, to be sure, too large to fit in my coat or my pocket; and, sometimes, it appears to be more trouble than it's worth. There are times where I see my colleagues with their Blackberries and PDAs, and I wonder how it would be to have one of those; to be able to sit on the bus next to someone who is supposedly your girlfriend, and idly hold their hand while you surf the web with the other hand, searching for slick deals on the next issue of Humungo Garbanzo BOLD Responses, while your distracted odalisque does the same with her unheld hand, the limp connection of flesh between you serving as a kind of dull wire carrying a weak current.

Not that I criticize; this is an efficient use of available resources, as what else is a man to do with his free hand? The impulse to hold a neighboring limb should be thought of as the fulfillment of some nameless urge, such as Edmund Hillary's reason for scaling Mount Everest - because it was there. The only danger is that this most basic form of human contact should divert your attention from browsing  Humungo Garbanzo; after all, there is the distinct possibility that concentrating on the held hand would lead to an unnecessary focus on details one would otherwise ignore, such as lightly caressing the ensheathed tendons - strong as hawsers, yet soft and yielding; or maybe the almost imperceptible beads of sweat budding along her palm and absorbed into yours; or perhaps even the faint buzz of excitement as you wrap the sensitive tips of your digits around the heel of her hand, feeling the delicately cambered hills of her knuckles.

But I digress; the important point is that I use a paper planner, if for no other reason than that there is nothing like the satisfaction of placing a nice fat checkmark next to a recently completed errand, or being able to go back, flipping through the pages, and seeing what has been done, what has been left undone, and what has simply been scotched and crossed out, either due to negligence or in favor or something more important. In honor of the end of the year, from my planner I have chosen one entry per week for the year of 2012; I hope it is illuminating as to how I spend my time and my thoughts.


  1. Friday, January 6th: Test E-Prime 2.0 drivers
  2. Tuesday, January 10th: Write Attitudes paper (scratched out; I dropped the class that week)
  3. Thursday, January 19th: Read Chpt. 4 Clinical Neuroanatomy
  4. Friday, January 27th: Return Beethoven sonatas
  5. Saturday, February 4th: Grade remaining P433 papers; celebrate with some Keystone Light. Make sure it is flat and warm, just how you like it.
  6. Wednesday, February 8th: Put in E-bay bid for whiskey decanter shaped liked human skull
  7. Tuesday, February 14th: Do taxes. Get at that money.
  8. Wednesday, February 23rd: Work on CNS poster; replace 'S' in name with dollar sign
  9. Monday, February 27th: 11:15am, proctor P433 class. Note to self: check whether the words "Proctor" and "Proctologist" are related.
  10. Friday, March 9th: Do atanh (?) on new params. (Looking back on this, I'm still not sure what it means.)
  11. Monday, March 12th: Surface maps of MO2. Try to let people know you are cool and connected.
  12. Thursday, March 22nd: Psych yourself up enough to put a nine-volt battery on your tongue. Do NOT faint like you did the last time.
  13. Tuesday, March 27th: AFNI bootcamp; schmooze with the AFNI crew. Laugh at their jokes.
  14. Thursday, April 6th: You coward. Try the battery thing again.
  15. Saturday, April 14th: Get up the nerve to ask out the cute waitress who works at Smokin' Jack's Rib Shack.
  16. Thursday, April 19th: Coward!
  17. Wednesday, April 25th: Carpet-bomb friends with emails begging them to do your study.
  18. Thursday, May 3rd: Begin writing quals exams
  19. Sunday, May 13th: Call mom; ask for more money. Also, wish her a happy Mother's Day
  20. Saturday, May 19th: Order The Magic Mountain / Lolita
  21. Wednesday, May 23rd: Send FIR results to A-Team
  22. Saturday, June 2nd: Call Carl's Carpet Cleaning (motto: A carpet stain, ain't no thang)
  23. Saturday, June 9th: Go to wedding; share hotel room with girl who has ambiguous relationship status. Also, find a store that sells salad spinners.
  24. Saturday, June 16th: Run Grandma's Marathon
  25. Wednesday, June 20th: Work on quals
  26. Thursday, June 28th: Work on quals
  27. Friday, July 6th: Work on quals
  28. Wednesday, July 11th: Work on quals
  29. Tuesday, July 17th: Pick up plant (aka, Chick Magnet) for living room. Also, work on quals.
  30. Friday, July 27th: Work on quals
  31. Friday, August 3rd: Quals defense. Remember to make flattering comment about Josh's new haircut. Squeezy peasy lemon easy.
  32. Wednesday, August 8th: Visit grandparents
  33. Friday, August 17th: Prepare for semester 
  34. Saturday, August 25th: (Only one word here: "Subscribe". Probably will remain a mystery for the rest of my life.)
  35. Wednesday, August 29th: Purchase Barry Manilow tix
  36. Friday, September 7th: Pick up whiskey skull decanter
  37. Thursday, September 13th: Make potato battery
  38. Friday, September 21st: Attend performance of Don Giovanni
  39. Wednesday, September 26th: Memorize Porphyria's Lover
  40. Sunday, October 7th: Milwaukee Marathon. (Remember not to run the first half too fast, lest you blow up and look like a fool for the last hour)
  41. Saturday, October 13th: Review student papers
  42. Wednesday, October 17th: Send birthday wishes to the Grandpas
  43. Friday, October 26th: Contact that really smart Iranian kid for help with computational neuroscience homework
  44. Monday, October 29th: Send Debussy fingerings to piano student
  45. Tuesday, November 6th: Vote for the right person
  46. Friday, November 16th: JAGS
  47. Saturday, November 24th: Buy eyedrops
  48. Saturday, December 1st: Accompany for Ryan's senior recital; play at John Cage Centenary
  49. Sunday, December 9th: Write Carleton Reunion Committee
  50. Thursday, December 13th: Lunch with Ale. Be a man and demand that she pay.
  51. Thursday, December 20th: Observe old lady back van into train station and obliterate it. (This actually happened)
  52. Sunday, December 30th: Reflect on life


Well, that about does it; as you can see, I have a full life. And this by no means captures everything that goes on; for example, last week I drank sixty beers, finished a novel I began back in July, and had my flu shot. I walked to a grocery store three miles from my apartment, and skipped two miles on the way back home. I made a payment on my student loans, pounded a jar of Nutella within forty-eight hours, and read the preamble of the U.S. Constitution. One day I actually put on sunscreen, and didn't even directly look at the sun. I washed the dishes - twice - and organized the clothes in my closet according to color. I used a high-tech machine to analyze the chemical composition of the sticky stuff they put on lint rollers, and read a Wikipedia entry on Hector Berlioz. And to top it off, I accidentally got high sniffing a box of Clorox wipes and recorded my vision into a screenplay which, I am told by a reliable source, has a good chance of success at the box office. And my parents always told me that I would turn out to be a good-for-nothing bum. Well, look at me now!

Sunday, December 30, 2012

Andy's Brain Blog Advice Column: Should You Date In Graduate School?

Dear Andy's Brain Blog,

I am midway through the second year of my graduate program, and over the past couple of months I have gotten to know a girl in my cohort very well. At first we started just by hanging out a lot, but one night we both got pretty jacked on some Nutella spiked with Smirnoff Ice and before I knew it things got out of control. It quickly escalated into kissing, necking, holding hands, and heavy petting, although we kept it PG (-13). Although I had the time of my life that night, and although I have had this same scenario happen with several girls before, something feels different about this one; it doesn't feel like just another fling, but possibly the prelude to a full-on relationship. 

However, I am conflicted: How much should a man dedicate himself to a relationship, if at all, when there are the pressing concerns of classes, teaching, writing, and research? Would it be best to break it off before it becomes too serious? Or, if it is to be pursued, how should it be approached?

Sincerely,

Brad


Dear Brad,

Let me begin by stating it is perfectly normal, and not weird at all, for a manboy of your age to begin experimenting with odd cocktails of sugary products. But first let me address an unasked question: Why should you trust me with relationship advice? Well, not to brag or anything, but I have run a (half) marathon, I have no major diseases, and I have read over a dozen novels, including the complete oeuvre of Laura Ingalls Wilder and Beverly Cleary. The depth and breadth of my reading, combined with extensive travels throughout the upper American Midwest and two provinces of Canada, has granted me unique insight into prepubescent sororal relationships, the finer points of horse trading, and how to recover from crop damage following a hail storm. Most important, I have become an observant scholar of relationships between the sexes - as Tolstoy would put it, the tragedy of the bedroom - and this endeavor has granted me an eagle-eye view over the landscape of your squalid desires.

To illustrate the deleterious effects of falling in love, a peculiar phenomenon of which you seem to be at risk, I share with you a letter - ladies and gentlemen, an honest-to-god, handwritten letter! As though you need any more evidence of the madness wrought by such primitive emotions - recently received from one of my colleagues at a neighboring university which described his sinking into the turbid ocean of his own lust, the unfortunate result of a series of trysts and resulting hanky-panky with a post-doctoral student working in another lab, which, instead of draining the cisterns of his lust, whipped him into a frenzied passion. Besides the irritation provoked by the omission of any question as to how I was doing - the letter was, in a sense, one prolonged, histrionic soliloquy directed toward an uninterested audience - I was shocked to hear of the level of absorption and mindless passion to which he had fallen (he would have said risen). He enumerated, in painstaking detail, the features and mien of his lover; the slender, supple, opalescent skin of her bare arm; those vermilion, pillowy, textured lips rising to meet his upon awakening from a fitful, sleepless night; and above all, serving as two bright nodes in a trinity of passion, a pair of milky peaks bedighted with brilliant orbs; incarnadine, inexhaustible wellsprings of his bliss, the very thought of which was enough to send a rill of excitement down his spine and terminate in a limpid jet of love.

Exhibit two has no ocular evidence, but rather rests on a memory; old, but still intolerably vivid. An acquaintance of mine in college, living in an adjacent room, once let down his guard and fell completely, hopelessly, stupidly in love with one of the first girls that he met. He once had the gall to stop me on my way out the door to a morning class merely to tell me of his first kiss shared with the object of his desire; he described how, as they talked one night, he had gradually pulled her closer to him, as if by the force of God, and how she began to talk more rapidly and at a higher pitch the closer they were drawn together, before a brief and pregnant silence; and then - a thousand comparisons between the expectation and the reality, a bubble of ecstasy bursting in slow motion - their lips met.

After that, he was a changed man; his grades went to pot, he claimed to see the world in a different light, and he began to go so far as to read and write poetry under her intoxicating influence. It was, from my perspective, a silly and infantile episode in his life; and lest the reader think that this was some innocent, puppy-love affair, let him know that I was, on several occasions, rudely awakened early in the morning by the sounds of strenuous intercourse. After they broke up - as inevitably happens under the demands and expectations of such powerful emotions - he was a wreck for months. His personal hygiene fell into desuetude, his appearance became slovenly and repulsive, and one could see, at a glance, that where he was once brimming with untamed eros, he was now spiritually detumescent. I hardly talked to him since that catastrophic episode, although one time he did manage to corner me and, still under the influence of a fevered mind, tell me that what had transpired - kiss, relationship, breakup, all - was one of the best things that happened to him. To this day, I cannot help reflecting on that puerile outpouring without a feeling of contempt.

As has been shown, love can lead to such dangerous feelings as inklings of the Eternal or the Infinite, along with all of their concomitant inspirations to do simultaneously heroic and stupid things; feelings that there might be, in fact, a deeper and greater reality beyond the pale of the daily grey. All of this, of course, is pernicious nonsense, and should be avoided accordingly. And, lest anyone forget, falling in love also leads to a pathological form of self-forgetfulness, spawning powerful and conflicting emotions such as a deep concern for someone other than the self, painful feelings of both tenderness and possessiveness, and the stirrings of insensate jealousy. How is it, I ask, that any serious student is supposed to concentrate on their work with all of these inchoate feelings spurring them to blind insanity?

However, if you have already crossed the Rubicon and find yourself increasingly enthralled to another, there is still hope to break the emotional ties before they become so entwined with your own being that to sever them would be, in effect, an amputation of the soul. After all, what the composers and poets and painters seldom mention is that, in the beginning at least, one can fall out of love as quickly as they fall into it; and I therefore recommend that, during one of your more lucid moments of reasoning - perhaps when the clouds of your mind have been dispelled after a particularly vigorous congress - it would be both fitting and proper to bring up a sensitive topic likely to introduce divisions between you and your lover; politics and religion being the two examples that most readily come to mind, although I am sure you can find others. It is best to exploit these divisions early on, as I have observed several miscarriages of the natural order of relationships in which two individuals, having known and cared for each other for several years, no longer find these differences to be grounds for breaking up, nor do they even find these differences to be of much importance at all; instead, these differences are seen petty and trivial compared to the emotional and physical well-being of their partner.

By all means, do not let this happen to you. Reader, I have seen men and women worked up into a passion - literally, a sensuous passion, far more intense than that effected by the most possessive jealousy or the most animal lust - over differences such as those described above. For maximum effect, of course, it is helpful to have an entire group of people, and instead of a difference per se, have them all hold more or less the same opinion in solidarity against an invisible opponent; as I have observed such groups, with their perceived moral superiority and righteous indignation serving as a highly volatile fuel, require only the faintest of sparks to overthrow their vaunted reason and ignite a general conflagration of directionless emotion. I once read somewhere a dull intellectual describe such events, in which each individual has a similar opinion, lightly adopted but firmly held, as arising from a combination of ignorance, dishonesty, and a pusillanimous desire for social acceptance; but in any case, the point here is to tap into that same atavistic, tribal mentality, in order to alienate and distance yourself from another, lest you find yourself so emotionally involved with this person that you are unable to easily assign them to a category.

In all, best to nip this in the bud straightaway, and immerse yourself in your readings, research, and teaching, lest you lose sight of what is really important. Relationships, love, marriage, et al. is for saps, as is self-evident to any reasonable observer; and if any of this is to be engaged in at all, it should only be for health purposes, without any resulting attachment, similar to a day at the spa. One of my friends recently sent me a copy of a book called The Red and the Black, by a man named Stendahl, saying that it would help me understand such trivialities; but in my hands, it was merely a lump of valuable matter. I hear that several young readers entering college are beginning to 'discover' Stendahl; I wish them joy.


Friday, December 28, 2012

AFNI's uber_subject.py



Back in the good old days, we would create our scripts ex nihilo; out of nothingness would we construct gigantic, Babel-esque scripts that nobody - to be honest, not even we - could understand. We would pore over FMRI textbooks and fumble around with commands and tools we thought were germane, only to have everything collapse all around us when it came time for execution. I remember with painful clarity the moment when I finally hit upon the idea of looping over subjects for each iteration of the script; I thought I was a creative genius.

Lawless, ruthless, and terrifying; those days were like the wild west. Nobody knew what the hell was going on; you might come across a block of analysis script posted by some group in Singapore, compare it to your own, and wonder how your two labs could ever come to the same conclusion about anything, given how radically different your scripts were. Your script would call for slice timing correction, followed by coregistration and normalization, while their script would call for a cup of chopped onions and a clove of chopped garlic. Then, slowly, you would realize that what you were looking at was a recipe for chicken cacciatore or something, and you would feel like an idiot. Overall, those days were not good.

Fortunately for us, these days we now have a script called uber_subject.py, which takes care of generating analysis scripts quickly and easily. AFNI script ex machina, as it were. If you have programs and binaries from the past couple of years or so (and there's no reason you shouldn't; if you haven't updated in a while, a quick '@update.afni.binaries -d', without the quotes, should do the trick), you will have uber_subject.py. If you type it from the command line - and your python libraries are current and functional (see here for a message board thread if you have trouble with this) - then a graphical user interface will pop up, prompting you to input parameters such as smoothing kernel size, number of regressors, relationship status, and so forth, until you have a completely idiosyncratic script to fit your needs. Overall it has worked very well for me so far, and word is that it will be integrated with an even higher level script called uber_script.py. I've had some issues getting it to work, so instead of trying to fix it, I have taken the path of least resistance and settled for uber_subject.py. You will be glad that you did as well.


Saturday, December 22, 2012

AFNI Command of the Week: 3dinfo

Researchers are always trying to find out more about their data. They examine at it from different angles; place it in their hand and feel its texture and test its heft; and look closely for portents and signs and the apocalypse.

3dinfo, similar to FSL's fslinfo and SPM's spm_vol, returns critical information about an FMRI dataset, such as the number of voxels along the x-, y-, and z-directions, the size of those voxels, and other header essentials, such as the number of volumes and the length of the repetition time (TR). This information is critical when performing steps such as slice timing correction with 3dTshift, when the researcher may want to know more about the number of slices and the acquisition of those slices, or when doing a step like cluster correction, where the voxel dimensions are a critical piece of information.

A few lesser known options include the -VERB option (in all caps), which generates even more information than the typical -verb option, and -echo_edu, which formats the standard output into a clear and easy-to-read table. This and more can be found in the following video:



Thursday, December 20, 2012

Super Useful Sampling Distributions Applet


Similar to the applets I used for my P211 research methods class, there is an online program which allows the user to specify a population distribution, and then build a sampling distribution of statistics such as mean, median, and variance. When I was first starting out I had a difficult time grasping what exactly a sampling distribution was, or what it meant, exactly; but tools like this are great for visualizing the process and building an intuition about what's really going on. The result is, I still don't understand it - like, at all - but I sure as hell feel more confident. And that's what is really important.


Tuesday, December 18, 2012

On Vacation



I will be gone for the next ten days, making a brief layover in Chicago to see some friends, and then traveling back to the frigid northern wastelands of Minnesota to my old stamping grounds of Wayzata (and believe me, I used to stamp the living heck out of those grounds). As a result, there will be fewer posts - although I do have a couple of drafts at hand to sprinkle around like little orts, just to keep you all happy and coming back for more.

But seriously, I want to let you all know that I do not take anyone's readership here for granted. After the initial wave of inflated traffic statistics from bots and pings from Russian adult-oriented websites, I have seen that there is a good chunk of you that - for whatever reason - keeps returning; and so, I thank you. I will be sure to reward your loyalty by putting up Google ads soon, as they are targeted toward your desires, and so will make the experience more enjoyable. You think I am joking, but I am not.

But seriously - for real, this time - each time I get a comment about how this blog has helped someone out with some aspect of FMRI, or statistics, or their romantic life, it all seems worth it. I can't tell you how many times I've thought about hanging it all up and quitting (actually, I can: Twice), but for someone posting a comment at the last minute asking how the hell I could be so stupid as to write that optseq optimizes designs according to beta estimates as opposed to contrast efficiency; upon which I become pissy and defensive, and continue to post out of sheer spite. So to all of you who read and contribute - Thank You! Here is a reward for you all:


Monday, December 17, 2012

Neurosynth: FMRI Meta-Analysis Made Fun

A sample screenshot from Neurosynth

Have you ever sat in front of your computer, watching Step by Step reruns on Youtube while mindlessly munching Cheetos and wondering how you could instantaneously generate meta-analysis maps for neuroimaging data? If so, then Neurosynth is the tool for you. Developed primarily by researcher and nerd baller Tal Yarkoni, Neurosynth allows the user to generate meta-analysis maps on the fly for virtually any neuroimaging-related keyword that you can imagine, and possibly even the ones that you wouldn't even think to imagine. (For example, check out the topic words under Y: year, yellow, yielded (!), you, young, younger.)

Neurosynth is intuitive and approachable: Simply type in a keyword (such as "pain" or "cognitive control"), and it immediately generates a statistical map associated with that keyword. Different options include forward inference, or the consistency of that activation across studies, and reverse inference, or the probability that you would observe the reporting of a term given a particular location. These maps can then be output into NIFTI format, where they can be used for a variety of purposes, such as ROI masks. If you're particularly driven, and your mind not bemazed from Cheetos overdose, I am sure that you can find several other uses, as described on the website's FAQ. Other data from these maps include the studies that went into the meta-analysis, and even author names can be used as keywords; in this way, Neurosynth also serves as an excellent education tool for learning what specific regions are associated with which cognitive processes and which author's work.

In any case, I am always pleased when I come across tools like this, and I'm hoping that the authors continue to refine and expand this program; I think it will become increasingly useful in the future as more neuroimaging data is shared online. And as important as the future is, I should hasten to add that we must also look back to the past as well - from Mozart's Don Giovanni to Burton's The Anatomy of Melancholy to Step by Step - in order to better understand ourselves and our rich heritage as human beings, and realize both from whence we have come, and, I hope, our future greatness.


Sunday, December 16, 2012

Andy's Brain Blog Book Club: Lolita

The one non-scandalous image of Lolita I could find

Since its publication over five decades ago, Lolita - one of Nabokov's several masterpieces, and arguably his best - has continued to provoke emotions ranging from awe and admiration to shock and outrage. Indeed, it is difficult to come to grips with the fact that one of the most brilliant examples of English prose should center upon such a sordid subject; to paraphrase a line from the book itself, even the most jaded voyeur would pay a small fortune to see the acts described within those intolerably vivid pages.

You will not be able to tolerate Nabokov at all unless you realize that he is not putting forth a message, or a moral, or using symbolism at any point to convey some deeper meaning. As he writes in his afterword - and we have no reason to doubt his sincerity - the entire point is aesthetic pleasure; to experiment with the rhythm and sonorities and cadence of the language and make it as pleasing as possible to the inner ear. This last point may strike some as odd, as Nabokov deliberately employs a rarefied, sophisticated style involving recondite vocabulary (see, now there I go) copiously interlarded with French turns of phrase (your humble blogger admits to not knowing a lick of French, once responding Trois bien to a French cellist's Ã‡a va). Aside from the conflicting feelings aroused by Humbert's mind (at times achingly beautiful; at others, horribly squalid), many readers find the language itself to be an obstacle; two or three trips to the dictionary per page is not uncommon.

However, this need not deter you; for the first reading, I recommend paying little attention to the words and French you do not understand, and simply immerse yourself in the lyrical, shocking, roller-coaster prose. As you will soon realize (to your delight, I hope), Nabokov has an uncanny gift for constructing sentences and coining words that stick with you long after you have put the book down. After the first reading I could still see inly, projecting onto the silky screen of my retina and vibrating along my optic nerve, some of those odd, charming, gorgeous phrases: Lo-lee-ta; the biscuity odor of his Annabel Lee; nightmarish curlicues; winged gentlemen of the jury; limbless monsters of pain; the bubble of hot poison in one's loins; dim rays of hope before the ultimate sunburst; clawing at each other under the water; a list of names of children enrolled in Lolita's school (Irving Flashman, Viola Miranda, Agnes Sheridan, et alia); purple pills made of summer skies and plums and figs and the grapeblood of emperors; aurochs and angels; Lolita playing tennis; truck taillights gleaming like carbuncles; coffins of coarse female flesh within which nymphets are buried alive; the exquisite caloricity of Lolita's fevered body; the soft crepitation of  flowers; Humbert dehiscing one of Lolita's infected bugbites and gorging himself on her spicy blood; Will Brown, Dolores, Co.; icebergs in paradise; guilty of killing Quilty; drunk on the impossible past; Humbert looking and looking at Lolita - older, married, pregnant, eyes faded to myopic fish, nipples swollen and cracked, her young velvety delicate delta tainted and torn - and knowing that he loves her more than anything he had ever seen or imagined on earth, or hoped for anywhere else.

Most of these I can still recall perfectly from memory; only a few of them did I go back to doublecheck, if not to verify the accuracy of my recollection, then to savor their rereading. (Only someone like Nabokov could have dreamed up something as twisted as Humbert attempting to get parenting advice from a book called Know Your Own Daughter.) These sentences and scenes serve as the nodes and nerves of the novel, checkpoints and touchstones scattered amongst interstitial words and prose for any reader curious or sensitive enough to detect them; and each reader will discover his own words and gems that resonate.

A final note: If you have already read Lolita, reread it. The Foreword, the novel itself, and the Afterword (included, I believe, in all editions after 1955) are rich in literary jokes and self-referential allusions that reward careful rereading, and contain details that, while nearly impossible to detect upon a first reading, enhance the experience after you already know the denouement.


Saturday, December 15, 2012

AFNI Command of the Week: 3dZcutup and 3dZcat

When I used to work at OSU, on the lab wiki I would put up a new AFNI command every week, detailing a program that isn't necessarily used all that often, but has some interesting applications for the user looking for more ways to manipulate their data. I plan to do the same on this blog, in the hopes that someone might find them useful.

One such tool that came to my attention a couple of weeks ago was 3dZcutup, a program for taking apart individual slice or groups of slices, in order to rearrange them or, more commonly, to perform statistical analyses on only one slice at a time, if computer memory becomes an issue. The usage is simple: Supply an input dataset, a prefix for your output dataset, and specify the range of slices you want to dump into the output dataset. For example, say you have a functional dataset r01+orig with 35 slices in the z-direction; if you wish to output only the first half of the slices into one dataset and the second half of the slices into another dataset, you could do something like the following:

3dZcutup -prefix bottomHalf -keep 0 16 r01+orig
3dZcutup -prefix topHalf -keep 17 34 r01+orig


Recall that the slices start at slice 0, which is why the last slice in this dataset is labeled 34. The output datasets for these commands would look something like this:

TopHalf

BottomHalf


In order to rearrange these slices, either to recreate the original dataset or to inverse the slices, you can collate the slices with the complement to 3dZcutup, 3dZcat:

3dZcat -prefix rightDirection bottomHalf topHalf
3dZcat -prefix wrong Direction topHalf bottomHalf

RightDirection

WrongDirection

A more useful application of 3dZcutup and 3dZcutup is during the stage of 3dDeconvolve, where each slice (or group of slices) can be run through 3dDeconvolve, and then stacked together to create the complete statistical dataset (the following is copied from the help file of 3dZcutup, since it is the better than any example I could come up with):

  foreach sl ( `count -dig 2 0 20` )
    3dZcutup -prefix zcut${sl} -keep $sl $sl epi07+orig

    # Analyze this slice with 3dDeconvolve separately

    3dDeconvolve -input zcut${sl}+orig.HEAD            \
                 -num_stimts 3                         \
                 -stim_file 1 ann_response_07.1D       \
                 -stim_file 2 antiann_response_07.1D   \
                 -stim_file 3 righthand_response_07.1D \
                 -stim_label 1 annulus                 \
                 -stim_label 2 antiann                 \
                 -stim_label 3 motor                   \
                 -stim_minlag 1 0  -stim_maxlag 1 0    \
                 -stim_minlag 2 0  -stim_maxlag 2 0    \
                 -stim_minlag 3 0  -stim_maxlag 3 0    \
                 -fitts zcut${sl}_fitts                \
                 -fout -bucket zcut${sl}_stats
  end

  # Assemble slicewise outputs into final datasets

  time 3dZcat -verb -prefix zc07a_fitts zcut??_fitts+orig.HEAD
  time 3dZcat -verb -prefix zc07a_stats zcut??_stats+orig.HEAD


What this will do is loop over twenty slices and perform 3dDeconvolve on each slice separately, and then reassemble both the fitts and stats datasets from all of the individual slices after they have been analyzed. This can help when the dataset is either extremely large, or your computer has relatively little memory.


Thanks to alert reader Landoska, who once cut his FMRI data into four slices instead of eight, because he wasn't hungry enough for eight slices. (rimshot)


Thursday, December 13, 2012

Top Ten Tips for Graduates Teaching Undergraduates

This past week I finished teaching a research methods class, a mandatory course for psychology majors. We covered a wide range of topics, including clinical treatments, the Stroop effect, and the Implicit Associations Test, with a focus on having the students design their own experiments, gather some data, and analyze the results. In all, it was a good experience, but it also presented several challenges, including four medium-length papers (about 10-14 pages on average for each one) spread across forty or so students. There might be a some English or Philosophy professors who will get a hearty guffaw out of this ("You think that's a lot of papers to read? Let me show you, boy!"), but for me, it was quite an adjustment.

Most graduate students will be called upon to teach at some point during their PhD career, and rightly so; in addition to inuring yourself to mindless drudgery and incessant complaints, teaching helps you to hone your public speaking skills and how you interact with an audience. Think of it as having benefits across a wide range of areas: Speaking, effectively dealing with complaints, and making yourself engaging and presentable. You will get far more out of it if you see it as an opportunity to improve your marketability.

That being said, teaching can be at times frustrating and challenging; however, there are several ways to make the experience less painful, more efficient, and maybe even enjoyable. The following is a list of rules and procedures I put in place to protect myself; some of them I got from previous teachers, while some of them I picked up along the way:

  1. Make your syllabus clear. Students are ingenious at finding loopholes and will exploit them if they can. (Just think back to when you were an undergraduate; wouldn't you do the same thing?) Think of your syllabus as a contract with the class; the more detailed and clearer you are, the less wiggle room there is to abuse the system.
  2. Set strict deadlines for turning in drafts of papers. My policy was to look at only one draft at least seventy-two hours before the paper deadline; likewise, students had only one week after receiving their grades to schedule a meeting to discuss their paper. One important policy I put in the syllabus was that, if students requested a meeting to contest their grade, I would regrade the entire paper; their final grade could go either way. Over the whole semester, not one student contested their paper grade. Then again, I am also an unstable and terrifying person.
  3. If you can, request electronic drafts and grade those. There may be some who like grading by hand, which is fine; however, grading electronic copies allows you to more easily store a copy of their graded papers (with comments) on a hard disk for future reference.
  4. Establish your superiority on the first day by asking a brainteaser, such as "What do you put into a toaster?" Most of the students will answer "Toast," when the answer is actually "Bread". This will severely demoralize them, and make them unwilling to challenge your authority.
  5. For God's sake, don't get your stones wound up too tight over grammatical errors like than/then and effect/affect. I can't tell you how many times I've heard a colleague say "Can you believe what this student wrote? It says here: 'My experimental manipulation effected the results'. How am I supposed to know what they mean?" It's pretty simple: They meant "affected". Most students are not clever enough to construct a sentence the other way around. I've seen some pretty horrific, sometimes humorous, butcherings of the English language, and this is a comparatively mild offense.
  6. Be patient. Sometimes you will be shocked by the kinds of mistakes the students make, and it will bewilder you how some of them appear to keep missing the point when you feel that you stated it so clearly. Sometimes they really just don't get it, and they might not still not get it even by the end of the semester. Sometimes it's because of you, and you really just don't explain some things very well, no matter what you think or what your colleagues tell you. You might think that if you were in their position, you would pick these things up quicker, because you're smarter, more motivated, and - dammit - you try! But, just to put things in perspective, you should also recall that there are some things that you are still laughably, ridiculously bad at - maybe mathematics, or music, or thawing food in the microwave - no matter how much work you put into it.
  7. Spend as much time as you need to grade, and no more. Honestly ask yourself: How many students will really look at the comments? Not many, and those that do, won't care that much. Use the comments more as an anchor for addressing concerns if students have questions about the grade they received; the comment will help you remember where they screwed up, and help you address it effectively. This is not a recommendation to slack off about grading; rather, realize that you can quickly enter a point of diminishing returns with the amount of detail in your feedback.
  8. Have fun. We all want our teachers to be fun and engaging; if you come in with a terrible attitude, the students will mentally check out. They might mentally check out no matter what, but as long as you're having fun, at least you don't have to suffer.
  9. Watch Saved by the Bell reruns. In addition to being an excellent TV show, Saved by the Bell will make you familiar with the archetypal students that you will encounter in your class: Zach, the preppy one; Slater, the jock; Screech, the nerd; and Kelly, the popular girl. The show will teach you how each one operates, and will allow you to deal with them accordingly. In addition, you will have a leg up on knowing all of the potential pranks and shenanigans they will try to pull on you, such as when Zack puts his clothes on the skeleton from anatomy class to hide his absence.
  10. Appreciate the good things that happen. Everyone complains about the bad things that happen to them that they don't deserve; few people take as much notice of the good things that happen to them that they also don't deserve. Some students will surprise you with their enthusiasm and insight, and genuinely want to learn more about the subject. Be grateful when you get students like this.
Those are my recommendations for how to approach a class, especially if you are teaching it for the first time. Above all, continually ask yourself whether this is something that you are interested in doing; some people find that they have a knack for it, and will find a teaching career a rewarding and enjoyable experience. Likewise, if you absolutely cannot stand it, also take note of that, and plan accordingly; there are few things more depressing than a man continuing to do a job he abominates.



Wednesday, December 12, 2012

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!



Saturday, December 8, 2012

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.


Wednesday, December 5, 2012

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.

Tuesday, December 4, 2012

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



Sunday, December 2, 2012

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.

Saturday, December 1, 2012

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.