Fmriprep Custom Template

Hi there - I’m new to fmriprep and would like to create a custom template for my study for about 20 young and 20 old participants. Is there step-by-step documentation about custom template implementation for fmriprep?
Thanks!

https://fmriprep.org/en/stable/spaces.html?highlight=custom%20template#custom-standard-spaces

Look at the heading “Custom standard spaces” for advice on this!

Thanks @Steven! I was specifically asking if there was any other documentation on how to create a template, before uploading it into Templateflow.

Maybe you’ll find this helpful then.

It uses a diffusion-derived map but hopefully you’ll be able to adapt it to your needs.

Best,
Steven

Thank you again for your help! So I have two templates ready (that I downloaded) but they are nii.gz files and I understand to upload them into TemplateFlow they must be in bids format. Any idea how to do this?

According to the fmriprep documentation I linked you to earlier, they just have to be placed in your templateflow cache directory renamed to follow some naming conventions. You can name it the same way, just replacing “MyCustom” with whatever you want to call your template.

Thank you @Steven. The easiest resource to understand can be found here Python Client - TemplateFlow, which states that custom templates can be placed in the TemplateFlow home directory.

Ok @Steven, i placed my custom template in the cache directory, but i’m getting this error when I try to run fmriprep with this command:

fmriprep-docker /Volumes/netlabserver/ACHIEVE/DATA/ACHV_Imaging_Data/ /Volumes/netlabserver/ACHIEVE/DATA/ACHV_Imaging_Data/derivatives/test --output-spaces icbm452 participant --participant_label 01

Traceback (most recent call last):
File “/Users/tstoica/Library/Python/3.9/bin/fmriprep-docker”, line 8, in
sys.exit(main())
File “/Users/tstoica/Library/Python/3.9/lib/python/site-packages/fmriprep_docker.py”, line 488, in main
raise RuntimeError(“Custom template %s requires a tpl- prefix” % tpl)
RuntimeError: Custom template participant requires a tpl- prefix

All the files inside the folder have a tpl prefix, so I’m wondering why it’s not working. Also, if i try the command with another template in the folder, it gives the same error.

Another question - since I am planning to use aroma, which requires the func images to be resampled to MNI152NLin6Asym space, is there a way to use aroma with custom templates?

Hello, I am facing the same issue. Has anybody found out how to solve it?

I not believe that is available natively, but you can always just AROMA-ize your data afterwards with the AROMA regressors in the confounds file.

Can you let us know what steps you have taken to create the custom template and troubleshoot?

Thanks,
Steven

thanks for asnwering. I used the following code to generate a 3mm template:

flirt -in tpl-MNI152NLin2009cAsym_res-02_T1w.nii.gz -ref tpl-MNI152NLin2009cAsym_res-02_T1w.nii.gz -applyisoxfm -noresampblur 3 -out tpl-MNI152NLin2009cAsym3mm_res-01_T1w.nii.gz

I then manually generated a tpl-MNI152NLin2009cAsym3mm folder into templateflow folder and placed the newly generated 3mm nifti file. I then copied the json file from the 2mm resolution and manually changed the resolution to 3 in the json file

I then run the following code:

fmriprep-docker /path1/test /path1/der_test --participant-label 2 --fs-license-file /pathfreesurfer/license.txt --output-spaces MNI152NLin2009cAsym3mm:res-01