Issue with data extraction using 3dROIstats

This is my first time posting a question so I apologize if my question is not clear.

I am running group analysis of 75 subjects for a task that has 6 conditions (6 sub-bricks for extraction). When I run our script to extract the data using 3dROIstats, only the first 50 subjects data are extracted as output. I tried re-running the script with just the remaining subjects, and only the next 17 subjects’ data was extracted into output. I don’t know what is going on. We have used this script before for analyses for a task that had 3 conditions and had no issues with the extraction and output.

This is the code we run fin the terminal or the full extraction process with the mask for the significant clusters for the main effect of “block”, and then the “stripped” 3dLME file (no headers), and the name of the output file I want created (and then below, is the script embedded in the “” command"):

tcsh mainblock.F10.p001_mask+tlrc MID.LME.gxc_stripped brainact_gxc_block

The “”:




set SD = ‘/mnt/c/TS_MID’ # Subjects directory

set Grp = ‘/mnt/c/TS_MID’ #The directory with the masks and 3dLME cmd
set maskName = $1 # mask you want to extract from
set mask = $Grp’/‘$maskName
set cmd = $Grp’/'$2 #script with participant info, e.g. lme
set dbName = $3 #make up a name for the output

e.g. ./ Amy+tlrc lme amyg_activation.txt

Extract the dataTable from the 3dMVM/3dLME command

strip trailing continuation line

sed ‘s/\$//g’ < $cmd > rm_temp

delete blank lines, strip the leading and trailing spaces, tabs

sed -e ‘/^$/d’ -e ‘s/^\t*(.*)/\1/g’ < rm_temp > rm_temp3

set Subj = cut -f1 rm_temp3
set Group = cut -f2 rm_temp3
set Cond = cut -f3 rm_temp3
set File = cut -f4 rm_temp3

rm rm_temp*

foreach i (seq $#Subj)
echo “$File[$i]”
eval “3dROIstats -nzmean -nzsigma -nzmedian -nzvoxels -nzminmax -mask $mask $File[$i] > rm_temp”
cat rm_temp
if ($i == 1) then
head -1 rm_temp | sed ‘s/^/Subject\tGroup\tCond\t /’ >> $dbName
tail -1 rm_temp | sed ‘s/^/’“$Subj[$i]”‘\t’“$Group[$i]”‘\t’“$Cond[$i]”‘\t /’ >> $dbName
tail -1 rm_temp | sed ‘s/^/’“$Subj[$i]”‘\t’“$Group[$i]”‘\t’“$Cond[$i]”‘\t /’ >> $dbName
rm rm_temp

Thanks for your help!

Also, the very end of the output displayed in the terminal says: “File: Subscript out of range.”

I suggest not removing those rm_* files, so that you can verify what is in them when it fails.
Also, consider running the script via “tcsh -x”, just to capture all the commands and output. That might have a lot of output, but should make debugging much easier.

  • rick

Hi Rick,
Thank you very much. We used the tcsh -x and found where some data was not being extracted and realized it was due to a second tab in our code for two variables. Thanks for your help!

That’s good news and surely a big relief, thanks!

  • rick