9.17. CT Recon Operator
The CT reconstruction operator within the Clara Deploy SDK uses the reconstruction toolkit RTK. RTK is open-source and cross-platform software based on the Insight Toolkit (ITK). RTK performs fast circular cone-beam CT reconstruction.
CT reconstruction design in Clara uses pre-compiled binaries and applications from RTK and ITK, and a wrapper is provided with several options to the user. Reconstruction pipeline definition is used to specify the reconstruction parameters, and I/O details to the Clara Deploy SDK. The Clara Deploy SDK spins up the reconstruction container as specified in the pipeline and executes it with parameters and data. Output from the reconstruction operator is generated in the mounted folder. A brief schema is demonstrated in the figure below.
![reconoper.png](https://docscontent.nvidia.com/dims4/default/0dac656/2147483647/strip/true/crop/767x337+0+0/resize/767x337!/quality/90/?url=https%3A%2F%2Fk3-prod-nvidia-docs.s3.us-west-2.amazonaws.com%2Fbrightspot%2Fsphinx%2F00000186-1062-d3ba-abf6-31e266690000%2Fclara-holoscan%2Farchive%2Fclara-deploy-0.7.4%2F_images%2Freconoper.png)
The Reconstruction Operator runs on raw CT projections from a cone-beam geometry. A geometry file is created by the reconstruction container and is fed into the reconstruction algorithm. One of the projections from a sequence of projections (in the sample dataset) is shown in the figure below.
![projections.jpg](https://docscontent.nvidia.com/dims4/default/82a9aa7/2147483647/strip/true/crop/256x256+0+0/resize/256x256!/quality/90/?url=https%3A%2F%2Fk3-prod-nvidia-docs.s3.us-west-2.amazonaws.com%2Fbrightspot%2Fsphinx%2F00000186-1062-d3ba-abf6-31e266690000%2Fclara-holoscan%2Farchive%2Fclara-deploy-0.7.4%2F_images%2Fprojections.jpg)
Projections are fed into reconstruction algorithm as a MHD volume. Dicom format of dataset (recon_raw_proj_mhd_0.0.1.zip) is available in SDK zip folder under test-data folder.
The pipeline outputs a reconstructed volme in MHD format. A slice from the reconstructed volume (on the sample dataset) is shown in the figure below.
![fdkRamp.jpg](https://docscontent.nvidia.com/dims4/default/26e41e5/2147483647/strip/true/crop/256x256+0+0/resize/256x256!/quality/90/?url=https%3A%2F%2Fk3-prod-nvidia-docs.s3.us-west-2.amazonaws.com%2Fbrightspot%2Fsphinx%2F00000186-1062-d3ba-abf6-31e266690000%2Fclara-holoscan%2Farchive%2Fclara-deploy-0.7.4%2F_images%2FfdkRamp.jpg)
The following reconstruction parameters are supported:
Number of projections: Number of projections for creation of cone beam geometry. This is created internally by reconstruction container and is used in reconstruction process. Range [1,1024]
Recon Algorithms: Clara R3 supports two reconstruction algorithms. FDK (Feldkemp, David and Kress) and Iterative FDK.
Input projections: Input projection data in MHD format. User must provide the projection volume (coming from a cone beam geometry) and in sync with the number of projection parameters provided.
Spacing of reconstructed volume: (X,Y,Z) spacing information of the volume to be reconstructed.
Origin of reconstructed volume:/ (X,Y,Z) origin information of the volume to be reconstructed.
Dimensions of reconstructed volume:/ (X,Y,Z) dimension information of the volume to be reconstructed.
Use GPU: Hardware to perform the reconstruction. Options are CPU or GPU.
Number of iterations: Applicable only for Iterative FDK.
Pre processing filter parameters: If the user wants to process the input projections before starting the reconstruction, Hanning filter is supported in Clara R3. Filter smoothing parameters can be specified from a value between 0 and 1.
The algorithms depend on the ITK libraries. All required libraries are pre-built and part of the Docker container.
This sample includes the following folders and files:
wrapper/
nvrtk.py A script that interfaces with the RTK and ITK applications. The script is the entry point to the Docker container. It extracts parameters via environment variables and invokes required applications for processing. Parameters can be specified by the user in the pipeline definition file, they are then processed by the Clara Deploy SDK and are made available to the reconstruction container via environment variables.
Supported parameters as environment variables are defined in Dockerfile definition below.
Dockerfile
This script creates the Docker image.
All required RTK applications and ITK libraries are pulled from the artifactory and linked appropriately during image creation.
Default environment variables are specified in the Docker image creation. Environment variables can be updated during run time, either locally or within the Clara Platform. The following environment variables are supported:
ENV nvrtkindir data # Directory location of input projections in MHD format ENV nvrtkoutdir data # Directory for output reconstructed files ENV nvrtkgeomdir data # Directory for geometry files ENV nvrtkinfile projections.mhd # Input MHD file name ENV nvrtkoutfile recon.mhd # Reconstructed output file name in MHD ENV nvrtkgeomfile geometry.xml # Geometry file name in XML ENV nvrtkalgo FDK # Specify reconstruction algorithm ENV nvrtkspacing 1.0,1.0,1.0 # Reconstructed Volume Spacing (x,y,z) ENV nvrtkdimension 512,512,100 # Dimension of reconstructed volume (x,y,z) ENV nvrtkorigin 0.0,0.0,0.0 # Origin of reconstructed volume (x,y,z) ENV nvrtkhann 0.0 # Frequency of hann window [0,1] ENV nvrtkhardware gpu # GPU or CPU for reconstruction ENV nvrtkniter 3 # number of iterations ENV nvrtkproj 180 # number of input projections ENV nvrtklogs data # Directory for recon logs
Recon operator has been optimized resulting in approximately 30% reduction in execution time. Following changes are made:
Forward Projection kernel optimization
Cuda Streams to execute and trasfer data per batch in forward projector
Optimal memory allocation per iteration in forward projector
Asynchronous memory transfers to/from host to device