Class that holds the properties to access a XNAT server.
>>> interface = Interface( server='http://central.xnat.org:8080',
user='login',
password='pwd',
datastore='/tmp'
)
Parameters: | ID: string :
|
---|
Parameters: | id_filter: string :
|
---|
All REST resources objects are derived from ResourceObject which contains the common mechanisms to read and write on the server.
All REST resources objects are derived from ResourceObject which contains the common mechanisms to read and write on the server.
Creates the corresponding element on the XNAT server.
Note
The xnat_type is defined in the XNAT XML Schema. It allows a generic type such as xnat:experimentData to be derived in xnat:mrSessionData and xnat:petSessionData to be given some specific attributes.
Parameters: | xnat_type: string or None :
|
---|
See also
Deletes the corresponding resource on the XNAT server.
Parameters: | delete_files: True or False :
|
---|
Test whether this object actually exists.
Returns: | True or False : |
---|
Returns the xnat_type which is defined in the XNAT schema of this ResourceObject.
ResourceObject | possible xnat types |
---|---|
Project | xnat:projectData |
Subject | xnat:subjectData |
Experiment | xnat:mrSessionData xnat:petSessionData |
Specialized ResourceObject class for projects.
Parameters: | ID: string :
|
---|
Parameters: | id_filter: string :
|
---|
Parameters: | ID: string :
|
---|
Parameters: | id_filter: string :
|
---|
Parameters: | ID: string :
|
---|
Parameters: | id_filter: string :
|
---|
Specialized ResourceObject class for subjects.
Parameters: | ID: string :
|
---|
Parameters: | id_filter: string :
|
---|
Parameters: | ID: string :
|
---|
Parameters: | id_filter: string :
|
---|
Parameters: | ID: string :
|
---|
Parameters: | id_filter: string :
|
---|
Specialized ResourceObject class for experiments.
Parameters: | ID: string :
|
---|
Parameters: | id_filter: string :
|
---|
Parameters: | ID: string :
|
---|
Parameters: | id_filter: string :
|
---|
Parameters: | ID: string :
|
---|
Parameters: | id_filter: string :
|
---|
Specialized ResourceObject class for scans.
Parameters: | ID: string :
|
---|
Parameters: | id_filter: string :
|
---|
Parameters: | ID: string :
|
---|
Parameters: | id_filter: string :
|
---|
Specialized ResourceObject class for files.
Returns: | The specified content for this file. : e.g. T1, DTI, sequence preview : |
---|
Returns: | The specified format for this file. : e.g. NIFTI, DICOM, jpeg : |
---|
Downloads the file if it is not in the local cache.
Note
It is not possible to define a custom path for the download because files are kept in the datastore and managed with the cache manager.
Returns: | The file path as a string. : |
---|
Uploads a local file on the server.
Returns: | True if successful, False otherwise. : |
---|
Returns: | The size of the file in bytes as a string. : |
---|
Returns: | The specified tags for this file. : |
---|
Manual manager for the cached data.
The cache management is mainly transparent but it is useful sometimes to do theses actions manually.
A cache manager is linked to a ResourceObject and only works upon the cached data related to this object.
The cache manager should be accessed through the cache attribute of its corresponding resource.
>>> subject.cache.checkout(attrib=True, files=True, recursive=True)
>>> subject.cache.update()
>>> subject.cache.clear()
Parameters: | robj: ResourceObject :
|
---|
Put all the resources related to this object in the local datastore.
Parameters: | attrib: True or False :
files: True or False :
recursive: True or False :
|
---|
Define constraints to make a complex search on the database.
A search manager is avalaible as an Interface attribute. Its main usage is simply to be called to create a Search object which will be responsible for specifying the returned data and for submitting the actual query.
Some additional methods are provided to list, retrieve and delete saved search.
>>> query = [ ('xnat:subjectData/SUBJECT_ID', 'LIKE', '%'),
('xnat:projectData/ID', '=', 'my_project'),
[ ('xnat:subjectData/AGE', '>', '14'),
'AND'
],
'OR'
]
>>> search = interface.search('my_search', query)
>>>
>>> # no search is saved because it was not submitted
>>> interface.search.saved()
[]
>>> # submit and get results
>>> search.get_subjects()
[...]
>>> # now the search is saved
>>> interface.search.saved()
['my_search']
>>>
>>> same_search = interface.search.get('my_search')
Setups and returns a Search object.
Warning
The search itself is not submitted here. The search is executed when a Search method like get_subjects(), which defines what kind of data is to be returned is called.
Parameters: | name: string :
query: list :
|
---|
Returns the list of saved search.
Warning
Note that only submitted search are saved.
Parameters: | asdict: True or False :
|
---|
Returns a Search object for a saved search.
Parameters: | name: string :
|
---|
Removes a saved search and its results from the cache.
Parameters: | name: string :
|
---|---|
Returns: | True if something was deleted. : False if no search with that name existed. : |
Submits the defined search and returns a table.
Parameters: | row_type: string :
columns: list of strings :
|
---|---|
Returns: | A JsonTable object containing the results. : |