Hey ptaylor,
I have tried to use your script stated above to do a Z-standardization of ALFF-values in AFNI. I don't quite get if you use all images or just one here... I have adapted the script in the following way:
#!/bin/bash
PREPROC_DATA=/mypath/to/preprocessed/data
PROGS_DIR=/mypath/to/scripts
# generate a txt file with all datapaths of ALFF BRIK files calculated using 3dRSFC
for sub in ${PREPROC_DATA}/*/01-session/rs-fMRI/SLOMOCO5/ALFF_fns_0.01_0.08_striatum/RSFC_fns_ALFF+tlrc.BRIK; do
echo $sub > ${PROGS_DIR}/ALFF_analysis/alff_fns_for_z.txt;
done
# user input sets
cd ${PROGS_DIR}/ALFF_analysis
my_dset=`cat alff_fns_for_z.txt`
my_mask=${MASK_DIR}/striatum-structural-2mm-bin.nii
echo $my_mask
# calculate summary stats within brain mask
dset_mean=`3dBrickStat -mean -mask $my_mask $my_dset`
dset_stdev=`3dBrickStat -stdev -mask $my_mask $my_dset`
echo "\n\n"
echo "The mean of values within the mask is: $dset_mean"
echo "The stdev of values within the mask is: $dset_stdev"
echo "\n"
# get new dset of values
3dcalc \
-echo_edu \
-a $my_dset \
-b $my_mask \
-expr "step(b)*(a - $dset_mean) / ($dset_stdev)" \
-prefix NEW_DSET_Z
The summary stats (mean, std) should of course be calculated on the basis of the whole dataset. But when I apply 3dcalc, the output NEW_DSET_Z is a 3D file (although I would assume it to be 4D as every subject's ALFF image should be zstandardized, right?). How could I adapt the script so that every subject's ALFF image is z-standardized based on the cohort's mean and std?
Best, Melissa