9.18. Clara Register Results

Clara Register Results works with the Results Service to provide a simple way to register pipeline-processed results with the Results Service. For example, you can use this operator to register and export results with the DICOM Adapter and/or Render Server.

9.18.1. Requirements/Dependencies

9.18.2. Source Code & Pipeline Example

The source code and pipeline example are available for download on NGC.

9.18.3. 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.

9.18.4. Outputs

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

9.18.5. 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

9.18.6. Executing the Operator Within a Container

To use this container, define one or more operators in the pipeline definition using this container image.

9.18.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: [IMAGE_TAG]
            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. Ensure the name of the operator is unique.

  3. Update the command section with the following:

    • --agent: The name of the agent. See the Results Service documentation 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 array creates three tasks with the Results Service, where the first task has parameters set to “Orthanc”, the second task has parameters set to “DCM4CHEE”, and the third to “ImageViewer1”.

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

Note

This container may be configured multiple times within a single pipeline definition.

9.18.6.2. Example

In the following pipeline example, the container (clara/register-results) is used in five 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. 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 that the results are delivered to. Note that --data must be a valid JSON-formatted string.

api-version: 0.4.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: [IMAGE_TAG]
    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: [IMAGE_TAG]
    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: [IMAGE_TAG]
      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: [IMAGE_TAG]
    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: [IMAGE_TAG]
      command: ["python", "register.py", "--agent", "ClaraSCU", "--data", "[\"Orthanc\", \"DCM4CHEE\", \"ImageViewer1\"]"]
    input:
    - from: dicom-writer
      name: dicom
      path: /input