Skip to main content
Skip table of contents

How to Set Custom DICOM Routing Rules via the XNAT API

With changes in XNAT 1.8, setting custom routing rules via this method will now override all other means of custom routing, and these settings can now be performed in the Site Admin UI. See:

Custom rules for project identification may be defined in the site configuration dicom-project.rules. Each line of this file contains one rule, and the first rule matching the received file will be applied, ignoring any later matching rules. This configuration can be updated by an XNAT site administrator with a PUT to the Legacy XNAT Site Configuration API, as we will show in the demonstration below.

Adding or editing the dicom-project.rules configuration can lead to weird or unpredictable labeling of sessions. Make sure your users are aware of the rules you configure to prevent confusion.

Setting the custom DICOM rules configuration

From your terminal, and using valid credentials for a XNAT site administrator, execute the following PUT statement:

CODE
$ curl -u {USER}:{PASS} -d '{DICOM-TAG}:{REGEX-PATTERN}' -X PUT -H 'Content-Type: text/plain' {SERVER}/data/config/dicom/{RULES-FILE}

Replace the variables in that curl call with the following: 

{USER}

A valid username or alias token
{PASS}A valid password for that user or token secret
{DICOM-TAG}A valid DICOM tag definition in the format (eeee:gggg)
{REGEX-PATTERN}A regular expression that can parse the format of the data being entered at the PACS console for that DICOM tag. See XNAT Custom DICOM Routing Rules in the Admin UI
{SERVER}The XNAT server path, including http(s) protocol.
{RULES-FILE}

One of three configuration rules can be set here:

  • projectRules
  • subjectRules
  • sessionRules


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.