File: global_listing.rst

package info (click to toggle)
pyxnat 1.6.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,204 kB
  • sloc: python: 6,016; makefile: 28; sh: 17; xml: 11
file content (56 lines) | stat: -rw-r--r-- 1,667 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
A few shorcuts
--------------

There are two competing interfaces in XNAT REST API to retrive array of 
values. One is the search engine, the other one is URIs with advanced
filtering. The search engine offers more flexibiblity but can be slower
in some cases. This is why **pyxnat** wraps some REST calls to list
all the experiments and scans from the server with the filering capabilities.


List all the experiments from an XNAT instance:

.. code-block:: python

   >>> central.array.experiments()

List all the experiments from an XNAT instance with some filters:

.. code-block:: python

   >>> central.array.experiments(project_id='my_project',
   ...				 subject_id='my_subject',
   ...				 experiment_id='my_expt',
   ...				 experiment_type='xnat:mrSessionData')

List all the experiments from an XNAT instance with custom filters. The
following call returns all the mrSessionData experiments whose subject
is 42 years old:

.. code-block:: python

   >>> central.array.experiments(constraints={'xnat:mrSessionData/age':'42'})

To customize the returned columns:

.. code-block:: python

   >>> central.array.experiments(columns=['xnat:mrSessionData/age'])

The syntax to list all scans is exactly the same:

.. code-block:: python

   >>> central.array.scans(project_id='my_project')

There is also a shortcut that uses the search engine to list all the 
experiments it combines the syntax from the previous shortcuts and the
syntax from the search engine to express the contraints.

.. code-block:: python

   >>> central.array.search_experiments(
   ...		project_id='my_project',
   ...		constraints=[('xnat:subjectData/AGE','>','14'), 'AND']
   ...		)