Accessing NIfTI Data Stored in XNAT in BIDS

Good morning,

We have a large amount of imaging data stored in XNAT for both legacy and active projects. Our investigators have a strong interest in using the Brain Imaging Data Structure (BIDS) for data import/export and and BIDS-Apps for data processing. However, BIDS organizes the data in specific file formats and folder structures that are not precisely compatible with XNAT’s architecture. To facilitate integration, we incorporated a BIDS download option in the existing XnatDownload tool to allow for mapping between XNAT’s architecture and BIDS in a reproducible (and project specific) manner. We would appreciate any feedback on our beta release.

Briefly, there are two main components for the BIDS download tools: the BIDSMapping tool and the XnatToBids function. The BIDSMapping tool allows the user to create, update or replace rules/mapping at the project level on XNAT. These rules are essential as they entail the link between scan type or series description on XNAT to the BIDS datatype, task type and repetition time. XnatToBids function uses the mapping at the project to transform XNAT data into the BIDS compliant data with BIDS filenames and folder structure. Our key design criteria was to not force changes to existing projects or workflows. Since BIDS requires filenames to be renamed, we need to record the XNAT source of the data. Therefore, we added XNAT Provenance and XNAT filename fields in json sidecar. XnatToBids also creates the json sidecar if missing. Repetition Time (TR) is key for functional scans which is obtained from project level and checked with JSON sidecar or NIFTI header. If it is not similar, TR from the project level is used in JSON sidecar and NIFTI header is updated.

Using updated Xnatdownload tool users can successfully download multiple sessions in BIDS format from XNAT. This BIDS dataset was validated using the bids-validator. Further, users can also used this downloaded BIDS dataset as inputs to BIDS-App

The source code is at :

The tools can be installed with pip by: pip install dax

Documentation is at:


Please let us know if you have any questions or concerns. We would appreciate your feedback to improve our tools.

Thank you,