How To Download Image Data From XNAT Projects

Users can download image session data from XNAT in a variety of contexts:

  • Users can download scan files from an individual session report page by selecting Download > Download Images from the actions menu.
  • Users can download scan files from any image session in a project by selecting Download Images from the actions menu on the project report page.
  • Users can download scan files from any data table containing image sessions (for example, by clicking Browse > Data > MR Sessions in the top navigation) by selecting Options > Download in the data table menu.

Using any of these mechanisms will bring the user to the download UI in the XNAT webapp. Depending on how many sessions you are downloading, or how granular you want to get concerning which scan or resource files to download, you may consider writing a download script that uses the XNAT REST API instead. 

Downloading Image Sessions via the XNAT UI

The Download Sessions UI consists of a single-screen wizard that walks you through the steps of the process.

1. Select Sessions to Download From.

2. Select Scan Format and Scan Types to Download. If you find duplicated or redundant scan types in this list, you can use the Scan Type Cleanup functions in XNAT to harmonize your scan type definitions and labels.

3. Select Download Format. The direct download option will download scan files to your local computer as a single compressed zip. The Catalog XML option is only used if you want to generate an XML download script for an external application to run. This XML file contains a series of REST paths to your scan file objects, formatted like so:

<cat:Catalog>
    <cat:sets>
        <cat:entrySet ID="XNAT_E00014">
            <cat:sets>
                <cat:entrySet ID="RAW">
                    <cat:entries>
                        <cat:entry URI="http://10.1.1.171/data/experiments/XNAT_E00014/scans/2/resources/DICOM/files?format=zip&projectIncludedInPath=true&subjectIncludedInPath=true" format="ZIP"/>
                        <cat:entry URI="http://10.1.1.171/data/experiments/XNAT_E00014/scans/3/resources/DICOM/files?format=zip&projectIncludedInPath=true&subjectIncludedInPath=true" format="ZIP"/>
                        <cat:entry URI="http://10.1.1.171/data/experiments/XNAT_E00014/scans/5/resources/DICOM/files?format=zip&projectIncludedInPath=true&subjectIncludedInPath=true" format="ZIP"/>
                        <cat:entry URI="http://10.1.1.171/data/experiments/XNAT_E00014/scans/6/resources/DICOM/files?format=zip&projectIncludedInPath=true&subjectIncludedInPath=true" format="ZIP"/>
                        <cat:entry URI="http://10.1.1.171/data/experiments/XNAT_E00014/scans/7/resources/DICOM/files?format=zip&projectIncludedInPath=true&subjectIncludedInPath=true" format="ZIP"/>
                        <cat:entry URI="http://10.1.1.171/data/experiments/XNAT_E00014/scans/802/resources/DICOM/files?format=zip&projectIncludedInPath=true&subjectIncludedInPath=true" format="ZIP"/>
                    </cat:entries>
                </cat:entrySet>
            </cat:sets>
        </cat:entrySet>
...

You'll notice that the REST paths contain parameters for file format and structural organization. These parameters and others can be set in REST download actions. See below for further details.


Downloading Image Files

After clicking 'Submit', a modal like the one above will come up and inform you of the file to be downloaded. If you wish to begin the download, simply click 'Download'. You may then get a pop-up asking whether you want your browser to save or open the file you're downloading. After you make your selection, and the file downloads, you can view the downloaded file. The file name will match the listed download id, so 'admin-20170731_143706.zip' is the name of the file that was saved in the above screenshot. If you are downloading the catalog XML, the extension will be '.xml'.


Downloading Individual Files via the Manage Files UI.

If you need to download individual scan or resource files attached to an XNAT Image Session, you can browse the XNAT file system by clicking "Manage Files" in the Actions menu of the image session report page. A popup will open with a file explorer in it.

Clicking on any of the file names will start an HTML-based download of that file. This bypasses the Java applet, but is time-consuming for any series of files.


Downloading Image Session Files via the REST API

If you are comfortable scripting API calls, you will find a great deal more ability to customize your downloads with the available API download parameters.

See: Downloading Image Files via the XNAT API.


$label.name