OHBM 2019 posters from the AFNI group

The following posters from members of the AFNI group are being presented at OHBM, 2019:

Notizia dell’AFNI: Meet afni_proc.py–Your New Best Friend

Notizia dell’AFNI! AFNI now makes templates from your subjects easily!

Notizia dell’AFNI: Even easier FMRI QC, with afni_proc.py’s automatic HTML review

Notizia dell’AFNI: Efficient Inter-Subject Correlation Analysis for Naturalistic data via Region-Based Multilevel Modeling

Notizia dell’AFNI: Do We Have to Deal with Multiple Comparisons in Neuroimaging?

Notizia dell’AFNI: Adapting to future needs in human neuroimaging.



Hi Paul/Daniel/John,

I saw the poster for make_template_dask.py at HBM and wanted to try it out but it seems to not be released yet(?) - was wondering if there’s any planned release date or if it’s available and I’m missing it?

Thank you!

It’s still not in the regular release, but here are some instructions for using the beta version.


  1. Install Anaconda using their downloadable scripts for your environment. On linux systems:

wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh

Or use one of the installers here. On a Mac, I’ve downloaded the Python 2.7 installer - you can still use Python 3.6 later in your Anaconda environment- from the Anaconda download page.

  1. The installation program should ask you to put these lines in your .bashrc file. (not sure why there is a space after the first dot here).
    You can source .bashrc or start a new bash shell. These lines are different than previous recent versions,
    but conda lets you know to put these lines in.

. /home/glend/miniconda3/etc/profile.d/conda.sh
conda activate

  1. Start a new bash shell

  2. Make a new conda environment for Dask that we call “dask” below. This should work with python2 or python3.
    conda create -y -c conda-forge -n dask python=3 dask
    conda activate dask

  3. Install dask-jobqueue using pip:
    pip install dask_jobqueue

  4. Install this special version of afni python code (this is a beta version, not integrated into the AFNI code completely yet)
    and then pip install the package.
    The local pip install must be done at the directory above the afni_python directory, and contains the setup.py file that specifies afni_python. Traverse down to the “python_scripts” directory. (this step lets python know where to look for other python files to import)

mkdir afni_template_beta
cd afni_template_beta
wget https://afni.nimh.nih.gov/sscc/staff/glend/python_template_beta1.tgz
tar xzvf python_template_beta1.tgz
cd python_scripts
pip install -e .

  1. Test out the template script to see the help. This is one level down from the previous directory in the “afni_python” directory.
    cd afni_python

  2. Add the full path to the afni_python directory to path (put absolute path in .bashrc file) This allows you to call the python programs from the command line.

export PATH=pwd:$PATH

and add this to your .bashrc file with something like this:
echo export PATH = pwd:‘$PATH’ >> ~/.bashrc

  1. There are three new python files needed here that are not yet in the standard AFNI python distribution:
    make_template_dask.py - the controlling script. Configures Dask and checks options
    construct_template_graph.py - the “meat” of the processing. Loops across subjects to create various mean templates and does the image processing.
    regwrap.py - configuration of options and simple utility functions

The other python scripts are similar to the standard distribution except python imports for afni are all from the pipinstalled afni_python package.

  1. Running this script with data and options (for debugging, precede this with "python -m pdb "… )

make_template_dask.py -ok_to_exist -dsets /data/DSST/template_making/testdata/sub-*_T1w.nii.gz
-init_base /usr/local/apps/afni/current/linux_openmp_64/MNI152_2009_template.nii.gz
-bokeh_port 8790 -dask_mode localcluster -anisosmooth
-final_space SLU_elderly1.0

The localcluster is used here, but on a SLURM cluster, we use “-dask_mode SLURM”. Also most importantly, you need to come up with a name for the output space name of the data.

  1. Bokeh graphs and monitoring using port number used above.
    start browser (firefox) http://localhost:8790

\mkdir -p $outdir

cd $outdir

------------- RUUUUUUuuuuuuuuuuuuuuuuuunnnn!..


#python -m pdb which make_template_dask.py \

#make_template_dask.py \

python -m pdb which make_template_dask.py \

-ok_to_exist                            \

-dsets `cat ${inilist}|tr '\n' ' '`     \

-init_base $inibase                     \

-bokeh_port 8791                        \

-no_strip -anisosmooth                  \

-aniso_iters 1                          \

-max_threads 2                          \

-aff_vol_rsz  ${vol_affx}               \

-cluster_walltime "71:59:00"            \

-dask_mode localcluster                 \

-findtypical_final                      \

-final_space MYSPACENAME

Dear Daniel + colleagues,

Have there been any news on make_template_dask since 2019? I’ve looked for it on AFNI’s GitHub and in the current source code for afni_python but couldn’t find it, so I assume it’s still in beta? Have there been any updates?

Thanks a lot for your fabulous work on this and all the other cool AFNI functions!

All the best,

No, unfortunately, all is still the same since that post. It does work well, but integrating it with the rest of AFNI is more difficult. I can go over it with you personally if you are interested.

Thanks so much for the quick reply! I will follow the steps in your tutorial then and would get back to you if I get stuck.

All the best,