CT Reconstruction Pipeline
CT reconstruction pipeline is defined using the Pipeline definition language (that Clara supports). Sample reconstruction pipeline is located in clara-reference-app folder under SDK zip, Pipelines/ReconPipeline/ct-recon.yaml
. The content is shown below,
api-version: 0.3.0
name: ct-recon-example
operators:
- name: recon-operator
description: CT reconstruction algorithm on 3D cone beam projections
container:
image: clara/recon-operator
tag: latest
# Change the variables for the payload that is being used to run the pipeline
variables:
nvrtkalgo: fdk
nvrtkhardware: gpu
nvrtkhann: 0.95
nvrtkdimension: 512,512,163
nvrtkspacing: 0.75,0.75,3
nvrtkorigin: -192,-192,-244.5
nvrtkproj: 1024
nvrtkindir: in
nvrtkoutdir: out
nvrtkgeomdir: geom
nvrtklogs: logs
nvrtksubset: 16
requests:
gpu: 1
input:
- path: /app/in
output:
- name: out
path: /app/out
- name: logs
path: /app/logs
- name: geom
path: /app/geom
Sample lung dataset in mhd format is available within the SDK. If sample dataset (recon_raw_proj_mhd_0.0.1.zip) is desired, it can be extracted from test-data folder under SDK zip. If using the sample dataset, unzip it before using.
Recon pipeline definition consists of 1 operator, recon-operator
.
operators:
- name: recon-operator
description: CT reconstruction algorithm on 3D cone beam projections
container:
image: clara/recon-operator
tag: latest
# Change the variables for the payload that is being used to run the pipeline
variables:
nvrtkalgo: fdk
nvrtkhardware: gpu
nvrtkhann: 0.95
nvrtkdimension: 512,512,163
nvrtkspacing: 0.75,0.75,3
nvrtkorigin: -192,-192,-244.5
nvrtkproj: 1024
nvrtkindir: in
nvrtkoutdir: out
nvrtkgeomdir: geom
nvrtklogs: logs
nvrtksubset: 16
requests:
gpu: 1
input:
- path: /app/in
output:
- name: out
path: /app/out
- name: logs
path: /app/logs
- name: geom
path: /app/geom
recon-operator: Recon operators takes the result from the Clara pipeline payload and mounts it to /app/in folder. Recon-operator has 3 output folders. ‘out’ folder gets the actual reconstructed volume. ‘logs’ folder gets all logs from recon-operator. ‘geom’ folder contains the geometry file created by recon-operator. Recon-operator defines the reconstruction parameters under ‘variables’. All parameters are defined in detail in recon operator definition. These variables are passed by platform as environment variables to the recon-operator at runtime. Reconstruction is GPU accelerated, and the need for GPU is specified with ‘request’ under recon-operator definition.
Please refer to the section <a href="/RunningReferencePipeline.html#run-reference-pipelines-using-local-input-files" target="_self">Run Reference Pipelines using Local Input Files</a> on How to run a Reference Pipeline and the section Pipeline Definition Language for details on the pipeline definition language.
Reconstruction Operator Docker Image
Pre-build reconstruction docker image is shipped with the SDK. All parameters within the reconstruction operator (as defined above) can be used by the user. Users can run reconstruction operator using the pipeline definition files and sample datasets. These are described below.
Before executing the reconstruction pipeline, ensure that all environment variables are correctly set and appropriate data folders are mounted. This can be done in the “variables” section of recon-operator within the pipeline definition file.
Get the data: Have projection data ready for execution. If sample dataset (recon_raw_proj_mhd_0.0.1.zip) is desired, it can be extracted from test-data folder under SDK zip. If using the sample dataset, unzip it before using.
Reconstruction pipeline definition is mandatory to start the process of running reconstruction on Clara platform. These pipelines are present in SDK zip under clara-reference-app
folder.
Execution Steps on Clara Platform
The following are the execution steps for the CT Reconstruction Pipeline:
Locate the projection data <full path of clara folder></full>/test-data/recon_raw_proj_mhd_0.0.1.zip. Unzip the file to a folder which creates a subfolder named ‘projections’.
# cd <full path of clara installation folder> unzip test-data/recon_raw_proj_mhd_0.0.1.zip -d test-data/
Create a pipeline.
# cd <full path of clara installation folder> clara create pipelines -p clara-reference-app/Pipelines/ReconPipeline/ct-recon.yaml
Verify the pipeline ID creation. Type the following command on the shell.
kubectl get pl
Pipeline with ID created in step 3 is visible in the kubectl pipelines listed.
Trigger the pipeline (push an input png file to Clara API Server) with the pipeline ID in the previous section.
clara create jobs -n ct-recon -p <pipeline ID> -f test-data/projections/
When the above step is successfully completed, you should see the following result in the terminal (UUID of Job and Payload may be different).
JOB ID:f3170b45-7f5c-4187-9951-e6da8f37341e PAYLOAD ID:12bb398c-b548-44d5-958d-51e66e10713a
NoteNote down this job ID and payload ID as they would be used in the later section to access output files.
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 job you specified (
ct-recon
)You can inspect the status of each operator inside that job
Download and Verify the Outputs
Once the job is succeed, we can download output payload by using <a href="/sdk/cli/public/docs/clara-cmds.html#download" target="_self">clara download</a> command.
Output payload files are located under /operators/<operator name defined in the pipeline definition>/ folder.
Since we triggered CT Recon Pipeline whose operator’s name is recon-operator
, we can use the following command to download output files:
mkdir result
cd result
clara download <Job ID>:/operators/recon-operator/*
Then, you can see the output MHD file at result/out
folder.
If you are working with the server machine, the payload folder is directly accessible at the default payload folder /clara/payloads/<Payload ID>/
.
Pipeline ct-recon-perf.yaml is added. It runs iterative FDK reconstruction and uses 1024 projections (resulting in an input payload of 1.1 GB). With a realistic input payload, this pipeline can be used to analyze performance metrics. Number of iterations for the algorithm are set at 20, it can be increased to analyze a more realistic execution scenario.
This pipeline performs the reconstruction on projections in MHD format, followed by liver ct segmentation. This pipeline takes MHD data as input.