10.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.
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 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.
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:
- 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.
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