Skip to content

mathworks/CT-Reconstruction-in-MATLAB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MRI Volume

CBCT Reconstruction in MATLAB

Open in MATLAB Online

Overview

Welcome to the CBCT Reconstruction in MATLAB® repository. This project demonstrates three complementary cone‑beam CT (CBCT) reconstruction approaches implemented in MATLAB:

  • FDK (Filtered Backprojection) with automatic GPU utilization
  • Hybrid Iterative Refinement (HIR) for improved data consistency
  • Deep Learning (2D U‑Net) for slice‑wise enhancement

The workflows are GPU‑aware for fast prototyping and are structured to integrate with CI/CD pipelines for automated validation. The code organization supports both research exploration and production‑oriented deployment. Furthermore, the examples can be expanded to support certification for IEC 62304 standard.


Reconstruction Methods

FDK‑Based Reconstruction

This implementation provides a classical cone‑beam FDK pipeline with robust input handling. Projection stacks are automatically interpreted whether provided as [nu nv nViews] or [nViews nv nu]. The pipeline dynamically selects GPU or CPU execution and supports batching to fit available memory.

Hybrid Iterative Refinement (HIR)

The IR approach starts from an FDK reconstruction and iteratively reduces the forward‑projection residual. A backprojected gradient is combined with a light regularization term, such as Gaussian smoothing or Tikhonov‑like priors. Parameters such as step size, iteration count, and batching can be tuned to balance convergence, stability, and runtime.

Deep Learning‑Based Enhancement (2D U‑Net)

A slice‑wise 2D U‑Net is used to enhance FDK reconstructions toward a target quality (e.g., IR or ground truth). The workflow includes data preparation, training/validation splitting, TIFF export, and inference with tiled prediction and blending. Quantitative metrics such as PSNR and SSIM are supported for evaluation.


Highlights

Rapid Prototyping and Deployment

The implementation automatically detects CUDA‑capable GPUs and adapts execution accordingly. Key parameters such as batching depth and padding factors allow the workflows to scale across different hardware configurations. Function interfaces are intentionally minimal, enabling easy integration into custom pipelines.

Automated Testing and Verification

The repository is designed to be CI/CD‑ready. A lightweight pipeline can be configured to run GPU smoke tests using small datasets, ensuring reproducibility and stability across updates. Deterministic seeds, structured outputs, and logging recommendations support consistent experimentation.


Getting Started

Prerequisites

The examples require MATLAB R2026a or newer along with the following products:

Optional (for IEC 62304 workflows)


Installation

  1. Clone the repository:
git clone https://github.com/mathworks/CT-Reconstruction-in-MATLAB-.git
  1. Navigate to the project directory: cd CT-Reconstruction-in-MATLAB

  2. Open MATLAB and add the project directory to the path: addpath(genpath('CT_Project'))

Usage

Navigate to the CT_Project folder. This folder contains all reconstruction workflows, utilities, and supporting scripts.

Run CBCT Reconstruction Examples

Open the folder 01_Example_Scripts.

This folder contains core reconstruction implementations:

  • reconFDK.m — FDK-based CBCT reconstruction
  • reconIR.m — Hybrid Iterative Refinement
  • reconDL.m — Deep learning-based enhancement

Run the startup.m file

This step initializes the environment, sets up paths, and prepares dependencies.

GPU Execution and Code Generation

Open the folder 02_Cuda_Codegen_Scripts.

This folder provides GPU Coder-ready scripts:

  • reconFDK_codegen.m
  • reconIR_codegen.m
  • reconDL_codegen.m

These scripts enable CUDA code generation and optimized GPU execution.

End-to-End Demo

Run either:

  • demoScript.m
  • demoScript.mlx

These scripts provide:

  • End-to-end FDK, IR, and DL reconstruction workflows
  • CPU and GPU execution options
  • Performance benchmarking and visualization

Output

  • Reconstructed volumes, intermediate outputs, and evaluation metrics are generated during execution.
  • Outputs are organized in structured directories for easy comparison and validation.

Reference

Wu, M., FitzGerald, P., Zhang, J., Segars, W.P., Yu, H., Xu, Y., and De Man, B., 2022.
XCIST—an open access x-ray/CT simulation toolkit.
Physics in Medicine & Biology, 67(19), p.194002.


License

The license is available in the license.txt file in this repository.

© 2026 The MathWorks, Inc.

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages