@chauffeur_afni to plot highlighted stats map but box as an ROI


I have an ROI defined on anat as a mask nii file, would it be possible to plot this as the box in the alpha+box stats map using @chauffeur_afni? For instance, for the Fstats map in the QC report, F>threshold is highlighted by lower transparency, and the edges of the clusters are highlighted by the box. Is there a way to keep everything the same but only replace the box with the ROI? I also tried -clust_wami option by giving this ROI mask file, the generated text report says “WARNING: bad whereami; check atlas”, should I change the values in the mask to string instead of 0/1 binary values? Thanks a lot.


What almost works is to give the ROI mask in -clusterize -mask, but it will only show the intersection between the map cluster and the mask.


Just to check if I have this correctly: you have an anatomical underlay dataset, and the overlay is a single ROI, that is a binary mask. Do you just want the outline of the ROI, as well as the ROI shown transparently?

Or do you have an ROI region with stats values in it, for the overlay?



My underlay is T1, the overlay is a stats map let’s say for instance Fstats. I would like to add an ROI shown by box or edge such that one can visually check how well the stats map overlaps with the ROI. This ROI is given by a mask nii. What I could do with @chauffeur_afni so far is to have stats map on T1, stats map on ROI edge using -edgy_ulay, but how to plot these 3 things in one figure?

There really isn’t a good way to have multiple overlays in the AFNI GUI.

You could multiple the stats map DSET_STATS by the region map DSET_ROI, adn show that:

3dcalc -a DSET_STATS -b DSET_ROI -expr 'step(b)*a' -prefix DSET_STATS_IN_ROI

… and then use DSET_STATS_IN_ROI as the overlay.

A somewhat cheating method might be to concatenate the stats volume and the ROI one, and use the ROI one as the alpha map

  • Make an “elevated ROI” map, which is 2 in your ROI, and 1 elsewhere that you want to see stuff (and maybe 0 outside that); for example, here is one that is 2 in the ROI and 1 elsewhere:

3dcalc -a MMM1.nii.gz -expr 'step(a)+1' -prefix DSET_ROI_ELEVATED.nii.gz

  • Concatenate your desired stats volume and the ‘elevated ROI map’:

3dTcat -overwrite -prefix dset_stat_and_mask.nii.gz stats.FT+tlrc.'[2]' DSET_ROI_ELEVATED.nii.gz

View it with @chauffeur_afni now, thresholding the elevated ROI map at, say, 1.5:

@chauffeur_afni         -echo                                              \
    -ulay             MNI152_2009_template_SSW.nii.gz                 \
    -olay             dset_stat_and_mask.nii.gz                       \
    -box_focus_slices AMASK_FOCUS_ULAY                                \
    -func_range       3                                               \
    -cbar             Reds_and_Blues_Inv                              \
    -thr_olay         1.5                                             \
    -olay_alpha       Yes                                             \
    -olay_boxed       Yes                                             \
    -set_subbricks    0 0 1                                          \
    -opacity          6                                               \
    -prefix           IMG_ROI_STAT                                   \
    -set_xhairs       OFF                                             \
    -montx 3 -monty 3                                                 \
    -label_mode 1 -label_size 4


Thanks a lot, Paul. This is great.