Skip to main content

Basic library for interacting with the REST interface of XNAT.

Project description

The Boring XNAT Library (BXL)

PyPI version pipeline status coverage report

BXL is a library for interacting with the REST interface of XNAT (Extensible Neuroimaging Archive Toolkit), an open-source imaging informatics software platform.

Usage

Installation

BXL is available at PyPI, the Python Package Index.

With pip package management system:

 pip install bxl

Without pip:

 git clone https://gitlab.com/bbrc/xnat/bxl.git .
 cd ./bxl
 python setup.py install

Credentials handling

The xnat.Connection() class constructor expects a credentials argument to be passed when instantiated,

  • If is a tuple, it will proceed to a basic authentication procedure against the host XNAT instance.
  • If is a basestring, it will reuse it as a cookie for authentication against the host XNAT instance.
  • Otherwise (or if authentication procedure failed in the aforementioned cases), it will remain offline.

Examples

Connect to XNAT instance using an existing JSESSIONID token and get a list of user-visible XNAT projects

 import bxl.xnat as xlib

 c = xlib.Connection(hostname='http://myxnat.org',credentials='1A12346385E876546C99B4179E20986A')
 data = c.get_projects()

 projects = { item['ID'] : item['URI'] for item in data.values() }
 print(projects)

 c.close_jsession()            

Connect via 'with' statement to create a new Female subject 'dummy' in the 'test' project

 from bxl import xnat

 with xnat.Connection(hostname='http://myxnat.org',credentials=(usr,pwd)) as c :
     response = c._put_resource(URI = c.host + '/data/projects/test/subjects/dummy',
                                options = {'gender' : 'female'} )
     subject_uid = response.content
     print 'New subject %s created!' %subject_uid

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

bxl-0.3.4.tar.gz (15.4 kB view details)

Uploaded Source

Built Distributions

bxl-0.3.4-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

bxl-0.3.4-py2-none-any.whl (17.1 kB view details)

Uploaded Python 2

File details

Details for the file bxl-0.3.4.tar.gz.

File metadata

  • Download URL: bxl-0.3.4.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for bxl-0.3.4.tar.gz
Algorithm Hash digest
SHA256 4f882192bf4dac343f96190b48d790cb36ff16107d4a1f3c51ceddd90f51175f
MD5 2095a10b93ed686aa6b407766c10ca2b
BLAKE2b-256 d16121a13e2af6bf7e944a6d7f11193d40a676717cf0a335e3be2afcbc75b9e3

See more details on using hashes here.

File details

Details for the file bxl-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: bxl-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for bxl-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9fcabec380d70cb0a064e0ef7d670e290391b35871541b7e2dbf7344f940a2ae
MD5 62bbe796b1105b673fe7eca726fe2bd4
BLAKE2b-256 21c8b9f7830e4a120f0f8aad29d32cbb18ae1271a706413d68ffc0180b12c401

See more details on using hashes here.

File details

Details for the file bxl-0.3.4-py2-none-any.whl.

File metadata

  • Download URL: bxl-0.3.4-py2-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for bxl-0.3.4-py2-none-any.whl
Algorithm Hash digest
SHA256 1e725f3156f1cbe7e0ac8183e68ec0a0e8a8e594da1c23f7aef4c0a840ebd3b0
MD5 03b4c731619ec184d5e3d7b1e4e7ac26
BLAKE2b-256 9e36cc928290d6811a35271564f0ba4c94b1959a600203d2ed1568277d490b26

See more details on using hashes here.

Supported by

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