====== TemplateFlow ====== https://www.templateflow.org/ is a repository of neuroimaging templates (eg. MNI, fsLR) and a [[https://pypi.org/project/templateflow/|python library]] to pragmatically download them. This includes volumetric as well as [[:tools:cifti_surfaces]]. You can find template flow atlases on [[:admin:it:rhea|rhea]] in ''/opt/ni_tools/templateflow/'' * on [[:admin:it:rhea]] the environment variable ''TEMPLATEFLOW_HOME'' is set to ''/opt/ni_tools/templateflow/'' -- a shared location for all templates. * ''~/.cache/templateflow'' **can be** a symbolic link to ''/opt/ni_tools/templateflow/'' * when using [[:tools:docker]] or [[:tools:singularity]], consider bind mounting your ''$TEMPLATEFLOW_HOME'' to that used in the container ''-v /opt/ni_tools/templateflow/:/root/.cache/templateflow''. This will avoid downloading large files every time the container is run ===== Fetching ===== ''templateflow'' uses ''[[:tools:git]] annex'' to only copy files when requested. Until ''templateflow.api.get'' is run a template will only be a stand in empty file. Here's an example of grabbing left and right for all the 32k versions of ''fsLR'' [[tools:certificates]] can cause problems, especially in docker. Look there if you get SSL errors. # export HTTPS_PROXY=socks5h://localhost:12345 # deal with rhea python certs issue / man-in-the-middle from upmc # export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt python -c "import templateflow; templateflow.api.get('fsLR', space=None, hemi=['L','R'],density='32k', suffix=['veryinflated','inflated','midthickness','sphere'])" The results is ''den-32k'' files with some size, and the rest still with size 0 (empty). du -h /opt/ni_tools/templateflow/tpl-fsLR/*hemi-L* |sort -hr 712K /opt/ni_tools/templateflow/tpl-fsLR/tpl-fsLR_den-32k_hemi-L_veryinflated.surf.gii 712K /opt/ni_tools/templateflow/tpl-fsLR/tpl-fsLR_den-32k_hemi-L_midthickness.surf.gii 712K /opt/ni_tools/templateflow/tpl-fsLR/tpl-fsLR_den-32k_hemi-L_inflated.surf.gii 704K /opt/ni_tools/templateflow/tpl-fsLR/tpl-fsLR_space-fsaverage_hemi-L_den-32k_sphere.surf.gii 552K /opt/ni_tools/templateflow/tpl-fsLR/tpl-fsLR_hemi-L_den-32k_sphere.surf.gii 148K /opt/ni_tools/templateflow/tpl-fsLR/tpl-fsLR_hemi-L_den-32k_desc-vaavg_midthickness.shape.gii 0 /opt/ni_tools/templateflow/tpl-fsLR/tpl-fsLR_space-fsaverage_hemi-L_den-59k_sphere.surf.gii 0 /opt/ni_tools/templateflow/tpl-fsLR/tpl-fsLR_space-fsaverage_hemi-L_den-164k_sphere.surf.gii 0 /opt/ni_tools/templateflow/tpl-fsLR/tpl-fsLR_hemi-L_den-59k_sphere.surf.gii 0 /opt/ni_tools/templateflow/tpl-fsLR/tpl-fsLR_hemi-L_den-59k_desc-vaavg_midthickness.shape.gii ===== Templates ===== ls /opt/ni_tools/templateflow tpl-dhcpAsym tpl-MNI152NLin2009bSym tpl-NKI tpl-dhcpSym tpl-MNI152NLin2009cAsym tpl-NMT31Sym tpl-dhcpVol tpl-MNI152NLin2009cSym tpl-OASIS30ANTs tpl-Fischer344 tpl-MNI152NLin6Asym tpl-onavg tpl-fsaverage tpl-MNI152NLin6Sym tpl-PNC tpl-fsLR tpl-MNI305 tpl-RESILIENT tpl-MNI152Lin tpl-MNIColin27 tpl-UNCInfant tpl-MNI152NLin2009aAsym tpl-MNIInfant tpl-VALiDATe29 tpl-MNI152NLin2009aSym tpl-MNIPediatricAsym tpl-WHS tpl-MNI152NLin2009bAsym tpl-MouseIn