Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
(artemis)$ module load xnatutils

NB: This module also loads the Python, Dcm2niix and MRtrix modules

xnat-get

The xnat-get command is used to download resources from an XNAT instance from the command line (e.g. on Artemis). It is a flexible tool that can used to download resources specified in XML files generated by the XNAT UI or match sessions and scans using wildcard patterns.

For in-depth help pass the --help or -h flag to xnat-get

Code Block
(artemis)$ xnat-get --help

Authentication

The first time you use xnat-get you will be prompted to enter the URL of the XNAT server you would like to download from (e.g. https://xnat.sydney.edu.au) and your username and password. If you have a University of Sydney “unikey” that is linked to your XNAT account use this for your username and password. xnat-get will generate a user token and store it in a hidden file in your user directory, ~/.netrc in the following format (with permissions set to 600 on the file)

...

DICOM files (ONLY DICOM file) name can be stripped using the option --strip_name or -sn. If specified, the final name will be in the format 000*.dcm.

Conversion to NIfTI format on the fly

The downloaded images can be automatically converted to NIfTI or MRtrix Image Format (MIF) formats using dcm2niix or mrconvert (if the tools are installed and on the system path) by providing the '--convert_to' option and specifying the desired format.

Code Block
(artemis)$ xnat-get TEST001_001_MR01 --scan 'ep2d_diff.*' --convert_to nifti_gz

User credentials can be stored in a ~/.netrc file so that they don't need to be entered each time a command is run. If a new user provided or netrc doesn't exist the tool will ask whether to create a ~/.netrc file with the given credentials.By default DICOM → NIfTI conversion is performed by Dcm2niix, but mrconvert can be used instead by passing the --converter flag

Code Block
(artemis)$ xnat-get TEST001_001_MR01 --convert_to nifti_gz --converter mrconvert