Lung Tumor Segmentation Pipeline
The Lung Tumor Segmentation pipeline is one of the reference pipelines provided with Clara Deploy SDK. A pre-trained model for volumetric (3D) segmentation of the lung from a mono-modal CT image is used in the pipeline. This pipeline depends on the Clara Deploy DICOM Adapter to receive DICOM images, specifically single-channel 3D CT images. Once the DICOM instances are stored, the pipeline is started to first convert the DICOM instances to a volume image in MetaIO format and then processes the input volume image with the Lung Tumor Segmentation AI model. The AI model generates the labeled segmentations (within the lung) as a mask on slices of the volume of the same size as the input. The lung tumor is labeled as 1, and the background is labeled as 0. In its final steps, the pipeline outputs the mask as a new DICOM series using the original study instance UID; also, it outputs original and segmented volumes to the Clara Deploy Render Server for visualization on the Clara Dashboard.
The Lung Tumor Segmentation pipeline is defined in the Clara Deploy pipeline definition language. This pipeline utilizes built-in reference containers to construct the following set of operators:
The dicom-reader operator converts input DICOM data into volume images in mhd format.
The lung-tumor-segmentation operator performs AI inference against the NVIDIA TensorRT Inference server to generate lung tumor segmentation volume images.
The dicom-writer converts the segmented volume image into DICOM instances with a new series instance UID and the original DICOM study instance UID.
The register-dicom-output operator registers the DICOM instances with the Clara Deploy DICOM Adapter which in turn stores the instance on external DICOM devices per configuration.
The register-volume-images-for-rendering operator registers original and segmented volume images with the Clara Deploy Render Server for visualization.
The following is the details of pipeline definition, with comments describing each operator’s functions as well as input and output.
api-version: 0.3.0 name: lung-tumor-pipeline operators: # dicom reader operator # Input: '/input' mapped directly to the input of the pipeline, which is populated by the DICOM Adaptor. # Output:'/output' for saving converted volume image in MHD format to file whose name # is the same as the DICOM series instance ID. - name: dicom-reader description: Converts DICOM instances into MHD, one file per DICOM series. container: image: clara/dicom-reader tag: latest input: - path: /input output: - path: /output # lung-tumor-segmentation operator # Input: `/input` containing volume image data, MHD format, with a single volume. # Output: `/output` containing segmented volume image, MHD format. # `/publish` containing original and segmented volume images, MHD format, # along with rendering configuration file. - name: lung-tumor-segmentation description: Segmentation of lung tumor inferencing using DL trained model. container: image: clara/ai-lungtumor tag: latest input: - from: dicom-reader path: /input output: - path: /output name: segmentation - path: /publish name: rendering services: - name: trtis # TensorRT Inference Server, required by this AI application. container: image: nvcr.io/nvidia/tensorrtserver tag: 19.08-py3 command: ["trtserver", "--model-store=$(NVIDIA_CLARA_SERVICE_DATA_PATH)/models"] requests: gpu: 1 # services::connections defines how the TRTIS service is expected to # be accessed. Clara Platform supports network ("http") and # volume ("file") connections. connections: http: # The name of the connection is used to populate an environment # variable inside the operator's container during execution. # This AI application inside the container needs to read this variable to # know the IP and port of TRTIS in order to connect to the service. - name: NVIDIA_CLARA_TRTISURI port: 8000 # Some services need a specialized or minimal set of hardware. In this case # NVIDIA Tensor RT Inference Server [TRTIS] requires at least one GPU to function. # dicom writer operator # Input1: `/input` containing a volume image file, in MHD format, name matching the DICOM series instance UID. # Input2: `/dicom` containing original DICOM instances, i.e. dcm file. # Output: `/output` containing the DICOM instances converted from the volume image, with updated attributes # based on original DICOM instances. - name: dicom-writer description: Converts MHD into DICOM instance with attributes based on the original instances. container: image: clara/dicom-writer tag: latest input: - from: lung-tumor-segmentation name: segmentation path: /input - path: /dicom output: - path: /output name: dicom # register-volume-images-for-rendering operator # Input: Published original and segmented volume images, MHD format, along with rendering configuration file # from lung-tumor-segmentation operator. # Output: N/A. Input data will be sent to the destination, namely `renderserver` for Render Server DataSet Service. - name: register-volume-images-for-rendering description: Register volume images, MHD format, for rendering. container: image: clara/register-results tag: latest command: ["python", "register.py", "--agent", "renderserver"] input: - from: lung-tumor-segmentation name: rendering path: /input # register-dicom-output operator # Input: `/input` containing DICOM instances in the named output, `dicom` from dicom-writer operator. # Output: N/A. Input data will be sent to the destinations, namely DICOM devices, by the Clara DICOM SCU agent. - name: register-dicom-output description: Register converted DICOM instances with Results Service to be sent to external DICOM devices. container: image: clara/register-results tag: latest command: ["python", "register.py", "--agent", "ClaraSCU", "--data", "[\"MYPACS\"]"] input: - from: dicom-writer name: dicom path: /input
Please refer to the parent section on how to register a pipeline, configure the DICOM Adapter, and execute the pipeline.