Using a custom template in fmriprep

Hi all,

I’m trying to run my fetal fMRI data through fmriprep on Compute Canada, but I’d like to use my own template (a 36-week gestational age standardized fetal brain).

I’ve read the documentation (https://fmriprep.org/en/stable/spaces.html) and it says I need to put my template in TemplateFlow’s home directory. I’ve got my template uploaded to Graham, but have no templateflow located in my home directory. I tried running it with the flag --output-spaces path/to/my/template but that didn’t work either.

Is there a way to either install templateflow in my home directory and move the template there, or specify a different path to it?

Thank you!
Emily

@akhanf and @switt4

If you’re using neuroglia-helpers on graham, I made a quick short-cut wrapper to fetch the templateflow atlases into your home directory.

Can do that by running fetch_templateflow_templates, or can use the commands here. The files would end up in ~/.cache/templateflow I believe?

Ah. I had her do step 1 yesterday evening, but I didn’t think step 2 was also necessary unless she wanted to do an update.

I can confirm from my end that the templates do end up in ~/.cache/templateflow.

Thanks guys - when I run fetch_templateflow_templates, it says:

[enicho4@gra-login2 ~]$ fetch_templateflow_templates
fetching all templateflow templates...
/home/enicho4/neuroglia-helpers/bin/fetch_templateflow_templates: line 10: /project/6007967/akhanf/opt/virtualenvs/snakemake/bin/activate: Permission denied
done

And I don’t have sudo permissions either!

Ah I think you have an old version of neuroglia-helpers, can update with:

cd ~/neuroglia-helpers && git pull

(if that fails, might need to stash any local changes then pull, e.g. git stash && git pull

That worked! I’ve now got templateflow in my .cache folder. I’ll move my fetal atlas there and re-run fmriprep.

Thanks!!

1 Like

@akhanf What would be the recommended way for @emilynichols to set $TEMPLATEFLOW_HOME to her local install in ~/.cache/templateflow?

Editing the neuroglia-helpers config file, or setting it in either .bashrc or .bash_profile? Or something else entirely?

the default location for templateflow to store things is in ~/.cache/templateflow, so as long as you are not setting TEMPLATEFLOW_HOME then it will check there