3dISC on 2 x 3 within-subject Design

AFNI version info (afni -ver):
Precompiled binary linux_ubuntu_16_64: Apr 13 2025 (Version AFNI_25.1.03 'Maximinus')

Dear AFNI community,

I very recently started using AFNI specifically for the 3dISC function and the ability to apporopriately model the dependencies in ISC data.
However, I am not sure if 3dISC can be applied to my problem.

I have data of N = 48 participants from a 2 (Hierarchy: Shots, Scenes) x 3 (Duration: 4s, 12s, 36s) within-subject design, so from 6 conditions in total. My intial idea, coming from lme4 analysis in R was to simply model the data like this (simplifed Code):

3dISC -prefix $prefix -jobs 6 \
          -mask bin_GM_mask.nii \
          -model 'Hierarchy*Duration+(1|Subj1)+(1|Subj2)' \
          -dataTable @dataTable.txt

But, if I understand it correclty, having to factors does not work, right?

The bigger issue however seems to be that through the within-subject design I have non-unique pairs in my data table. Thus, I always get the follwing error message: Error: the number of rows/files, 6768, is not equal to 1128 - the possible subject pairs!

Is there even any possible way I can model my 2 x 3 within-subject design in the 3dISC framework? Are there other options I have overlooked?

Thank you very much in advance!
Falko

Hi Falko,

3dISC was originally designed to handle one input per individual pair. Could you clarify what effects you're aiming to investigate with your 2 × 3 within-individual design: specific main effects and interactions?

Gang Chen

Hi Gang,

thank you for your fast response!
The idea of the analysis is to use ISC like in the papers on TRWs to identify areas that are consitently engaged by of differnt levels of duration (4s, 12s, 36s) and hierarchical structure (Shots and Scenes) to answer the question, whether hierarchically nested stimuli (like movies, in our case) are processed by the brain according the temporal duration of the individual levels, based on the different structural levels alone, or based on the combination or interaction of the two.

So, we presented the participants with 6 different sequences of stimuli that either contained only shots or entire scenes (2) of different temproal durations (3).

We now want to compare the ISC maps between the 6 conditions to - if possible - be able to identify the main effect of hierarchy, so how the ISC differs between scenes and shots, the main effect of duration, if there are differences between the 3 levels of duration, as well as possible interactions. The factor "Duration" can maybe be modelled continously even though I would prefer the 3 levels.

Regarding the specific comparisons:
I created a model, where I tried to encode the factors already in the data table to circumvent the limit of one factor in 3dISC and came up with this set-up inspired by the Example 4 in the 3dISC documentation:

3dISC -prefix $prefix -jobs 6 \
          -mask ${studyDir}/bin_GM_mask.nii \
          -model 'Hierarchy+Duration+HxD+(1|Subj1)+(1|Subj2)' \
          -qVars 'Hierarchy,Duration,HxD' \
          -gltCode ave '1 0 0 0' \
          -gltCode Hierarchy '0 1 0 0' \
          -gltCode Scene '1 0.5 0 0' \
          -gltCode Shot '1 -0.5 0 0' \
          -gltCode Duration '0 0 1 0' \
          -gltCode Sec_4s '1 0 -0.5 0' \
          -gltCode Sec_36s '1 0 0.5 0' \
          -gltCode Duration_Scene '0 0 1 0.5' \	
          -gltCode Duration_Shot '0 0 1 -0.5' \
          -dataTable @${dataTable}

Head of data table:
Subj1	Subj2	Hierarchy Duration	HxD	InputFile
SHM_134	BST_790	-0.5	-1	0.5	ISC_Pair_FishZ_Shot_4s_SHM_134_BST_790.nii \
SHM_134	BST_790	0.5	-1	-0.5	ISC_Pair_FishZ_Scene_4s_SHM_134_BST_790.nii \
SHM_134	BST_790	-0.5	0	0	ISC_Pair_FishZ_Shot_12s_SHM_134_BST_790.nii \
SHM_134	BST_790	0.5	0	0	ISC_Pair_FishZ_Scene_12s_SHM_134_BST_790.nii
SHM_134	BST_790	-0.5	1	-0.5	ISC_Pair_FishZ_Shot_36s_SHM_134_BST_790.nii \
SHM_134	BST_790	0.5	1	0.5	ISC_Pair_FishZ_Scene_36s_SHM_134_BST_790.nii \
SHM_134	KLN_831	-0.5	-1	0.5	ISC_Pair_FishZ_Shot_4s_SHM_134_KLN_831.nii \
...

What do you think? Is 3dISC the right tool for the analysis or am I barking up the wrong tree?
Thank you very much!
Best wishes,
Falko

Hi Falko,

The program 3dISC is designed to handle one input file per pair, so the model you specified wouldn’t work as intended. I suggest the following: for each of the estimations in the lines below from your script,

...
  -gltCode ave '1 0 0 0' \
  -gltCode Hierarchy '0 1 0 0' \
  -gltCode Scene '1 0.5 0 0' \
  -gltCode Shot '1 -0.5 0 0' \
  -gltCode Duration '0 0 1 0' \
  -gltCode Sec_4s '1 0 -0.5 0' \
  -gltCode Sec_36s '1 0 0.5 0' \
  -gltCode Duration_Scene '0 0 1 0.5' \	
  -gltCode Duration_Shot '0 0 1 -0.5' \

I recommend following Example 5 in the help documentation and running 9 separate analyses, one for each effect.

Does that make sense?

Gang Chen

Hi Gang,

yes, that makes sense, thank you so much.

For the contrasts of the main effects would you recommend adding the ISC maps of multiple conditions like this:

3dcalc -a subj1_subj2_Shot_4s \
-b subj1_subj2_Shot_12s  \
-c subj1_subj2_Shot_36s  \
-d subj1_subj2_Scene_4s  \
-e subj1_subj2_Scene_12s  \
-f subj1_subj2_Scene_36s  \
-expr '(atanh(a)+atanh(b)+atanh(c))-(atanh(d)+atanh(e)+atanh(f))' \
-prefix subj1_subj2

Or would you combine the time courses of the conditions before calculating effect-specific, pairwise ISC maps (e.g., subj1_subj2_Shot)?

Thank you so much for your help!
Best wishes,
Falko

Hi Falko,

Directly aggregating multiple conditions should work fine. You could slightly adjust the formula as follows:

-expr '(0.3333*atanh(a) + 0.3333*atanh(b) + 0.3333*atanh(c)) - (0.3333*atanh(d) + 0.3333*atanh(e) + 0.3333*atanh(f))' \

Gang Chen