Drive afni

I am using the AFNI “driver” (afni -com … ) capability to create a lot of maps on a weekly basis.
I wanted to ask for a long time if it was possible to add a variable or environment variable to tell afni to NOT save any image (-com ‘SAVE_JPEG A.axialimage imA’ ) when the corresponding afni file does not exist.
Currently, if the overlay does not exist, it will display another file and save it under imA. That is a bit dangerous for me because I will get imA.jpg that is not imA in fact.

Actually, I have a second request. Would it be possible to have the color scale with max and min (pbar) always embedded in the image? and, not as important but it would be great if the name of the file could also be embedded.

Thank you a lot,


Hi, Julien-

Some replies to your questions:

For driving AFNI image-making, have you checked out this tool yet, @chauffeur_afni:
and its tutorials+examples page:
as well as combining @chauffeur_afni with AFNI’s “imcat”:

It might help simplify a lot of things.

To image/not image, how about using @chauffeur_afni inside a shell conditional? For example in tcsh syntax:

if ( -e $FILE_OLAY ) then
    @chauffeur_afni \
          -ulay $FILE_ULAY \
          -olay $FILE_OLAY \
    @chauffeur_afni \
          -ulay $FILE_ULAY \


Re. putting a filename into the image, there is an example of that in the @chauffeur_afni command here:

Re. doing things with limits of the colorbar:
If I were doing this, I would save those limits in a text file with the image. That would be probably nicer/easier to read than in the file itself, and you can also scriptily use those in other images. (Writing text on the images is a little bit basic; it’s a hard thing to generalize and always have be readable/nice looking).

Let me know if there are follow-ups to those things.


Thanks so much.
I will try that that. I did not know anything about @chauffeur

Hi Taylor,

@chauffeur seems to be way more user friendly, although I already had all my scripts using afni -com …
Also, I don’t think afni -com … had the option to use a label in the image. I will try that.

In term of concatenation images, yes indeed I was already using imcat, which is nice.

To the issue of not displaying an overlay if it does not exist: I understand that I can script that with a condition (-e $overlay …). Howver, usually I save multiple different overlays after opening AFNI one time. In this case, it would be very nice if this would be the default for AFNI: when overlay (or underlay) does not exist never show anything. If it is not possible, I think I can script it but it is a bit longer with multiple “-save images”

For showing the color scale, I am not sure I understood what you were saying. Really what I would have like is again the AFNI default to always have the color scale embedded in the image and when you save the image, of course it stays. In most softwares, that what they have.

Thanks so much,