9.30. Clara Deploy Series Selector


CAUTION: This is NOT for diagnostics use.

9.30.1. Overview

This example operator, in the form of a Docker container, loads DICOM metadata in a JSON file as well as the mapping from series to image files (both are output from Clara Deploy DICOM Parser operator), selects the series using the configurable series matching rules, and finally saves the images file paths for those series in a JSON file in the output folder.

Series matching rules are simplistic and served as the place holder for more advanced and sophisticated rule engine.

The output of this operator is expected to be consumed by the downstream operators in the pipeline in order to intelligently select and arrange image files as input to their processing step, e.g. a multi-channel AI inference operator.

9.30.2. Inputs

This operator expects by default an input folder /input, which contains DICOM metadata JSON files, and the series to images mapping files, both are output from Clara Deploy DICOM Parser.

9.30.3. Outputs

This application saves the image file paths for the selected series in a JSON file, selected-images.json, in the output folder, /output by default.

Logs generated by the application is saved in a folder, /logs by default, which similarly must be mapped to a host folder.

9.30.4. Directory Structure

The directories in the container are shown below. The core of the application code is under the folder selector.


. ├── config │   └── selection-rules.json ├── __init__.py ├── logging_config.json ├── main.py ├── ngc │   ├── metadata.json │   └── overview.md ├── public │   └── docs │   └── README.md ├── requirements.txt ├── run_app_docker.sh ├── selector │   ├── app.py │   ├── __init__.py │   ├── metadata_loader.py │   ├── runtime_envs.py │   └── series_selector.py └── test-data ├── dicom-metadata.json └── series-images.json

9.30.5. Executing Operator in Docker Prerequisites

  1. Ensure there are DICOM metadata and series to image mapping files, which can be copied from within the Docker image. Step 1

Change to your working directory, e.g. my_test. Step 2

Create, if they do not exist, the following directories under your working directory:

  • input, and copy over the DICOM metadata and series to image mapping files.

  • output for the selected image files.

  • logs for log files. Step 3

In your working directory, create a shell script, e.g. run_app_docker.sh or other name if you prefer, copy the sample content below, save it, and make sure the variable APP_NAME has the same value as the actual container, e.g. nvcr.io/ea-nvidia-clara/clara/series-selector:0.6.0-2004.4,


SCRIPT_DIR=$(dirname "$(readlink -f "$0")") APP_NAME="series-selector" # Pull Docker image if not already, example below # docker pull nvcr.io/ea-nvidia-clara/clara/series-selector:<TAG> # docker tag nvcr.io/ea-nvidia-clara/clara/series-selector:<TAG> dicom-parser:latest # Run ${APP_NAME} container. docker run --name test -t --rm \ -v ${SCRIPT_DIR}/input:/input \ -v ${SCRIPT_DIR}/output:/output \ -v ${SCRIPT_DIR}/logs:/logs \ -e DEBUG_VSCODE \ -e DEBUG_VSCODE_PORT \ -e NVIDIA_CLARA_NOSYNCLOCK=TRUE \ ${APP_NAME} echo "${APP_NAME}has finished." Step 4

Execute the script below, and wait for the application container to finish,

./run_app_docker.sh. Step 5

Check for the following output files:

  1. Metadata files in the output directory, selected-images.json

9.30.6. Executing Operator Locally

If you want to see the internals of the container and want to manually run the application, follow these steps.

  1. Start the container in interactive mode. See the next section on how to run the container, and replace the docker run command with docker run -i --entrypoint /bin/bash

  2. Once in the Docker terminal, ensure the current directory is series-selector.

  3. Copy test-data/* to /input

  4. Create folders /output and /logs

  5. Type in command python ./main.py"

  6. Once finished, type exit.

9.30.7. Customizing Series Matching Rules

This requires replacing the config/selection-rules.json file in the Docker image and building a new custom Docker image. Even though it is simple to provide a configuration file when running the Docker image standalone, builing a custom Docker image makes it simpler to deploy a pipeline on Clara Deploy.

  • Tag the pulled series selector Docker image, e.g. .. code-block:: bash

    docker tag nvcr.io/ea-nvidia-clara/clara/series-selector:0.6.0-2004.4 series-selector:latest

  • Use the existing selection-rules.json as a basis to customize the matching rule, and build your custom Docker image using the following Dockerfile as an example. ```bash # Build upon the pulled container; version tag can be used if known. FROM series-selector

COPY ./selection-rules.json ./config/selection-rules.json ```

9.31.1. License

An End User License Agreement is included with the product. By pulling and using the Clara Deploy asset on NGC, you accept the terms and conditions of these licenses.

9.31.2. Suggested Reading

Release Notes, the Getting Started Guide, and the SDK itself are available at the NVIDIA Developer forum.

For answers to any questions you may have about this release, visit the NVIDIA Devtalk forum.

© Copyright 2018-2021, NVIDIA Corporation. All rights reserved. Last updated on Feb 1, 2023.