5. How to run a Reference Pipeline

Clara Deploy SDK comes bundled with a set of reference pipelines. This section provides general guidelines on how to execute them on your local development machine. For information specific to a reference pipeline, please view the documentation of that pipeline.

5.1. Select a Reference Pipeline

  • Create a directory called “my-pipelines” in your development machine where you will store your pipelines.

  • Clara Reference Pipelines and associated artifacts are available at: /path-to-clara-deploy-installer/sdk/clara-reference-app/Pipelines

  • Navigate to ReconPipeline under the directory mentioned above and copy the yaml file ct-recon.yaml to my-pipelines directory. The yaml file provides the definition of the reference pipeline.

5.2. External DICOM Sender and DICOM Receiver

You need an external DICOM Service Class User (SCU) application to send images to the Clara DICOM Adapter (acting as a DICOM SCP). Similarly when your pipeline finishes executing, you may want to send the output to an external DICOM receiver.

For this example we will use the open-source DICOM toolkit DCMTK to provide the DICOM sender and DICOM receiver functionality.

5.2.1. Install DCMTK

Install DCMTK utilities by issuing the following command:

sudo apt-get install dcmtk

5.2.2. Setup an External DICOM Receiver

You can use the storescp utility as an external DICOM receiver. Open a terminal and run the following command to setup a DICOM Receiver. Create a directory in your machine where DICOM images produced by Clara Deploy SDK will be stored. We will refer to that directory as “dicom-destination-directory”

mkdir dicom-destination-directory
cd dicom-destination-directory
sudo storescp -v --fork -aet MYPACS 1004

MYPACS is the Application Entity (AE) title of the external DICOM Receiver.

1004 is the port number where storescp would be listening for any incoming DICOM traffic. Please note that the IP address will be the same as the local system.

5.2.3. Setup an External DICOM Sender

You can use the storescu utility from DCMTK as a DICOM sender.

5.3. Publish the Pipeline

Publishing a pipeline registers it with the platform. Once a pipeline is registered, it is represented with an ID. Follow the steps below:

  • Open a terminal and navigate to the directory my-pipelines which contains the reference pipeline

cd /path/to/my-pipelines
  • Publish the pipeline by issuing the following command

clara create pipelines -p ct-recon.yaml

Clara CLI should successfully submit the pipeline and in return should print a pipeline ID.

Note

Note down this pipeline ID as it would be used in a later section to define a new pipeline mapping in the DICOM adapter.

  • Verify that the pipeline is correctly stored by issuing the following command

kubectl get pipeline
  • In the list of pipeline IDs, you should see the pipeline ID created in the previous step.

5.4. Configure the Clara DICOM Destination

When you send images to the Clara Deploy SDK, the DICOM Adapter component acts as the internal DICOM Service Class Provider or a receiving agent.

  • Open the file ~/.clara/charts/dicom-adapter/files/dicom-server-config.yaml.

  • In the dicom->scp->sources section, ensure sender host-ip and ae-titles are correct. Alternatively, set reject-unknown-sources to false, which will allow any DICOM sender to create an association.

    dicom:
        scp:
            reject-unknown-sources: false
            sources:
            - host-ip: 172.22.8.156
                ae-title: DCM4CHEE
    
  • In the dicom->scp->ae-titles section, add a new ae-title with the name “CTRecon”

    dicom:
        scp:
            ae-titles:
            - ae-title: CTRecon
    

Note

Per the DICOM standard, the length of AE-Title should not exceed 16 characters.

  • In the pipeline-mappings section, define a new mapping with: “my-ct-recon-pipeline” as the name and CTRecon as the clara-ae-title, and use the pipeline-id that was created before.

    pipeline-mappings:
    - name: my-ct-recon-pipeline
      clara-ae-title: CTRecon
      pipeline-id: [your-pipeline-id-from-above]
    
  • Update the IP address of the destination with the name MYPACS by updating the field host-ip with the IP of your local development machine.

    dicom:
        scu:
            destinations:
            - name: MYPACS
              host-ip: [IP-address-of-remote-PACS]
              port: 1004
              ae-title: MYPACS
    
  • Restart the DICOM server by issuing the following commands:

# Stop DICOM Adapter by running the following command:
clara dicom stop
# Run the following command to check whether the DICOM adapter pod is still running:
kubectl get pods | grep clara-dicom-adapter
# Once the DICOM adapter pod is fully stopped and no pod is returned with the above command, the DICOM adapter can be started by running the following command:
clara dicom start
  • Verify that the DICOM Adapter is correctly started:

helm ls | grep dicom-adapter
kubectl get pods | grep dicom-adapter

5.5. Trigger Pipeline

A pipeline is triggered when a DICOM series is sent to the specific AE title of the Clara DICOM Adapter which is associated with that pipeline. To trigger this pipeline, you will need to have a set of relevant DICOM images that can be used as source input data.

For this created pipeline, a sample lung dataset in dicom format is available within the SDK in /path-to-clara-deploy-installer/test-data/nvrtk_sample_d1_dicom_raw_0.0.1.zip. It can be extracted in the test-data folder using unzip.

cd /path-to-clara-deploy-installer/test-data
unzip nvrtk_sample_d1_dicom_raw_0.0.1.zip
  • Open a terminal and go to the directory which contains all your DICOM images.

cd /path-to-clara-deploy-installer/test-data/raw_dicom_D1
  • Trigger the pipeline (push DICOM data to the proper ae title)

storescu -v +sd +r -xb -aet "DCM4CHEE" -aec "CTRecon" AA.BBB.CC.DD 104 ./

Replace “AA.BBB.CC.DD” with the IP of your local machine.

When the above step is successfully completed, you should see the following result in the terminal

I: Received Store Response (Success) <br>
I: Releasing Association

5.6. Verify the Pipeline Execution in Dashboard

  • Go to the Clara dashboard UI using a web browser: The URL is: <IP of the machine>:8000

  • You should see a job with a name that includes the name of the pipeline you created

  • You can inspect the status of each operator inside that job

5.7. Verify That the External DICOM Receiver Received Your Images

If your pipeline outputs DICOM images and sends them to an external DICOM receiver, you may want to verify that the images were indeed received. If you used the storescp utility from DCMTK as mentioned earlier, please use a terminal to navigate to the “dicom-destination-directory” and verify whether the expected images are stored there. In addition, you may want to use a third party DICOM viewer to view those images.