Help with 3DMema & 3dClustSim


I’m having a little trouble figuring out how to add 3dClustsim to my 3dMEMA script. The reason why I want to add 3dClustsim to my 3dMEMA script is because when I look at the functional file, that was generated from 3dMEMA, there is still a lot of Cluster Noise that I need to remove. One of my colleagues informed me that in order to remove the cluster noise, I need to add 3dClustsim. He told me that a former colleague did this and it was written in his script, but I’m having trouble understanding the script and replacing it with what I need. I’ve read the help files and other AFNI board posts but I’m still confused on exactly what to do.

He added the following to the bottom of his 3dMEMA script:

[b]mkdir files_ClustSim

3dAutomask -dilate 1 -prefix rm.mask INCONG+tlrc

3dClustSim -both -nxyz 64 64 35 -acf $param[1-3]
-cmd 3dClustSim.ACF.cmd -prefix files_ClustSim/ClustSim.ACF[/b]

I’m confused with the following:
-Why use 1 for the dilate?
-I read that 64 64 35 is the default 3d Grid, but does this mean it works with every different template? Would this work for data that was 3dWarped to MNI template?
-I deleted the $param[1-3] because the output said that this variable was unrecognizable, however, I’m not sure what numbers to insert here. I read the 3dClustSim help file but I didn’t understand how to derive the a b c values for acf. It said in the help file that abc are “3 parameters giving the shape, and can also be estimated by 3dFWHMx.” Does this mean I have to use 3dFWHMx or do I not have to?

I read in a message board, that I can use the values from an individual subject. Is this true? If so, what file do you get the ACF values from? In one message board, I read that you can get the ACF values from the blur.errts.1d file. If this is true, which row do you pick? I have 6 rows that say ACF model parameters for aexp(-rr/(2bb))+(1-a)*exp(-r/c) plus effective FWHM? Or are the ACF values derived from the blur_est.Subject.1D file? Are the ACF values from the err_reml FWHM blur estimates row? Any information on what files to get the ACF values would be great!

All, I saw that you have to average all the individual’s ACF numbers. If so, how do you do this? How do I go about taking these values from 140 subjects and averaging them? Does anyone have a script that goes into all the blur.errts.1d file and averages the three numbers?

What is the easiest way of determining this ACF value for subjects that were all SSwarped so their anatomical would fit the MNI template?

Any help would be greatly appreciated!!


Hi, Rebecca-

An example of setting up 3dMEMA with, combining masks from individual subject analysis to make a group mask, running the 3dMEMA command, extracting estimated parameters for the “mixed ACF” for 3dClustSim simulations and using 3dClustSim is provided in the “s.nimh_group_level_02_mema.tcsh” script here:
And that associated paper provides some discussion of the rationales for various pieces. I think that addresses pretty much all of the points you asked about above, but please ping back with any it doesn’t and/or further ones.

NB: that paper+associated code describes ways to correct a processing stream that another group was doing, and for comparison’s sake we could correct MOST of them, but not all of them-- we try to further point out in the paper preferable steps for analysis.