A week or two ago, I asked a question about using featquery together with
the effect.sh script he posted. Since then, I've written my own script that
does exactly this, and it seems to give me good data. I am, however,
concerned that, since I don't really understand the inner workings of FSL, I
am only leading myself to believe this is good data, and in fact this method
is flawed. To anyone who understands exactly what featquery does: is this
going to give me the adjusted % BOLD signal change that I want?
#!/bin/ksh
#
# This script runs a Featquery analysis on your data,
# and then corrects it for tests that are event-related.
#
#
# Specify the path for the subject directories
#
ORIG_PATH=/net/lurch3/RetMap/AttLoad/3T/
#
# Specify the subject directories
#
DIRS="s2 s3"
#
# Specify the sessions
#
SESS="run1 run2 run3 run4"
#
# Specify the pes you want to retrieve.
#
FILES="pe1 pe2"
#
# Specify the name of the directory or directories in which the
# region of interest masks you want to use are located.
# These masks should be in standard space for the following
# code to work without modification.
#
MASK_DIRECTORY="run5 run6"
#
# Give a name for an output report file.
#
REPORT="report"
#
# Adjust the header to reflect your individual conditions
#
print "subject session mask PE value" > $REPORT
#
# Don't worry about this
#
for D in $DIRS; do
for S in $SESS; do
for M in $MASK_DIRECTORY; do
for F in $FILES; do
print -n "${D} ${S} ${M} ${F} " >> $REPORT
#
# This should be the full directory path of the data.
# The $D is your directory, and the $S is your subject.
# If it is wrong, either adjust your directory structure
# or change this path.
#
DATA_PATH=$ORIG_PATH/$D/functional/$S.feat
#
# Similarly, this should be the full directory path of your mask.
# Again, if it is wrong, change it.
#
MASK=$ORIG_PATH/$D/functional/$M.feat/ROI_reg.hdr
#------------------------------------------------------------------------------------------
# Shouldn't need to change anything below this point
#------------------------------------------------------------------------------------------
#
# Runs featquery on the data, then parses the report
# for the useful information (the mean)
#
featquery 1 $DATA_PATH 1 stats/$F -p $MASK
PE=$(awk 'BEGIN { FS="\t" ; RS="" } { printf($15) }' \
$DATA_PATH/featquery/report.txt)
#
# Adjust the signal to reflect percent signal change
#
COLUMN=${F#pe}
DESIGN=$(awk 'BEGIN { column = '"$COLUMN"' ; mn = 0; mx = 0 } \
matrix == 1 { if ($column < mn) mn=$column; \
if ($column > mx) mx=$column }\
/Matrix/ { matrix = 1 }\
END { printf("%0.3f\n", mx-mn ) }' $DATA_PATH/design.mat)
awk 'BEGIN {printf("%0.3f ", '$PE' * '"$DESIGN"') } ' \
$DATA_PATH/design.mat >> $REPORT
print " " >> $REPORT
rm $DATA_PATH/featquery/*
rmdir $DATA_PATH/featquery/
done
done
done
done
|