Skip to content

sypsyp97/diffct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

diffct: Differentiable Computed Tomography Operators

License DOI PyPI version Documentation CI/CD Ask DeepWiki

A high-performance, CUDA-accelerated library for circular orbits CT reconstruction with end-to-end differentiable operators, enabling advanced optimization and deep learning integration.

⭐ Please star this project if you find it is useful!

πŸ”€ Branches

Main Branch (Stable)

This is the stable version supporting circular trajectory CT reconstruction.

Dev Branch (Under Development)

The dev branch includes experimental features:

  • Random trajectory projection and backprojection operators
  • New examples with non-circular trajectories

⚠️ Note: The dev branch is under active development. If you find any bugs, please raise an issue.

✨ Features

  • Fast: CUDA-accelerated projection and backprojection operations
  • Differentiable: End-to-end gradient propagation for deep learning workflows

πŸ“ Supported Geometries

  • Parallel Beam: 2D parallel-beam geometry
  • Fan Beam: 2D fan-beam geometry
  • Cone Beam: 3D cone-beam geometry

🧩 Code Structure

diffct/
β”œβ”€β”€ diffct/
β”‚   β”œβ”€β”€ __init__.py            # Package initialization
β”‚   β”œβ”€β”€ differentiable.py      # Differentiable CT operators
β”œβ”€β”€ examples/                  # Example usages
β”‚   β”œβ”€β”€ fbp_parallel.py
β”‚   β”œβ”€β”€ fbp_fan.py
β”‚   β”œβ”€β”€ fdk_cone.py
β”‚   β”œβ”€β”€ iterative_reco_cone.py
β”‚   β”œβ”€β”€ iterative_reco_fan.py
β”‚   β”œβ”€β”€ iterative_reco_parallel.py
β”œβ”€β”€ pyproject.toml             # Project metadata
β”œβ”€β”€ README.md                  # README
β”œβ”€β”€ LICENSE                    # License
β”œβ”€β”€ requirements.txt           # Dependencies

πŸš€ Quick Start

Prerequisites

Installation

CUDA 12 (Recommended):

# Create and activate conda environment
conda create -n diffct python=3.12
conda activate diffct

# Install CUDA (here 12.8.1 as example) PyTorch, and Numba
conda install nvidia/label/cuda-12.8.1::cuda-toolkit

# Install Pytorch, you can find the commend here: https://pytorch.org/get-started/locally/

# Install Numba with CUDA 12
pip install numba-cuda[cu12]

# Install diffct
pip install diffct
CUDA 13 Installation
# Create and activate conda environment
conda create -n diffct python=3.12
conda activate diffct

# Install CUDA (here 13.0.2 as example) PyTorch, and Numba
conda install nvidia/label/cuda-13.0.2::cuda-toolkit

# Install Pytorch, you can find the commend here: https://pytorch.org/get-started/locally/

# Install Numba with CUDA 13
pip install numba-cuda[cu13]

# Install diffct
pip install diffct
CUDA 11 Installation
# Create and activate conda environment
conda create -n diffct python=3.12
conda activate diffct

# Install CUDA (here 11.8.0 as example) PyTorch, and Numba
conda install nvidia/label/cuda-11.8.0::cuda-toolkit

# Install Pytorch, you can find the commend here: https://pytorch.org/get-started/locally/

# Install Numba with CUDA 11
pip install numba-cuda[cu11]

# Install diffct
pip install diffct

πŸ“ Citation

If you use this library in your research, please cite:

@software{diffct2025,
  author       = {Yipeng Sun},
  title        = {diffct: Differentiable Computed Tomography
                 Reconstruction with CUDA},
  year         = 2025,
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.14999333},
  url          = {https://doi.org/10.5281/zenodo.14999333}
}

πŸ“„ License

This project is licensed under the Apache 2.0 - see the LICENSE file for details.

πŸ™ Acknowledgements

This project was highly inspired by:

Issues and contributions are welcome!

About

An CUDA-based library for computed tomography (CT) reconstruction with differentiable operators.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages