3dlmer - plotting multiple clusters binarized into increases and decreases

AFNI version info (afni -ver):
AFNI version=AFNI_24.1.17 (Jun 12 2024) [64-bit]


I'm plotting some clusters and I'm having some doubts regarding 1) what values I'm actually plotting and 2) if this is correct.

In short:

  1. I run a 3dlmer model on my dataset to detect differences in sound processing between two groups of participants

  2. I thresholded my data with 3dClustSim (min cluster size = 15) and p=0.05. I displayed my -gltCode contrasts in Afni thresholding with Zvalues

  3. I saved the clusters from the afni gui clicking on button "write" on the "Rpt" window (see screenshot). I then ran 3dinfo to check the range of values and saw that it was always between 0 and the number corresponding to the number of the cluster (for cluster n 14, values range from 0 to 14 and so on). So I suppose I saved some kind of mask of my cluster....(?):

  1. As I don't necessarily care about the range of values inside each cluster, but I care about the direction of the effect (i.e., which regions showed increased or decreased activation in group 1/2), I divided my clusters into positive and negative based on the values in Afni and then plotted them in MRIcroGL, something like this:

Here, i plotted a contrast group1-group2, so blue denotes decreases for Group1 and red increases.. This offers an intuitive understanding of the difference between the groups.. But I suppose that this way of displaying my results is not correct, since I have basically plotted the cluster masks in red when they are positive and in blue when they are negative...

Can someone help me and explain to me how to plot (1) gltCode Z-statistics of multiple clusters on the same template without having a different colorbar for each cluster?

Thanks a lot in advance for your help and time..

I'm not entirely sure what you're aiming to achieve, but perhaps the "highlight, but don't hide" method in the AFNI GUI could be what you're looking for?

Gang Chen

If i go for that method, i suppose once i extracted my Z-statistics with 3dClusterize with -bisided -1.96 1.96

3dClusterize -nosum -1Dformat -inset path/LMEr_gm_ROI_240708+orig.HEAD -idat 45 -ithr 46 -NN 3 -clust_nvox 15 -bisided -1.96 1.96 -pref_dat Clus_Std_cc_dc_15

when I plot the results I should leave the z limits to max/min? :

If I instead use the same limits used in the Afni GUI, it'd be -2.458/ 2.458:

Which one should I use? and do these clusters look good to you just by visual inspection or too sparse maybe revealing something went wrong with the model?

thanks again,

First, it makes more sense to use colors to represent effect magnitude rather than statistical evidence (e.g., Z-value in your case). Second, artificial dichotomization can be problematic, which is why we recommend the "highlight, but don't hide" approach. These points are elaborated in this blog post.

@ptaylor, is the continuous visual representation available in the latest version of SUMA?

Gang Chen

SUMA has the translucent thresholding capablilty for suma-loaded overlays (see recent OHBM poster here), but it currently won't recognize transparency when the afni GUI sends it to suma via talking. Further work is coming on that.

It would be possible to make volumetric montages in afni with alpha+boxed on, such as done with @chauffeur_afni here.


While we work on getting that ready for simple interactivity, there is a workaround. You need the original mapping dataset and two copies - one to act as the sub-threshold "alpha" transparency equivalent, and another to be a binary mask. Use the alpha dataset with a reduced dim factor. Show the binary mask as a contour. Here's an outline of the steps:

# choose a dataset to map (thickness map as example here)
# copy left and right files to temporary datasets
# these will be used for a background layer for alpha transparency
cp std.141.lh.thickness.niml.dset temp.std.141.lh.thickness.niml.dset
cp std.141.rh.thickness.niml.dset temp.std.141.rh.thickness.niml.dset

# copy again, but binarize at threshold
# these will used for the contours, the b-box edge equivalents to the afni GUI
3dcalc -a temp.std.141.lh.thickness.niml.dset -expr 'step(a-4.23)' -prefix temp.mask.std.141.lh.thickness.niml.dset
3dcalc -a temp.std.141.rh.thickness.niml.dset -expr 'step(a-4.23)' -prefix temp.mask.std.141.rh.thickness.niml.dset

Load each dset into the suma viewer. Ctrl-s to start suma surface object controller. Then "Load Dset". Left, right pairs are loaded automatically if names are otherwise the same except for 'lh' and 'rh'.

Set '1' off to allow combination displays of dsets. Set Cmap to desired colormap with min, max for range and Sym set appropriately (here I turned off 'Sym' and set range from 0 to 5). I also set turn off perspective projection with the 'F8' key and turn off background convexity shading with the 'a' key.

Switch among dsets with "Switch Dset".

For the main dset, set Ord=2, Opa=1.0, Dim=1.3, Dsp=Col. (changes Ord,Opa,Dim from default). Set threshold to desired value (same as one in 3dcalc mask expression above).

For the alpha dset, "temp.dset....", set Ord=1, Opa=0.5, Dim=0.2, Dsp=Col (changes Dim from default). Keep threshold at 0.0 or minimum value.

For the mask dset, "temp_mask_dset....", set Ord=0, Opa=0.4, Dim=1.3, Dsp=Con (changes Opa, Dim, Dsp from default). Set Cmp to bw20 to have black to white colormap. Flip the colormap so the top is black by tapping the 'f' key over the grayscale color bar.

To clusterize the data, set area to desired minimum cluster area as number of nodes with Area box on lower right of controller. Activated clustering with a single left-click on the "Clst" text. In the example below, I put "100" in the Area box.

thresholded with sub-threshold at reduced brightness

thresholded and clustered with sub-threshold/non-clustered at reduced brightness

This procedure isn't quite matching the AFNI GUI display yet. It doesn't have a gradual alpha tranparency/opacity below threshold. It's only a single reduced brightness for all values. The b-box edge is not applied to the clustered results, only to the threshold values. To use this with clustered results, the mask dataset would have to be computed based on the output from a SurfClust command.