7.5. Results Service - Register Results Operator

7.5.1. Overview

This container provides simple functionalities to register pipeline processed results with the Results Service. For example, one may use this operator to register and export results with the DICOM Adapter and/or Render Server.

7.5.2. Inputs

The Register Results operator allows multiple inputs to be mapped. It scans for all files from all mapped inputs and registers each result/file with the Results Service.

7.5.3. Outputs

No output needs to be mapped to the Register Results operator as it does not create any additional files.

7.5.4. Directory Structure

└──app
    ├── clara                       # register results' main module
    │   ├── __init__.py
    │   ├── register.py
    │   ├── results_client.py
    │   └── strings.py
    ├── Dockerfile                  # Dockerfile for running the register results operator
    ├── __init__.py
    ├── LICENSE                     # NVIDIA license file
    ├── LICENSE-3rdParty            # Third party licenses
    ├── public
    │   └── docs
    │       └── README.md           # This file
    ├── register.py                 # Entry point
    ├── tests                       # Unit test module
    │   ├── context.py
    │   ├── __init__.py
    │   ├── test_register.py
    └── test_results_client.py

7.5.5. Dependencies

  • Results Service

7.5.6. Executing the Operator Within a Container

In order to use this container, one or more operators may be defined in the pipeline definition using this container image.

7.5.6.1. Steps

  1. Define one or more operators in the pipeline definition that uses this Docker image.

    - name: {name of the operator}
        description: {description for this operator}
        container:
            image: clara/register-results
            tag: 0.2.0
            command: ["python", "register.py", "--agent", "{agent name}", "--data", "{data to be passed to the agent}"]
        input:
        - from: {source operator}
          name: {name for this input}
          path: {mount point}
    
  2. Make sure the name of the operator is unique.

  3. Update the command section with the following:

    • –agent: name of the agent. See Results Service for more details.

    • –data: An optional JSON array of objects in JSON string format. Each object defined in the JSON array creates a new task with the Results Service.
      For example, when the operator is used to export DICOM results to external DICOM devices, the user may define an array of strings where each is the name of the destination defined in the DICOM configuration. The following creates 3 tasks with the Results Service, where the first task has parameters set to “Orthanc” and so on.

      [\"Orthanc\", \"DCM4CHEE\", \"ImageViewer1\"]
      

Note: this container may be configured multiple times within a single pipeline definition.

7.5.6.2. Example

In the following pipeline example, the container (clara/register-results) is used in 5 different operators.

  1. register-mhd-output

  2. register-dicom-output

The first operator tells the Results Service that there are files available for the Render Server. Please note that in this operator, the --data field is not required.

The second operator tells the Results Service that there are DICOM files available for the DICOM Adapter. The --data field specifies the DICOM destinations the results are delivered to. Please note, --data must be a valid JSON formatted string.

api-version: 0.3.0
name: liver-tumor-example
operators:
# input dicom reader operator
  - name: dicom-reader
    description: Converts DICOM data into MHD.
    container:
      image: clara/dicom-reader
      tag: 0.2.0
    input:
    - from: ${{dicom-input-from-adapter}}
      name: ${{input-file-from-adapter}}
      path: /input
    output:
    - path: /output
  - name: liver-tumor-segmentation
    description: AI segmentation of liver and tumor
    container:
      image: clara/ai-livertumor
      tag: 0.2.0
    input:
    - from: dicom-reader
      path: /input
    output:
    - path: /output
      name: segmentation
# Register converted MHD data with Results Service
  - name: register-mhd-output
    description: Exports MHD data.
    container:
      image: clara/register-results
      tag: 0.2.0
      command: ["python", "register.py", "--agent", "renderserver"]
    input:
    - from: dicom-writer
      name: dicom
      path: /input
# image data to DICOM
  - name: dicom-writer
    description: Converts MHD into DICOM data.
    container:
      image: clara/dicom-writer
      tag: 0.2.0
    input:
    - from: liver-tumor-segmentation
      name: segmentation
      path: /input
    - from: ${{dicom-input-from-adapter}}
      name: ${{input-file-from-adapter}}
      path: /dicom
    output:
    - path: /output
      name: dicom
# Register converted DICOM data with Results Service
  - name: register-dicom-output
    description: Exports DICOM data.
    container:
      image: clara/register-results
      tag: 0.2.0
      command: ["python", "register.py", "--agent", "ClaraSCU", "--data", "[\"Orthanc\", \"DCM4CHEE\", \"ImageViewer1\"]"]
    input:
    - from: dicom-writer
      name: dicom
      path: /input