AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
Jim Eliassen
October 08, 2003 04:58PM
Hi Cathy,

We have lots of experience doing something similar to what you want. We even have a perl script version that does the averaging for you, but the computer is down now and I can't get to that version. The output of this script is a multi-column file with the time series for a particular cluster at each of 12 points, for each of 12 subjects in each of 7 conditions. Obviously this is more than you want, but what you want is probably in there. You'll have to alter it to suit your particular needs, but parts of it should be useful.

The scripts uses 3dmaskave and count (both afni programs). 3dmaskave averages all the voxel values in a ROI/cluster so you won't need to worry about that in post-processing.

It also uses cut, paste and cat (which are UNIX commands, see the man pages) to grab the parts of 3dmaskave output that we want and format the output in text files.

Hopefully this will get you started.

good luck,

-jim

######################################################
#START TIMESERIES SCRIPT
######################################################


#!/bin/csh -f

nice +20




#set max number of clusters/ROIs for each comparison

set clcnt = 2

#counts from 2 to 2, since this is for smaller cluster only
foreach clust (`count -digits 1 2 ${clcnt} 1`)

foreach condition (Mv123 X A L23 L45 L6+ Mv456)

foreach subj (AGa ASe KHu KLe JVa MMi MWa PCa RBr SLa SRi TPh)

foreach time (`count -digits 1 0 12 1`)

#get average value for cluster (previously for ROI)
#
3dmaskave -mask mult_reg_a-pg/t8_mult-reg_L-IFG_R-IFG+tlrc \
-mrange ${clust} ${clust} \
${subj}/class3_normed/${subj}_${condition}_t${time}_normed+tlrc \
> tp_normed_mult_reg_a-pg/${condition}_clust${clust}_t${time}_${subj}

#good for debugging file names
#echo "mask=func_ROIs_clipped_normed_0.005_0.05/005_func${tp}_gsmax_2hits/005_t${tp}_${act_map}+tlrc"
#echo "data=${subj}/class3_normed/${subj}_${condition}_t${time}_normed+tlrc"

end #time


echo "${condition}_clust${clust}_${subj}"
echo ${condition}_${clust}_${subj} \
> tp_normed_mult_reg_a-pg/tmp1

#use timepoint 1 to get filename


cat tp_normed_mult_reg_a-pg/${condition}_clust${clust}_t1_${subj} | cut -d"["-f2 | cut -d" " -f1 \
> tp_normed_mult_reg_a-pg/tmp2

paste -d_ tp_normed_mult_reg_a-pg/tmp1 tp_normed_mult_reg_a-pg/tmp2 \
> tp_normed_mult_reg_a-pg/${condition}_clust${clust}_${subj}

foreach time (`count -digits 1 0 12 1`)
cat tp_normed_mult_reg_a-pg/${condition}_clust${clust}_t${time}_${subj} | cut -d" " -f1 \
>> tp_normed_mult_reg_a-pg/${condition}_clust${clust}_${subj}
end #time


foreach time (`count -digits 1 0 12 1`)
rm tp_normed_mult_reg_a-pg/${condition}_clust${clust}_t${time}_${subj}
end #time

end #subj


paste tp_normed_mult_reg_a-pg/${condition}_clust${clust}_AGa \
tp_normed_mult_reg_a-pg/${condition}_clust${clust}_ASe \
tp_normed_mult_reg_a-pg/${condition}_clust${clust}_KHu \
tp_normed_mult_reg_a-pg/${condition}_clust${clust}_KLe \
tp_normed_mult_reg_a-pg/${condition}_clust${clust}_JVa \
tp_normed_mult_reg_a-pg/${condition}_clust${clust}_MMi \
tp_normed_mult_reg_a-pg/${condition}_clust${clust}_MWa \
tp_normed_mult_reg_a-pg/${condition}_clust${clust}_PCa \
tp_normed_mult_reg_a-pg/${condition}_clust${clust}_RBr \
tp_normed_mult_reg_a-pg/${condition}_clust${clust}_SLa \
tp_normed_mult_reg_a-pg/${condition}_clust${clust}_SRi \
tp_normed_mult_reg_a-pg/${condition}_clust${clust}_TPh \
>> tp_normed_mult_reg_a-pg/${condition}_clust${clust}

foreach subj (AGa ASe KHu KLe JVa MMi MWa PCa RBr SLa SRi TPh)
rm tp_normed_mult_reg_a-pg/${condition}_clust${clust}_${subj}
end #subj

end #condition

paste tp_normed_mult_reg_a-pg/Mv123_clust${clust} \
tp_normed_mult_reg_a-pg/X_clust${clust} \
tp_normed_mult_reg_a-pg/A_clust${clust} \
tp_normed_mult_reg_a-pg/L23_clust${clust} \
tp_normed_mult_reg_a-pg/L45_clust${clust} \
tp_normed_mult_reg_a-pg/L6+_clust${clust} \
tp_normed_mult_reg_a-pg/Mv456_clust${clust} \
>> tp_normed_mult_reg_a-pg/clust${clust}

foreach condition (Mv123 X A L23 L45 L6+ Mv456)
rm tp_normed_mult_reg_a-pg/${condition}_clust${clust}
end #condition

end #clust


######################################################
#END TIMESERIES SCRIPT
######################################################
Subject Author Posted

group means!

Cathy October 07, 2003 07:24PM

Re: group means!

Jim Eliassen October 08, 2003 04:58PM

Re: group means!

Cathy November 25, 2003 09:51PM