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?
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. https://www.anaconda.com/download
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.
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
Install dask-jobqueue using pip:
pip install dask_jobqueue
Install this special version of afni python code (this is a beta version, not integrated into the AFNI code completely yet) https://afni.nimh.nih.gov/sscc/staff/glend/python_template_beta1.tgz
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)
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
./make_template_dask.py
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
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.
Running this script with data and options (for debugging, precede this with "python -m pdb "… )
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.
Bokeh graphs and monitoring using port number used above.
start browser (firefox) http://localhost:8790
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!
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,
Alexander
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.