3dttest resting-state fmri group analysis

Hello there;
i am tring to do the group analysis resting-state fmri using the 3dttest manually (because it can not import PyQt4.QtGui).
any way when i type the 3dttest commands to the Ubuntu terminal like this;

#!/bin/tcsh -xef

created by uber_ttest.py: version 2.0 (December 28, 2017)

creation date: Wed Feb 19 11:33:21 2020

---------------------- set process variables ----------------------

set mask_dset = /home/osman/Deneyler/s01/s01.results/pACC.z+tlrc
set dirA = /home/osman/Deneyler

specify and possibly create results directory

set results_dir = test.results
if ( ! -d $results_dir ) mkdir $results_dir

------------------------- process the data -------------------------

3dttest++ -prefix $results_dir/Flanker-Inc-Con
-mask $mask_dset
-setA Inc-Con
01 “$dirA/s01/s01.results/pACC.z+tlrc[0]”
02 “$dirA/s02/s02.results/pACC.z+tlrc[0]”

i got this error message!

++ 3dttest++: AFNI version=AFNI_22.1.04 (Apr 18 2022) [64-bit]
++ Authored by: Zhark++
** ERROR: Failed to open mask ‘-setA’
** FATAL ERROR: Cannot create mask from ‘-mask’ option
** Program compile date = Apr 18 2022

Hi, Osman-

I think that particular error message means that “$mask_dset” is somehow purely empty, and therefore it looks like nothing is there, and that “-setA” is the name of the mask dataset… which the code is having a hard time opening, hence the error.

So, I think you should verify that you have set mask_dset correctly—e.g., with a print statement prior to that?

Note once that is solved, you can use AFNI’s gen_group_command.py to set up the ttest for you, writing the command to a text file (here, called cmd_ttest.tcsh), which you can then execute (e.g., “tcsh cmd_ttest.tcsh”):


gen_group_command.py                                 \
    -command 3dttest++                               \
    -write_script cmd_ttest.tcsh                     \
    -prefix out_ttest                                \
    -dsets $dirA/s01/s01.results/pACC.z+tlrc*HEAD                 \
    -subs_betas '0'                                  \
    -options                                         \
        -mask ${mask_dset}

–pt

Indeed, or maybe mask_dset is an empty string, and 3dttest++ is reading “-setA” to be the mask dataset name, instead (hence it would not even see -setA as an option).

And certainly Paul’s suggestion is a good one, as usual. If you are used to using uber_ttest.py, then gen_group_command.py is a fine alternative.

  • rick

thank you ptaylor:
after i make sure that the file pACC.z+tlrc in the right directory. i run the command you suggested above like this:
set dirA = /home/osman/Deneyler
set mask_dset = /home/osman/Deneyler/s01/s01.results/pACC.z+tlrc
gen_group_command.py
-command 3dttest++
-write_script cmd_ttest.tcsh
-prefix out_ttest
-dsets $dirA/s01/s01.results/pACC.z+tlrc*HEAD
-subs_betas ‘0’
-options
-mask ${mask_dset}

this created a script file in the same directory named cmd_ttest.tcsh. whivh content is:

apply any data directories with variables

set data_dir = /s01/s01.results

3dttest++
-prefix out_ttest
-setA setA
pACC.z+tlrcHEAD "$data_dir/pACC.z+tlrcHEAD[0]"
-mask

when ı run this script to the terminal i get this error message:

++ 3dttest++: AFNI version=AFNI_22.1.04 (Apr 18 2022) [64-bit]
++ Authored by: Zhark++
++ option -setA :: processing as LONG form (label label dset label dset …)
+ WARNING: -setA: LONG form dataset label ‘pACC.z+tlrc.HEAD’ looks like a dataset name – is this OK ?!?
** FATAL ERROR: Option -setA: can’t open dataset '/pACC.z+tlrc
HEAD[0]’
** Program compile date = Apr 18 2022

Hi, Osman-

Can you please copy+paste the contenst of cmd_ttest.tcsh again? That doesn’t seem to be something program would output to me. It should just be a 3dttest++ command, with no variables and a long list of datasets.

–pt

Also, please show the command you use to execute the script. Keep in mind that it is in tcsh syntax, and should not be run with bash, for example.

  • rick

Hi ptaylor-
i am using Ubuntu 20.04 by the way.
here is the contenst of cmd_ttest.tcsh :

apply any data directories with variables

set data_dir = /home/osman/Deneyler/s01/s01.results

3dttest++
-prefix out_ttest
-setA setA
pACC.z+tlrc.HEAD “$data_dir/pACC.z+tlrc.HEAD[0]”
-mask /home/osman/Deneyler/s01/s01.results/pACC.z+tlrc

