Skip to content

Download MR imaging data from xnat

Michelle Voss edited this page Sep 8, 2020 · 3 revisions

Goal: demonstrate steps for downloading MR imaging data in BIDS style

Where are imaging data sent to after a scan?

  • Once a scan is finished the technologists will send it to be stored on a separate server in XNAT based (https://www.xnat.org/) database.
  • Link: https://rpacs.iibi.uiowa.edu/xnat/app/template/Login.vm
  • MRRF needs to set you up with an account.
  • You need to be on the UIowa network to access this.
  • Once logged in, you will see a list of scans for projects you are part of
  • There are options for downloading scan directly through this interactive web interface. This is convenient in some ways, but comes at costs when there are many scans to download and you want to customize the organization of files directly upon download.
  • We will thus use a script developed by James Kent to download scans from xnat through the terminal.

Step 1. Download from where the scanner pushes the data

Example code to pull from xnat server:

sudo docker run -it --rm \
-v /Volumes/vosslabhpc/Projects/CogNeuroLab/data/bids/sourcedata:/json \
-v /Volumes/vosslabhpc/Projects/CogNeuroLab/data/bids/sourcedata:/out  \
jdkent/xnat_downloader -i /json/code/download_config.json

The images are downloaded in the format of DICOM images, which stands for D igital I maging and Co mmunications in M edicine. This is a standard output filetype for MRIs. There are many dicom files per image, as they represent pieces of the full image, and another program will be used to reconstruct the dicom's into a nifti image file that we work with.


Step 2. Reconstruct the data from dicom to nifti format

Example abstract code that was used to do this with the dcm2niix tool:

dcm2niix -o [full-path-to-directory-location-of-output] \
-f [name-of-output-file] \
-z y -b y \
[full-path-to-directory-that-holds-dicoms]