Hi-
The path stuff still needs to be sorted in setup, but have you seen the @chauffeur_afni functionality here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/tutorials/auto_image/main_toc.html
... and more specifically here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/tutorials/auto_image/auto_%40chauffeur_afni.html
?
That would seem to be doing a looot of what you want, and perhaps with a simpler interface. For example, based on your code and this example:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/tutorials/auto_image/auto_%40chauffeur_afni.html#ex-4-overlay-beta-coefs-and-threshold-with-stats
I wonder if this is close to what you want (just an easier/more extensible interface):
@chauffeur_afni \
-ulay "${anat}" \
-olay "${func_glt}" \
-set_subbricks 0 8 9 \
-func_range 0.005 \
-cbar Reds_and_Blues_Inv \
-set_dicom_xyz 0 0 0 \
-delta_slices 14 17 11 \
-opacity 6 \
-thr_olay_p2stat 0.05 \
-thr_olay_pside bisided \
-prefix Aud_Aget_axi_0.005 \
-set_xhairs OFF \
-montx 3 -monty 3 \
-blowup 2 \
-label_mode 1 -label_size 4
... though, you could use "-box_focus_slices AMASK_FOCUS_ULAY " to pick a zoomed-in autobox within which to make evenly spaced slices, rather than specifying both "-set_dicom_xyz 0 0 0" and "-delta_slices 14 17 11".
You can also add in the translucent way of thresholding, which I really like, see here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/tutorials/auto_image/auto_%40chauffeur_afni.html#ex-5-overlay-beta-coefs-and-threshold-translucently-with-stats
--pt