Event Service Examples


Site-wide Project-Created Container Launch

XNAT administrators can create site-wide Event Service Subscriptions. These subscriptions apply to all event activity on existing and future projects. This site-wide subscription in this example with launch the debug-container on CT Sessions added to any project. 

Install and enable the xnat/debug-command , or any other session-level container command, using the Container Service Images & Commands menu.


Enable the session-level command in the Command Configurations menu.


Access the Event Service Administration page and click on the Add New Event Subscription button.


  1. Optional - Define a label for your Subscription. This is not required to be unique, but uniqueness is recommended.  A label will be auto-generated if not supplied. 

  2. Select Session – Created from the list of available events.

  3. Retain the default Apply to All Projects checkbox selection. This will apply this subscription to all current and future projects on this site.

  4. Select debug-session from the list of enabled Actions.

  5. Optional - Set Attributes defined by the selected Action.  In the case of a Container Service Action, the attributes correspond to editable command inputs.


  6. Define a payload filter as ("MR" in @.modalities-in-study). This JSONPath based filter ensures that our Action is processed only on sessions contain at least one MR modality. 

  7. Toggle Perform Action As to set the Action user to the event initiator, i.e. the XNAT user who uploads the session.

  8. Change the Subscription status to Enabled. This setting can also be toggled on the previous Event Subscriptions page.


Select OK to save and activate the subscription.


Upload a new MR session to any project on your XNAT. One upload method is the XNAT Compressed Uploader, accessible using the Upload → Images → Compressed Uploader menu.



After the upload and archive are complete, check the newly uploaded session page.


History items are listed in reverse-chronological order:

  1. The debug-session container command is run on the Test_ABC123 session.
  2. The debug-session on New MR Session Event Subscription is triggered.


Event Service history can be viewed on the Administer → Event Service → Event Service History page.


Click on the latest history item for event details.





Project-level MR Scan-Created Container Launch

Launch dcm2niix container on new MR scans with a DICOM resource



Multi-Project MR Session-Created Container Launch

Launch session-level container on newly archived MR imaging sessions



Creating a Subscription Filter for OHIF viewer Contour Capture 

Develop subscription and filter to capture OHIF viewer contour export.

The OHIF viewer plugin supports the visualization and annotation of DICOM images. Annotations can be captured as contours and exported to your XNAT instance, stored as an Image Assessor datatype icr:roiCollectionData. This section will walk through the creation of an Event Service Subscription triggered on the creation of a RoiCollection type Image Assessor.





{
    "id": "RoiCollection_hkytpXX_8Q2Q5fVphjp",
    "label": "AIM_20210205_153707",
    "xsiType": "icr:roiCollectionData",
    "uri": "/experiments/XNAT_E00009/assessors/RoiCollection_hkytpXX_8Q2Q5fVphjp",
    "resources": [],
    "project-id": "Cat_Imaging",
    "session-id": "XNAT_E00009",
    "props": {
        "uid": "0.a.1.4.5.6.70b7.62b.e.2.4841f14728ee8d83b7758a29a05363f80a6ccb2",
        "name": "purr_roi",
        "id": "RoiCollection_hkytpXX_8Q2Q5fVphjp",
        "roicollectiondata_info": 2,
        "subjectid": "XNAT_S00006",
        "collectiontype": "AIM"
    }
}






$label.name