@@ -79,7 +79,10 @@ def ls(self, template, **kwargs):
7979
8080 Examples
8181 --------
82- >>> client = TemplateFlowClient()
82+
83+ .. testsetup::
84+
85+ >>> client = TemplateFlowClient()
8386
8487 >>> client.ls('MNI152Lin', resolution=1, suffix='T1w', desc=None) # doctest: +ELLIPSIS
8588 [PosixPath('.../tpl-MNI152Lin/tpl-MNI152Lin_res-01_T1w.nii.gz')]
@@ -140,7 +143,10 @@ def get(self, template, raise_empty=False, **kwargs):
140143
141144 Examples
142145 --------
143- >>> client = TemplateFlowClient()
146+
147+ .. testsetup::
148+
149+ >>> client = TemplateFlowClient()
144150
145151 >>> str(client.get('MNI152Lin', resolution=1, suffix='T1w', desc=None)) # doctest: +ELLIPSIS
146152 '.../tpl-MNI152Lin/tpl-MNI152Lin_res-01_T1w.nii.gz'
@@ -211,6 +217,38 @@ def get(self, template, raise_empty=False, **kwargs):
211217 return out_file [0 ]
212218 return out_file
213219
220+ def templates (self , ** kwargs ):
221+ """
222+ Return a list of available templates.
223+
224+ Keyword Arguments
225+ -----------------
226+ resolution: int or None
227+ Index to an specific spatial resolution of the template.
228+ suffix : str or None
229+ BIDS suffix
230+ atlas : str
231+ Name of a particular atlas
232+ desc : str
233+ Description field
234+
235+ Examples
236+ --------
237+
238+ .. testsetup::
239+
240+ >>> client = TemplateFlowClient()
241+
242+ >>> base = ['MNI152Lin', 'MNI152NLin2009cAsym', 'NKI', 'OASIS30ANTs']
243+ >>> tpls = client.templates()
244+ >>> all([t in tpls for t in base])
245+ True
246+
247+ >>> sorted(set(base).intersection(client.templates(suffix='PD')))
248+ ['MNI152Lin', 'MNI152NLin2009cAsym']
249+ """
250+ return sorted (self .get_templates (** kwargs ))
251+
214252 def get_metadata (self , template ):
215253 """
216254 Fetch one file from one template.
@@ -222,7 +260,10 @@ def get_metadata(self, template):
222260
223261 Examples
224262 --------
225- >>> client = TemplateFlowClient()
263+
264+ .. testsetup::
265+
266+ >>> client = TemplateFlowClient()
226267
227268 >>> client.get_metadata('MNI152Lin')['Name']
228269 'Linear ICBM Average Brain (ICBM152) Stereotaxic Registration Model'
0 commit comments