pyxnat: XNAT in Python

Date: Sep 09, 2022 Version: 1.5

Useful links: Binary Installers | Source Repository | Issues & Ideas


pyxnat is an open source, BSD-licenced library providing a programmatic interface with XNAT which is an extensible management system for imaging data (and related). pyxnat uses the RESTful Web services provided by XNAT and allows easier interaction with an XNAT server through a simple and consistent API using the Python programming language.

Short examples

Setup a connection

>>> from pyxnat import Interface
>>> interface = Interface(server='',

Traverse the resource tree

>>> list(

Operate the database

>>> project ='my_project').insert()
>>> project.resource('images').file('image.nii').insert('/tmp/image.nii')

Use the search engine

>>> table =
            ['xnat:subjectData/PROJECT', 'xnat:subjectData/SUBJECT_ID']
                     ('xnat:subjectData/PROJECT', '=', 'my_project'),

Module contents