pyxnat: XNAT in Python


pyxnat is a Python library to communicate with XNAT which is an extensible database system for imaging and related data. pyxnat uses the RESTful Web Services provided by XNAT and aims to ease communications with an XNAT server to plug-in external tools or python scripts by exposing a simple and consistent API.

Installing pyxnat
Instructions on how to get the distribution.
Start here for a quick overview.
Detailed documentation and examples.
External Resources
References to related projects and external resources.
Contributors and funding.
Latest changes
See changes from the latest version.

Short examples

Setup the connection

>>> from pyxnat import Interface
>>> interface = Interface(

Traverse the resource tree


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

Interface Main entry point to access a XNAT server.
Select Data selection interface. Callable object that indicates the data to be returned to the user.
SearchManager Search interface. Handles operations to save and get back searches on the server.
CacheManager Management interface for the cache.
Users Database user management interface. It is used to retrieve information on users registered on a server.

Table Of Contents

Next topic


This Page