#!/bin/tcsh
Unix help
# -------------------------------------------------------------------
# if the afni directory is already here, whine a bit and terminate the script
if ( -e ARzs_data/afni ) then
echo ""
echo "Failure:"
echo ""
echo "The resulting afni directory already exists. Please move the"
echo "afni directory and then re-run the script. Example:"
echo ""
echo " mv ARzs_data/afni ARzs_data/afni.bak"
echo ""
exit
endif
Unix help
# -------------------------------------------------------------------
# start in the top level data directory
cd ARzs_data
Unix help
# -----------------------------------------------------------------------------
# create AFNI dataset from spgr I-files - will move them to afni dir later
to3d -prefix ARzs_spgr -spgr SPGR_data/I.*
AFNI howto Unix help 'to3d -help'
# -----------------------------------------------------------------------------
# create AFNI datasets from both EPI runs
cd EPI_data
Unix help
Ifile -nt '???/I.*'
AFNI howto Unix help 'Ifile -help'
# change the prefix for the output file in GERT_Reco
sed 's/OutBrick/ARzs_EPI/' GERT_Reco > new_GERT_Reco
Unix help
# now run the new_GERT_Reco script
tcsh new_GERT_Reco
AFNI howto Unix help
# -------------------------
# store outliers in a subdir
cd afni
mkdir outliers
mv ARzs_EPI*Outliers.1D outliers
cd ..
Unix help
# -------------------------
# put the new afni directory back at the top level
mv afni ..
AFNI howto Unix help
# go back to top level data directory
cd ..
Unix help
# -----------------------------------------------------------------------------
# put our spgr anat dataset into that new afni directory
mv ARzs_spgr+orig.* afni
Unix help
# -----------------------------------------------------------------------------
# do volume registering
cd afni
3dvolreg -prefix ARzs_EPI_r1_vr -base ARzs_EPI_r2+orig'[155]' ARzs_EPI_r1+orig
3dvolreg -prefix ARzs_EPI_r2_vr -base ARzs_EPI_r2+orig'[155]' ARzs_EPI_r2+orig
AFNI howto Unix help '3dvolreg -help'
# average the two volume registered time series datasets
3dcalc -a ARzs_EPI_r1_vr+orig -b ARzs_EPI_r2_vr+orig \
-expr '(a+b)/2' -prefix ARzs_EPI_avg
AFNI howto Unix help '3dcalc -help'
# -----------------------------------------------------------------------------
# create 1D file (Ref_ARzs.1D) containing ideal reference function
waver -GAM -dt 2 -numout 160 \
-inline 15@0 \
15@1 7@0 15@1 8@0 \
15@1 7@0 15@1 8@0 \
15@1 7@0 15@1 8@0 \
10@0 \
> Ref_ARzs.1D
AFNI howto Unix help 'waver -help'
# gasp! actual statistical analysis of data! ...
3ddelay -input ARzs_EPI_avg+orig -ideal_file Ref_ARzs.1D -fs 0.5 -T 45
AFNI howto Unix help '3ddelay -help'
# -----------------------------------------------------------------------------
# extra stuff
3dIntracranial -anat ARzs_spgr+orig -prefix ARzs_spgr_NoSkl
AFNI howto Unix help '3dIntracranial -help'
echo "results are left in directory: ARzs_data/afni"
Unix help