Extracting single-subject parameter estimates from clusters for simple effects

Our lab wants to extract parameter estimates from group-level clusters to tease apart simple effects. (We are used to doing this in SPM using marsbar.) We are currently under the impression that we want to do this by saving a mask of the group-level contrast like a 2x2 interaction (using the “save mask” option on the cluster table; so it includes all clusters per group-level contrast) and then making a script for each group-level contrast that loops through each subject for each single-subject contrast (e.g., con_001.nii in SPM) using the 3dmaskave command. For example:


SUBLIST=(100 101 102 103);
CLUSTERS=(1 2 3 4 5);
CONTRASTS=(con001 con0002);

echo “Subject,Cluster,Contrast,Average” > cluster_averages.csv

for SUB in SUBLIST; do
averesult=3dmaskave -mask clustermask.nii -mrange ${CLUSTER} ${CLUSTER} /data/fx/${SUB}/${CONTRAST}.nii
echo “$SUB,$CLUSTER,$CONTRAST,$averesult” >> cluster_averages.csv

Does this look correct? (We ran fx level analyses in SPM but switched to AFNI for rx-level analyses because we found out 3dmvm is more appropriate for 2 (between-subjects variable) x 2 (within-subjects variable) x 2 (within-subjects variable) rmANOVA.

Is using the “write cluster” option in the cluster table inappropriate because it reports cluster parameters/voxel, while the “save mask” option is appropriate for our purposes because it reports cluster parameters/subject?

Thank you!


That look good to me. Note that SaveMsk also prints a
3dclust command to the terminal window, in case you want
to put that command in a script.

The “write” button (per cluster in the report) produces a
dataset that is similar to that from the SaveMsk button,
except it would contain only that cluster’s mask. Note
that the 4th largest cluster would still have values of 4
in it, whether from “write” or from “SaveMsk”.

Neither method writes data values. They both write a mask
where any ROI just contains that ROI rank index, where 1
is the largest cluster, in voxels.

Does that seem reasonable?

  • rick

Thanks so much for your feedback. I apologize for my delayed reply; I was out of town.

To confirm, would that mean I could either use the “write cluster” or “save mask” option (either use the “write cluster” option for each cluster for each rx-level contrast or just selecting the “save mask” option once for each rx-level contrast) to make a mask of the clusters, and then using the 3dmaskave option to extract the parameters from each cluster for each participant?

Using the “SaveMsk” button also displays a 3dclust command in the
terminal window that could be used to generate the given mask. It
is that command that I recommend starting with, modifying the
command input and output to match the volumes you care about.

Using the buttons in the afni GUI is instructive, but in the end, script
the analysis (do not use a GUI), so that later you know exactly how
it was run and how to repeat it.

  • rick