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.1b.dev.tar.gz (4.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Egg

File details

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

File metadata

  • Download URL: pyxnat-0.4.1b.dev.tar.gz
  • Upload date:
  • Size: 4.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyxnat-0.4.1b.dev.tar.gz
Algorithm Hash digest
SHA256 56b7abe2dc51617a67de21386a58221f84ca666c47d55a394ae49eb46d42a9af
MD5 3809bfaa44f795f602e464334a3eae57
BLAKE2b-256 484f96804902e31c31597826d031961ef455305b99a89f7f66d3e5d34f3ef9a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyxnat-0.4.1b.dev-py2.6.egg
Algorithm Hash digest
SHA256 a7e585900ccbc3a13d7ebaff334f3373c95cda24bbcec6f86e4f372662501021
MD5 53c36f2e21e058377b2f9ea4e06152c2
BLAKE2b-256 4a8641d790c1b8d47e082b0a8b2c968b601225eb61466746273a7679cd43af58

See more details on using hashes here.

Supported by

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