looking at output condition in micronXL that was created using afni

hello afni users.

I am attempting to visually inspect some output data from afni in micronXL.

I have been able to save and transfer the *.BRIK and *.HEAD files for the condition of interest

these files did open in micronXL without a problem but there was some confusion as to how to set the exact p-value of interest to .01.

my question is this:

is there of way of saving the condition in afni to create a *BRIK and *HEAD files that is saved from afni at the sxact p-value of .01. Therefore, when I open this condition in micronXL the p-value is preset at .01.

thank you for any suggestions anyone may be able to offer.

thank you


Hi, jef-

When statistical programs in AFNI run, they generally include degree of freedom and other useful information in the headers; other softwares, however, don't use or read this.

If you want to threshold a dataset at only p=0.01, you could do that, and create a new dataset with that. Use can p2dsetstat to figure out what the statistic value that corresponds to a given p within an AFNI-generated stat volume; you could set that as a threshold, and then use something like this to threshold the dataset at where local stat magnitudes were greater than VAL:

3dcalc -a DSET -expr "a*not(within(a, -VAL, VAL))" -prefix DSET_THR

However, please note that just focusing on the statistic for visualization can generally miss out on important effect estimate information. The important case for also visualizing and caring about effect estimate/point estimate/coefficient/beta information is made eloquently by Gang here:

That is why we typically strongly recommend people overlay the effect estimate and just use the statistic for thresholding---why lose half of your valuable information, esp. when the effect estimate is generally more meaningful (i.e., has units of some kind)? The point about information waste is also eloquently made by Gang here:

Also, there are real dangers to just thresholding a statistic and not looking at anything below it--valuable information still resides there. This is something that would be great to see change in the field more, as is written about here:

  • Taylor PA, Reynolds RC, Calhoun V, Gonzalez-Castillo J, Handwerker DA, Bandettini PA, Mejia AF, Chen G (2023). Highlight Results, Don’t Hide Them: Enhance interpretation, reduce biases and improve reproducibility. Neuroimage 274:120138. doi: 10.1016/j.neuroimage.2023.120138

Many of these topics are discussed in this AFNI Academy video on data visualization:
AFNI GUI: View model results (olay=coef, thr=stats)

Data visualization affects understanding and interpretation so much. It is worth keeping more data around, to have more information content.


Hello pt

Thank you for your response.

I wanted to check with you and see is there a way of using 3dcalc with the gui to create the dataset at p = .01 level or does this have to be done with the command line?

thank you


You can set the threshold value in the GUI, that is independent of 3dcalc, and it is flexible to move as you would like. In AFNI-output statistics datasets, you can also get the statistic value that corresponds to a given p-value, because the degree of freedom information is stored in the volume header. In the GUI, if you have a statistic dataset as the threshold volume, you can right-click on the "Thr" above the colorbar, and then select "Set p-value" from the dropdown menu, and put in "0.01", and then the threshold will jump to the corresponding stat value.

A shortcut to do that is to hover the mouse over the "p=..." just below the colorbar, and scroll upward on your mousewheel. A small "p= ..." menu will pop up, and you can enter the p-value there, for which the threshold will jump.



I understand what you are saying as to how to set the threshold in the afni gui for the viewer. I am wondering is there a way to use 3dcalc in the gui to create the dataset that i am then able to export to micronXL at the .01 level. i am being asked to create an afni condition at .01 and then export the .01 dataset to micronXL. Thus the .01 value is preset in micronXL. can the afni gui do this or is this a command line function?


I am not sure what this means: "create an afni condition at .01 and then export the .01 dataset". That is something different than thresholding? Do you want to clusterize the dataset?


i underlay a structural image. then over the condition negative incorrect. i set the trheshold at .01 and i set the significant clusters to 90.

now i have a brain map showing the significant activations for the negative incorrect condition at .01 with significant clusters greater than 90- voxels. this is the part i understand.

what i have been asked to do is now save this exact output in a format that i can email to someone and they can open the structural image and overlay the negative incorrect condition in micronXL.

i have emailed the negative incorrect.HEAD and negative incorrect.BRIK files and the structural image. but when they opened the strutural image in micronXL and overlaid the negative incorrect.HEAD file the p value could be raised and lowered. this person does not want the p value raised and lowered they want it come straight out of afni at .01. so when negative incorrect is overlaid in micronXL it opens at p = .01. so i am trying to save negative incorrect brain map at .01 somehow.

3dClusterize is the command line form of clusterizing.
You can even specify the threshold for the dset as a pvalue, such as in this help example:

3dClusterize                  \
   -inset stats.FT+tlrc.      \
   -ithr 2                    \
   -idat 1                    \
   -mask mask_group+tlrc.     \
   -NN 1                      \
   -bisided p=0.001           \
   -clust_nvox 157            \
   -pref_map ClusterMap       \
   -pref_dat ClusterEffEst

You can also click the "Rpt" button to view the Cluster report table, and drop out the map of regions there. Checking out this AFNI Academy video is probably helpful:
AFNI GUI: Clusterizing
Note that when you click "SaveMsk" in the Clusterize report window, you will get the 3dClusterize command that was used to generate that clusterized dataset in the terminal---it is a helpful starting point for using the command line program.


For those that are "command-line shy", besides the Clusterize plugin, the InstaCalc button in the "Insta" menu on the right side of the overlay panel will provide 3dcalc-like functionality inside the AFNI GUI. Saving the Overlay ("A_ICALC") dataset from the Define Datamode button will save that dataset to disk. Overall, it is easier to do with the command line to start.



The Instacalc expression can be the same as the one Paul mentioned or "b*step(abs(a)-2.5873)" (2.5783 is just the one that worked for this data; you will need to compute the appropriate t-stat value for your data). Here, I'm showing the beta value as the computed overlay with a threshold on the corresponding t-stat value at every voxel.

Click the "Compute InstaCalc" button. Make sure to lower the threshold to 0 because you are now thresholding in the InstaCalc expression instead.

Select "Define Datamode" menu, then 'SaveAs "OLay"' button. Provide a name for the output.