templateflow.api module¶
TemplateFlow’s Python Client.
- templateflow.api.get(template, raise_empty=False, **kwargs)[source]¶
Fetch one file from one particular template.
- Parameters
- Keyword Arguments
Examples
>>> str(get('MNI152Lin', resolution=1, suffix='T1w')) '.../tpl-MNI152Lin/tpl-MNI152Lin_res-01_T1w.nii.gz'
>>> str(get('MNI152Lin', resolution=2, suffix='T1w')) '.../tpl-MNI152Lin/tpl-MNI152Lin_res-02_T1w.nii.gz'
>>> [str(p) for p in get( ... 'MNI152Lin', suffix='T1w')] ['.../tpl-MNI152Lin/tpl-MNI152Lin_res-01_T1w.nii.gz', '.../tpl-MNI152Lin/tpl-MNI152Lin_res-02_T1w.nii.gz']
>>> str(get('fsLR', space=None, hemi='L', ... density='32k', suffix='sphere')) '.../tpl-fsLR_hemi-L_den-32k_sphere.surf.gii'
>>> get('fsLR', space='madeup') []
>>> get('fsLR', raise_empty=True, space='madeup') Traceback (most recent call last): Exception: ...
- templateflow.api.get_metadata(template)[source]¶
Fetch one file from one template.
- Parameters
template (str) – A template identifier (e.g.,
MNI152NLin2009cAsym
).
Examples
>>> get_metadata('MNI152Lin')['Name'] 'Linear ICBM Average Brain (ICBM152) Stereotaxic Registration Model'
- templateflow.api.templates(**kwargs)[source]¶
Returns a list of available templates.
- Keyword Arguments
Examples
>>> base = ['MNI152Lin', 'MNI152NLin2009cAsym', 'NKI', 'OASIS30ANTs'] >>> tpls = templates() >>> all([t in tpls for t in base]) True
>>> templates(suffix='PD') ['MNI152Lin', 'MNI152NLin2009cAsym', 'MNI152NLin2009cSym', 'MNIInfant', 'MNIPediatricAsym']