Skip to content

Commit

Permalink
DKR: Cache new templates
Browse files Browse the repository at this point in the history
  • Loading branch information
mgxd committed May 2, 2024
1 parent 2ec91e7 commit bdcd452
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions scripts/fetch_templates.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

"Pre-emptive caching of commonly used TemplateFlow templates"
'Pre-emptive caching of commonly used TemplateFlow templates'
import templateflow.api as tf


Expand Down Expand Up @@ -31,7 +31,7 @@ def fetch_UNCInfant():
tpl-UNCInfant/cohort-1/tpl-UNCInfant_cohort-1_label-brain_mask.nii.gz
tpl-UNCInfant/cohort-1/tpl-UNCInfant_cohort-1_label-BrainCerebellumExtraction_mask.nii.gz
"""
template = "UNCInfant"
template = 'UNCInfant'

tf.get(template, cohort=1, desc=None, suffix='T1w')
tf.get(template, cohort=1, label='brain', suffix='probseg')
Expand All @@ -47,11 +47,14 @@ def fetch_fsaverage():
tpl-fsaverage/tpl-fsaverage_hemi-R_den-164k_desc-std_sphere.surf.gii
tpl-fsaverage/tpl-fsaverage_hemi-L_den-164k_desc-vaavg_midthickness.shape.gii
tpl-fsaverage/tpl-fsaverage_hemi-R_den-164k_desc-vaavg_midthickness.shape.gii
tpl-fsaverage/tpl-fsaverage_hemi-L_den-41k_sphere.surf.gii
tpl-fsaverage/tpl-fsaverage_hemi-R_den-41k_sphere.surf.gii
"""
template = 'fsaverage'

tf.get(template, density='164k', desc='std', suffix='sphere')
tf.get(template, density='164k', desc='vaavg', suffix='midthickness')
tf.get(template, density='41k', desc=None, suffix='sphere', extension='.surf.gii')


def fetch_fsLR():
Expand All @@ -68,8 +71,8 @@ def fetch_fsLR():
tpl-fsLR/tpl-fsLR_space-fsaverage_hemi-R_den-32k_sphere.surf.gii
"""
tf.get('fsLR', density='32k')
tf.get('fsLR', density="164k", desc="std", suffix="sphere")
tf.get('fsLR', density="164k", suffix="midthickness")
tf.get('fsLR', density='164k', desc='std', suffix='sphere')
tf.get('fsLR', density='164k', suffix='midthickness')


def fetch_MNIInfant(cohort=1):
Expand All @@ -90,13 +93,29 @@ def fetch_MNIInfant(cohort=1):
tf.get(template, cohort=cohort, desc='brain', suffix='mask')


def fetch_dhcpAsym(cohort=42):
"""
Expected templates:
tpl-dhcpAsym_cohort-42_hemi-L_den-32k_sphere.surf.gii
tpl-dhcpAsym_cohort-42_hemi-R_den-32k_sphere.surf.gii
tpl-dhcpAsym_cohort-42_space-fsaverage_hemi-L_den-41k_desc-reg_sphere.surf.gii
tpl-dhcpAsym_cohort-42_space-fsaverage_hemi-R_den-41k_desc-reg_sphere.surf.gii
"""
template = 'dchpAsym'

tf.get(template, cohort=cohort, density='32k', desc=None, suffix='sphere')
tf.get(template, cohort=cohort, space='fsaverage', density='41k', desc='reg', suffix='sphere')


def main():
fetch_MNI6()
fetch_UNCInfant()
fetch_fsaverage()
fetch_fsLR()
fetch_MNIInfant()
fetch_dhcpAsym()


if __name__ == "__main__":
if __name__ == '__main__':
main()

0 comments on commit bdcd452

Please sign in to comment.