Threshold colorbar autorange

Hi all,

not a big deal, but it seems that the autorange function for the colorbar doesn’t not function properly anymore. For instance, if I have:

Thresh range: -5.37 : 18.53

Setting the autorange box, I get the value: 2.69 (with percent box unchecked)

I remember the autorange setting the value to the max abs of Thresh range, has this behavior changed?

I am running version AFNI_21.1.09 on a Ubuntu 20.4 machine.

thanks in advance for your help

Hi, Giuseppe-

Have you just updated your AFNI recently, and from a fairly old version? On May 24, 2019, we updated the default autorange (but you can still control it!) to be as follows:

5) User can set [an environment variable] AFNI_AUTORANGE_PERC to have the autoRange computed as
    percentile point (from 2-99) of the nonzero absolute values in the OLay
    brick. However, this doesn't work with warp-on-demand datasets now, so
    it is confusing. Therefore, the default setting of this is 0, which
    leaves the autoRange to be the maximum absolute value.

Note that autorange applies to the overlay, not the threshold (though sometimes those are the same data). Indeed, we used to set the upper colorbar value at the max value in the overlay dataset, but we found in virtually all floating point dset cases (e.g., anatomical overlays, effect estimates, stats, etc.) there were a small number of unrepresentatively high values that stretched the colorbar misleadingly. So we created an environment variable AFNI_AUTORANGE_PERC that you can set in your ~/.afnirc file to define a percentile within the overlay dset to set the autorange; default is 95 (percent). Its description in the list of env vars ( is:

If this variable is set to a value P between 2 and 99 (inclusive),
then it indicates that the functional overlay 'autoRange' value
will be set the P-th percentile point on the cumulative histogram
of the absolute values of the nonzero entries in the Overlay
dataset sub-brick being viewed. To be less confusing, if P=95
(for example), then the nonzero absolute values are tabulated
into histogram bins from smallest (percentile=0) to largest
(percentile=100), and the value at the 95th percentile will
be chosen -- so that only 5 percent of the values in the
dataset are larger than this autoRange value. The reason for
doing this is to avoid allowing a few large values to distort
the overlay color scale.

Thresholding is typically off by default (or actually a super-tiny value, I think, for OpenGL-related reasons, but essentially 0).

Note that if you have integer-valued dsets like ROI maps that have the INT_CMAP attribute on (to select an ROI-appropriate colorbar by default), then the max value will/should be the number of colorbands for that colormap.

Does that all seem consistent with what you have on your computer?



thank you for your reply, it does make sense. I’ll have to say, though, that when I am looking at t-maps and threshold them, the clusters have a much better “graded” appearance if I manually set the range at the max abs t-value, while if I choose the default autorange I get solid red (and/or blue) clusters.

Also, one last thing, just to clarify: in the first (yellow) quote in your message it says “Therefore, the default setting of this is 0, which leaves the autoRange to be the maximum absolute value.”, but in the second quote I gather the default is actually 95 (and is also the value I see for AFNI_AUTORANGE_PERC in my .afnirc).

If I actually wanted to revert to the old default behavior of setting autorange to max abs of olay, should I specify 0, 99, or 100 for AFNI_AUTORANGE_PERC in .afnirc?

thanks again

Hi, Giuseppe-

You are free to set things however you see best fit—tailor the GUI to your viewing preferences! And you can always adjust it later, for different data or a different study, say.

To get the former behavior, you can put:


in your ~/.afnirc.

Indeed, that first message was from the AFNI History log:
and so when it was first introduced, it was set to zero. But now the default is 95.

Note that we are also big proponents of showing your beta weight (=Coeffient) values in the overlay, and thresholding using the stats—reasons are discussed here:
… and here, in this AFNI Academy lecture, discussing the mechanics of it in the GUI:
… and in that latter video, we even discuss “translucent” thresholding with the alpha+boxed functionality in the GUI. It is worth checking out, for displaying more of your hard-earned data analysis results!


Hello Paul

Got it, and yes, I do agree with the approach of thresholding with t-value but displaying the beta or contrast values. Thank you also for sending the links!

very best