Skip to main content

A CUDA-based library for computed tomography (CT) projection and reconstruction with differentiable operators

Project description

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diffct-1.2.9.tar.gz (39.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diffct-1.2.9-py2.py3-none-any.whl (24.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file diffct-1.2.9.tar.gz.

File metadata

  • Download URL: diffct-1.2.9.tar.gz
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for diffct-1.2.9.tar.gz
Algorithm Hash digest
SHA256 298a9af712e1e993a4924edef9a6dfcc6a74a49bacc13fd6e22a8ffe546109ca
MD5 02104c0e53cc035c1acd4fb61f788a80
BLAKE2b-256 b4f7213f822673f85f66bd4e79eb0e4b8c74666fb44c9913a451ea8b67f22dc1

See more details on using hashes here.

File details

Details for the file diffct-1.2.9-py2.py3-none-any.whl.

File metadata

  • Download URL: diffct-1.2.9-py2.py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for diffct-1.2.9-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7e2ab014d3af60e8bae6d013aa79c1d9f46dd9fe0135656a10a2973f5b3f1eee
MD5 37f31c285d29d851771ce5e65b672988
BLAKE2b-256 067f5ed4017003a11cda606f3479a8233b86745e7ea960488fc455f07ba76ad6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page