Intersection Maps in AFNI

I’ve recently been working with a dataset that included the same subjects across two studies (here: study1 and study2) that should give us complimentary information.  One of the ways that you can look at data across these two studies is to create “intersection” maps, that show where the brain regions were activated in both studies.  Obviously this also works for two conditions within the same study as well.

Since I’m using afni_proc.py for my data processing, it conveniently places the results folders in whatever location I tell it to.  In this case I like to put the results for each study within the overall folder for each subject.  So I might have two folders inside each subject, each with all of the preprocessed files and most importantly the stats files:

Subject01
-- Subject01.study1
---- stats.Subject01_REML+tlrc.HEAD
-- Subject01.study2

In this case I’ve taken care of all of the normalization/transformations to standard space, hence the +tlrc ending.  Now, you should do is use 3dinfo to find the T-Stat sub-bricks for the conditions that you are interested in.  You can then reference those sub-bricks using either the name or the number associated with the name.  I usually recommend using the name so that if you change your conditions around, you don’t have to renumber all of your scripts!

I’m not statistically testing the intersects here, just using them to see which brain regions overlap.  Because of this (arguably lax but useful assumption), I’m not doing anything fancy and simply opting for an FDR correction of the activation at q=.05.  The fdrval program in AFNI can be used to find the necessary t-statistic value for a given number of degrees of freedom to get a FDR q-value of 0.05 by supplying it with the sub-brick of interest and the p-value desired (other options exist too!).  If you wanted to do something a bit more intense you can use the cdf program within AFNI to calculate the t-value for a associated p-value and degrees of freedom and go wild!

Finally I input the necessary sub-bricks and thresholds into 3dcalc and voila, I get a map that shows me the overlap.

#!/bin/bash
study1BRIK='loadSynInt#0_Tstat' #recommend using the name
study2BRIK=17 #if you don't want to use the name, you can use the number

for aSub in Subject01 Subject02 Subject03 #simple loop over subjects
do
echo $aSub
#compute necessary t-value for a given q-value
study1_tval=`fdrval -qinput $aSub/$aSub.study1/stats.$aSub_REML+tlrc. $study1BRIK 0.05`
study2_tval=`fdrval -qinput $aSub/$aSub.study2/stats.$aSub_REML+tlrc. $study2BRIK 0.05`
#compute actual intersect map for that subject
3dcalc -prefix $aSub/${aSub}_intersect
-a "$aSub/$aSub.study1/stats.$aSub_REML+tlrc.[$study1BRIK]" \
-b "$aSub/$aSub.study2/stats.$aSub_REML+tlrc.[$study2BRIK]" \
-expr "and(step(a-$study1_tval), step(b-$study2_tval))"
done

Of course what you do with said information is up to you.

Comments are closed.