You can follow the suggestions given by Esteban in the previous post to double-check if your files are in the mounted directory.
It worked for me.
You can follow the suggestions given by Esteban in the previous post to double-check if your files are in the mounted directory.
It worked for me.
Thanks, @Ric! Iāve already checked this: The custom template directory and files are present in my templateflow home directory and they also get listed with the api.templates()
as suggested by @oesteban. I nevertheless get the TraitError
when specifying my custom template as an output space for fmriprep.
Do I understand you correctly that for you, your custom template is working with fmriprep? Did you take any additional steps apart from making sure that the files are mounted correctly in the container? Thanks a lot!
Can you show the structure of your custom template? (i.e., ls -lah path/to/tpl-Custom23Sub
)
An improper structure or missing files (e.g., the T1w image) could be the culprit.
This is the structure that worked for me:
@alexenge I didnāt take any additional steps. I spent some time on the structure and on editing the .json file. Also, it was some time ago, I had to remove the sloppy option for testing. Without it, everything went smoothly.
Hope it helps.
Thanks so much, @Ric and @oesteban! Using my custom template with fMRIPrep has worked now, but only after Iāve explicitly specified a template resolution.
For future reference, my custom template directory looks like this (where MyTemplate
is the name of the custom template):
> ls -lah $TEMPLATEFLOW_HOME/tpl-MyTemplate
total 7.1M
drwxr-xr-x 2 aenge mnpf 32K Sep 20 14:27 .
drwxr-xr-x 3 aenge mnpf 4.0K Sep 20 14:27 ..
-rw-r--r-- 2 aenge mnpf 226 Jul 30 11:53 template_description.json
-r--r--r-- 2 aenge mnpf 1.6M Sep 16 16:52 tpl-MyTemplate_res-1_desc-brain_mask.nii.gz
-r--r--r-- 2 aenge mnpf 1.7M Sep 16 16:52 tpl-MyTemplate_res-1_T1w.nii.gz
And it can be used with fMRIPrep by adding --output_spaces MyTemplate:res-1
. As mentioned in the fMRIPrep docs, res-1
is just an index and therefore doesnāt necessarily refer to 1 mm resolution.
Weāve been looking for an older adult template on templateflow and have not found one. Would you be willing to share yours or upload it to TemplateFlow to make it generally available? Iām still struggling with how to do this.
Thank you for any suggestions.
Hi @Dianne_Patterson ,
I was able to use this one:
https://www.nitrc.org/projects/miitra
and to add it in my local version of templateflow with the following organisation:
[jsein@login02 ~] > tree .templateflow/tpl-MIITRA/
.templateflow/tpl-MIITRA/
|-- template_description.json
|-- tpl-MIITRA_res-01_T1w.nii.gz
|-- tpl-MIITRA_res-01_desc-brain_mask.nii.gz.nii.gz
|-- tpl-MIITRA_res-01_label-CSF_probseg.nii.gz
|-- tpl-MIITRA_res-01_label-GM_probseg.nii.gz
|-- tpl-MIITRA_res-01_label-WM_probseg.nii.gz
|-- tpl-MIITRA_res-01_label-brain_probseg.nii.gz
|-- tpl-MIITRA_res-02_T1w.nii.gz
|-- tpl-MIITRA_res-02_desc-brain_mask.nii.gz.nii.gz
|-- tpl-MIITRA_res-02_label-CSF_probseg.nii.gz
|-- tpl-MIITRA_res-02_label-GM_probseg.nii.gz
|-- tpl-MIITRA_res-02_label-WM_probseg.nii.gz
`-- tpl-MIITRA_res-02_label-brain_probseg.nii.gz
with the template_description.json being:
{
"Authors":[
"Mohammad Rakeen Niaz",
"Abdur Raquib Ridwan",
"Yingjuan Wu",
"Alzheimerās Disease Neuroimaging Initiative",
"David A. Bennett",
"Konstantinos Arfanakis"
],
"Acknowledgements":"Curated and added to TemplateFlow by Sein J",
"BIDSVersion":"1.1.0",
"HowToAcknowledge":"You should not use this template",
"Identifier":"MIITRA",
"License":"See LICENSE file",
"Name":"MIITRA atlas: A high resolution isotropic T1-weighted template of the older adult brain",
"RRID":"RRID:SCR_017566",
"ReferencesAndLinks":[
"https://doi.org/10.1016/j.neuroimage.2021.118869",
"https://www.nitrc.org/projects/miitra"
],
"TemplateFlowVersion":"1.0.0",
"res":{
"01":{
"origin":[
97,
-131,
-90
],
"shape":[
193,
229,
193
],
"zooms":[
1.0,
1.0,
1.0
]
},
"02":{
"origin":[
-95.75,
-131.8,
-90.75
],
"shape":[
386,
458,
386
],
"zooms":[
0.5,
0.5,
0.5
]
}
}
and my call with the singularity command being:
export SINGULARITYENV_TEMPLATEFLOW_HOME=/home/fmriprep/.cache/templateflow
singularity run -B /scratch/jsein/BIDS:/work,$HOME/.templateflow:/home/fmriprep/.cache/templateflow --cleanenv \
/scratch/jsein/my_images/fmriprep-21.0.2.simg \
--fs-license-file /work/freesurfer/license.txt /work/$study /work/$study/derivatives/fmriprep_MIITRA_anat \
participant --participant-label $sub \
-w /work/temp_dataMIITRA_anat_${study}\
--mem-mb 50000 --omp-nthreads 10 --nthreads 12 \
--fd-spike-threshold 0.5 --dvars-spike-threshold 2.0 --bold2t1w-dof 9 --skull-strip-template MIITRA \
--output-spaces MNI152NLin2009cAsym MIITRA T1w --ignore slicetiming --debug compcor \
--fs-subjects-dir /work/$study/derivatives/fmriprep_MIITRA_anat/sourcedata/freesurfer
Thank you VERY much! This helps me wrap my head around it! I see youāve done some renaming and organizing on the MIITRA files. Would you be willing to share the actual directory of tpl images? I think that it would be greatly appreciated by researchers here.
Thanks in advance!
-Dianne
Before being aggregated in to TemplateFlow, one has to be sure that the MIITRA licence is agreed to, which is readable here.
I will ask the NITRC and MIITRA people how to go from there.
Thank you very much! I think it would be valuable to many people.
MANAGED BY INCF