Fast way to load multiple images at once


New AFNI user here! My lab was wondering how to load multiple AFNI images at once (aka without having to click “New” in the GUI)? We are trying to streamline our QA process and wanted to see if there was a faster way to do this!

Thanks so much!


You can “drive” AFNI from the command line:
and for your particular case, probably the OPEN_WINDOW feature is useful.

There is an @DriveAfni demo, actually, which you would probably want to look at. You need to download the AFNI Bootcamp dataset, and run the command just from the directory containing AFNI_data6.tgz; if you run @DriveAfni with no args, it will tell you how to do so.

Finally, a bit separately, but perhaps of use to you, you can systematically save snapshots/montages and review those. I have found this veeery useful in life. For examples, see here:
esp. the @chauffeur_afni part.


… and here is a starter example:


# make a list of dsets you want to view;  here, they are in a single directory
set all_dsets = ( DSET1 DSET2 DSET3 ...   )
set Ndset     = ${#all_dsets}

# have at least as many letters as $all_dsets
set all_letts = ( A B C D E F G H )
set Nlett     = ${#all_letts}

if ( ${Nlett} < ${Ndset} ) then
    echo "** Hey, going to need more than ${Nlett} for these ${Ndset} dsets!"
    exit 1

# -----------------------------------------------------

set NPB = `afni -available_npb_quiet`
set x0  = 200

# open up the GUI
afni -npb ${NPB} -niml -yesplugouts -echo_edu  

# loop over datasets, move windows with each new dset opened
foreach ii ( `seq 1 1 ${Ndset}` )

    # pick out each dset, and a letter designation for the controller
    set dset = ${all_dsets[$ii]} 
    set ll   = ${all_letts[$ii]} 

    # open up each, moving a bit to the right with each new set
    plugout_drive -npb ${NPB}    -echo_edu                              \
       -com "OPEN_WINDOW ${ll}  geom=500x500+${x0}+5"                   \
       -com "OPEN_WINDOW ${ll}.axialimage geom=500x500+${x0}+200        \
             ifrac=0.8 opacity=9"                                       \
       -com "OPEN_WINDOW ${ll}.sagittalimage geom=500x500+${x0}+725     \
             ifrac=0.8 opacity=9"                                       \
       -com "SWITCH_UNDERLAY ${ll}.${dset}"                             \

   @ x0 = $x0 + 510