Skip to main content

Xnat in Python

Project description

Pyxnat is a simple python library that relies on the REST API provided by the XNAT platform since its 1.4 version. XNAT is an extensible database for neuroimaging data. The main objective is to ease communications with an XNAT server to plug-in external tools or python scripts to process the data. It features:

  1. resources browsing capabilities

  2. read and write access to resources

  3. complex searches

  4. disk-caching of requested files and resources


A short overview

Setup the connection
>>> from pyxnat import Interface
>>> interface = Interface(server='http://central.xnat.org:8080',
                          user='login',
                          password='pass',
                          datastore=os.path.join( os.path.expanduser('~'),
                                                  'XnatStore'
                                                )
                         )
Browse the resources
>>> interface.projects()
[u'CENTRAL_OASIS_CS', u'CENTRAL_OASIS_LONG', ...]
Create new resources
>>> interface.project('my_project').create()
>>> interface.project('my_project').file('image.nii').put('/tmp/image.nii')
Metadata support
>>> proj = interface.project('my_project')
>>> proj.attrib.keys()
['note','alias','secondary_ID','name','pi_lastname',
 'label','keywords','pi_firstname','ID','description']
>>> proj.attrib.set('note', 'a note')
>>> proj.attrib.get('note')
'a note'
Make complex searches
>>> search = interface.search( 'my_search',
                               [ ('xnat:subjectData/SUBJECT_ID','LIKE','%'),
                                 ('xnat:subjectData/PROJECT', '=', 'my_project'),
                                 'AND'
                               ]
                             )
>>> search.get_subjects()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyxnat-0.4.1a.dev.tar.gz (4.7 MB view details)

Uploaded Source

Built Distribution

pyxnat-0.4.1a.dev-py2.6.egg (4.7 MB view details)

Uploaded Source

File details

Details for the file pyxnat-0.4.1a.dev.tar.gz.

File metadata

File hashes

Hashes for pyxnat-0.4.1a.dev.tar.gz
Algorithm Hash digest
SHA256 07e47477df25e06dacadb421193ff98c92a32ca7bdd2010a6dace0eeb2d81525
MD5 7c81dc88dbf71d01db92f2a87ec97808
BLAKE2b-256 0330772f97788ad42016709f5d54915824047110bd8c164b0f4a893223eb4829

See more details on using hashes here.

File details

Details for the file pyxnat-0.4.1a.dev-py2.6.egg.

File metadata

File hashes

Hashes for pyxnat-0.4.1a.dev-py2.6.egg
Algorithm Hash digest
SHA256 914e48285c5378717ce9188f7b13b5b8e77f2d0c831e99b4e7234a51bb916a7e
MD5 6e09da5273198aeb7286c49d36da219e
BLAKE2b-256 c7103cb4f24ddfc5b5e817f4aa0c6b55a194f104f74dc5d6c81004b658bfc259

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page