Segregating different runs with afni_proc.py

Hello dear gurus,

I am doing an analysis with 8 runs (rest, task1, task2 etc…) and when I use afni_proc.py, it concatenates all the runs into one errts dataset. However, I need them independently for my further analyses. I can use 3dbucket to seperate them but subjects differ in respect to tasks (some subjects have all the tasks, some of them only did resting state, some of them did 4 tasks and ghosted etc.). And if I use an if-else loop for the job, there would be 2^8=256 permutations, that would take way too much time and probably it would be buggy. Is there a way to get seperate datasets from afni_proc.py output?

Thanks,
Yasir

Hi, Yasir-

Typically, one puts a set of EPI dsets into a single afni_proc.py command that makes sense to go together.

If you have runs that are very different—particularly task and rest, or unrelated tasks (a categorization which includes task and rest…)—then I would not put them all together into a single afni_proc.py command. I don’t see what that would mean— GLTs would be hard to specify for the task part, and typically task and resting FMRI have different processing paths (e.g., one includes the derivatives of motion params in rest often, but not in task).

I don’t understand the 2^8 permutation estimate.

You should likely just process each set of similar tasks together in batches. If nothing “goes together”, then you would have N afni_proc.py runs.

Cases like this are why we recommend using @SSwarper for skullstripping+nonlinear warping before running afni_proc.py: you only run that once, and then pass its results into each afni_proc.py instance. Same goes for running FreeSurfer: you run it on your subject’s anatomical once, and then you can use it in each subsequent AP run.

–pt

I see. I am using errts files for processing (not doing GLTs) and did the @SSwarper first, so I feed those files to afni_proc. The issue is there are too many subjects and too many runs so using a different afni_proc.py for every run of every subject would mean too much work. If I can’t find a way around though, I will use that method.

2^8 is, not important at this point but, suppose you have run 1, 2, …, 8. You have two states of first run, it exists and it doesn’t exist. Same for second one, third one, so if everything exist, you have 1 1 1 1 1 1 1, the last one doesn’t exist: 1 1 1 1 1 1 0; second and fifth one doesn’t exist: 1 0 1 1 0 1 1 1 etc. Two possibilities for every run: 2x2x2x2x2x2x2x2. I’m not sure the exact mathematical word for this is permutation or not (haven’t seen maths in the last 10 or so years) but this is what I meant.

Best and thanks for the always fast and detailed reply,
Yasir