Hi rick-
i am using Ubuntu 20.04 and i converted it frombash to tcsh but still get the same resulted script.
here is the command used to execute the cmd_ttest.tcsh script:
set dirA = /home/osman/Deneyler
set mask_dset = /home/osman/Deneyler/s01/s01.results/pACC.z+tlrc
gen_group_command.py
-command 3dttest++
-write_script cmd_ttest.tcsh
-prefix out_ttest
-dsets $dirA/s01/s01.results/pACC.z+tlrc*HEAD
-subs_betas ‘0’
-options
-mask ${mask_dset}

And (assuming there are more datasets in there), what is the command you are using to execute that 3dttest++ script?
And what is the text output?

  • rick

this is the command used to execute that 3dttest++ script:

set dirA = /home/osman/Deneyler
set mask_dset = /home/osman/Deneyler/s01/s01.results/pACC.z+tlrc
gen_group_command.py
-command 3dttest++
-write_script cmd_ttest.tcsh
-prefix out_ttest
-dsets $dirA/s01/s01.results/pACC.z+tlrc*HEAD
-subs_betas ‘0’
-options
-mask ${mask_dset}

and this is the text output:

apply any data directories with variables

set data_dir = /home/osman/Deneyler/s01/s01.results

3dttest++
-prefix out_ttest
-setA setA
pACC.z+tlrc.HEAD “$data_dir/pACC.z+tlrc.HEAD[0]”
-mask /home/osman/Deneyler/s01/s01.results/pACC.z+tlrc

That particular text output is a tcsh script to execute (which looks okay, except for having only 1 dataset listed).
Have you executed that script? And using what command?

For example :

tcsh -x cmd_ttest.tcsh

To get more subjects, the previous script should have wildcards in place of s01/s01, e.g. s*/s* .

  • rick

i get this output when i run the tcsh -x cmd_ttest.tcsh command:

osman@osman-VirtualBox:~/Deneyler/s01/s01.results$ tcsh -x cmd_ttest.tcsh
set data_dir = /s01/s01.results
3dttest++ -prefix out_ttest -setA setA pACC.z+tlrc.HEAD /s01/s01.results/pACC.z+tlrc*HEAD[0] -mask
++ 3dttest++: AFNI version=AFNI_22.1.04 (Apr 18 2022) [64-bit]
++ Authored by: Zhark++
++ option -setA :: processing as LONG form (label label dset label dset …)
+ WARNING: -setA: LONG form dataset label ‘pACC.z+tlrc.HEAD’ looks like a dataset name – is this OK ?!?
** FATAL ERROR: Option -setA: can’t open dataset '/s01/s01.results/pACC.z+tlrc
HEAD[0]’
** Program compile date = Apr 18 2022

To back up a moment, the purpose of gen_group_command.py is to help write the script for 3dttest++ for example, while allowing one to use wildcards to select subject datasets. It has a similar functionality to that of uber_ttest.py, except that it does not have a graphical interface.

Typically, you should not edit it resulting command script (in this case, the script that runs 3dttest++).
We can fix the problems with the 3dttest++ script (the data_dir has been altered, and there is a wildcard character in it), but it is the gen_group_command.py script that should really be fixed, and then it will create the 3dttest++ command script, which you should try not to edit.

The way you are running the 3dttest++ script is good, you can even run the gen_group_command.py script that way. But let’s now back up and fix the ggc one.

The gen_group_command.py script seemed okay, except that it selected datasets using:

-dsets $dirA/s01/s01.results/pACC.z+tlrc*HEAD \

But that will not list all datasets, because they are not all in the s01 directory. Try something like:

-dsets $dirA/s*/s*.results/pACC.z+tlrc*HEAD \
  • rick

thank you rick
i rewrite the command like this:

set dirA = /home/osman/Deneyler
set mask_dset = /home/osman/Deneyler/s01/s01.results/pACC.z+tlrc
gen_group_command.py
-command 3dttest++
-write_script cmd_ttest.tcsh
-prefix out_ttest
-dsets $dirA/s*/s*.results/pACC.z+tlrc*HEAD
-subs_betas ‘0’
-options
-mask ${mask_dset}

this generated a cmd_ttest.tcsh script which content is:

apply any data directories with variables

set data_dir = /s*/s*.results

3dttest++
-prefix out_ttest
-setA setA
pACC.z+tlrcHEAD "$data_dir/pACC.z+tlrcHEAD[0]"
-mask

now when i run this script like that tcsh -x cmd_ttest.tcsh i get this error message:
osman@osman-VirtualBox:~/Deneyler/s01/s01.results$ tcsh -x cmd_ttest.tcsh
set data_dir = /s*/s*.results
set: No match.

But back to that first command, you still seem to be running it via bash, the wildcard expressions are failing to match any files, and it is therefore putting wildcard characters into the ttest++ script. Those “set dirA = …” types of commands are not in bash syntax.

The ggc command is using tcsh syntax in bash, and it is not working.
Do not execute ggc on the command line (if you are), but put that in its own tcsh script, and run it via the same “tcsh -x SCRIPT …” syntax as with the 3dttest++ one.

  • rick