Hi,
Two quick questions:
-
I’m following afni_proc.py referencing example 11 to process resting state data. I plan on doing group-level analyses with ETAC - I know that ETAC should do my blurring for me at various levels, so should I still blur the RS data as part of the pre-processing?
-
For task-based pipelines, I’d like to extract mean beta coefficients following ETAC output in order to report parameter estimates. Given that some clusters are only going to be detected at certain blur levels my current pipeline is to mine the ETACmaskALL output to (a) collapse across all p-values for each blur, (b) extract those clusters, (c) blur the deconvolved data with the various blurs, (d) and then match up the clusters and blurred deconvolved data appropriately to extract mean beta coefficients. Then I’ll average the mean betas across all blurs for reporting. Is this a reasonable approach?
# afni script used for question number 1
afni_proc.py -subj_id sub-3156 \
-blocks despike tshift align tlrc volreg blur mask \
scale regress \
-copy_anat sub-3156/struct+orig \
-dsets sub-3156/Resting+orig.HEAD \
-tcat_remove_first_trs 0 \
-align_opts_aea -cost lpc+ZZ \
-tlrc_base vold2_mni_brain+tlrc \
-tlrc_NL_warp \
-volreg_align_to MIN_OUTLIER \
-volreg_align_e2a \
-volreg_tlrc_warp \
-volreg_warp_dxyz 1.8 \
-mask_segment_anat yes \
-mask_segment_erode yes \
-mask_import Tvent final_mask_CSF+tlrc \
-mask_intersect Svent CSFe Tvent \
-mask_epi_anat yes \
-regress_motion_per_run \
-regress_ROI_PC Svent 3 \
-regress_ROI_PC_per_run Svent \
-regress_make_corr_vols WMe Svent \
-regress_anaticor_fast \
-regress_censor_motion 0.2 \
-regress_censor_outliers 0.05 \
-regress_apply_mot_types demean deriv \
-regress_est_blur_epits \
-regress_est_blur_errts \
-regress_run_clustsim yes
#!/bin/bash
### A quick sample of some code used in question number 2
blurArr=(4 6 8); numBlur=${#blurArr[@]}
pval_list=(0.01 0.005 0.001); numPval=${#pval_list[@]}
### Mine ETACmaskALL
blurC=0; pvalC=0
while [ $blurC -lt $numBlur ]; do
# build list of p-values for each blur
unset hBrick
for ((j=1; j<=$numPval; j++)); do
hBrick+="$pvalC,"
let pvalC=$[$pvalC+1]
done
hBrick=${hBrick%?}
# extract all sub-bricks for each blur
3dbucket -prefix FINAL_b${blurArr[$blurC]}_${out} \
${out}_clustsim.NN1.ETACmaskALL.global.2sid.5perc.nii.gz[$hBrick]
# collapse across all p-values in each blur
3dmask_tool -input FINAL_b${blurArr[$blurC]}_${out}+tlrc \
-union -prefix FINAL_b${blurArr[$blurC]}_allP_${out}
let blurC=$[$blurC+1]
done
### Extract clusters
for i in FINAL_*allP*.HEAD; do
tmp1=${i%_ET*}; pref=${tmp1##*_}
tmp2=${i#*_}; blur=${tmp2%%_*}
3dclust -1Dformat -nosum -1dindex 0 \
-1tindex 0 -2thresh -0.5 0.5 -dxyz=1 \
-savemask Clust_${pref}_${blur}_mask \
1.01 5 $i > Clust_${pref}_${blur}_table.txt
done
### pull betas from appropriately blurred data for each mask
workDir=/path/to/data
subjList=(array of subjects)
# loop through blurs
d=0; while [ $d -lt $numBlur ]; do
# determine number of clusters in each blur mask
blurInt=${blurArr[$d]}
3dcopy Clust_SpT1_b${blurInt}_mask+tlrc SpT1_b${blurInt}.nii.gz
num=`3dinfo Clust_SpT1_b${blurInt}_mask+tlrc | \
grep "At sub-brick #0 '#0' datum type is short" | \
sed 's/[^0-9]*//g' | sed 's/^...//'`
# split clust masks into individual files
for (( j=1; j<=$num; j++ )); do
c3d SpT1_b${blurInt}.nii.gz -thresh $j $j 1 0 -o SpT1_b${blurInt}_${j}.nii.gz
3dcopy SpT1_b${blurInt}_${j}.nii.gz Clust_SpT1_b${blurInt}_c${j}+tlrc
done
# pull betas
for i in Clust_SpT1_b${blurInt}_c*+tlrc.HEAD; do
tmp=${i##*_}; cnum=${tmp%+*}
print=Betas_SpT1_b${blurInt}_${cnum}.txt
> $print
for j in ${subjList[@]}; do
subjDir=${workDir}/${j}
# blur decon data
3dmerge -prefix ${subjDir}/SpT1_decon_REML_blur${blurInt} \
-1blur_fwhm $blurInt -doall ${subjDir}/SpT1_decon_REML+tlrc
file=${subjDir}/SpT1_decon_REML_blur${blurInt}+tlrc
stats=`3dROIstats -mask $i "${file}[${betas}]"`
echo "$j $stats" >> $print
done
done
let d=$[$d+1]
done