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.8.tar.gz (39.7 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.8-py2.py3-none-any.whl (24.0 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: diffct-1.2.8.tar.gz
  • Upload date:
  • Size: 39.7 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.8.tar.gz
Algorithm Hash digest
SHA256 5a6d5e80a3aba681a70b7f285430c9457b09595b3235da77b9142266a2b62d41
MD5 68bbc575a4f2b68bee4f982c5e4d09df
BLAKE2b-256 e315efbdcf97f6a0339fdd049fc68558fbbc25714fcce21fdc150369d3c87e98

See more details on using hashes here.

File details

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

File metadata

  • Download URL: diffct-1.2.8-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.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 18fbb3f3ed38a895a7cb2960e3903dc77a144b5618101710b3799c0940f0eaed
MD5 662fe193cafac2e1eec8c8f1a9830465
BLAKE2b-256 3694605f43917c28772672331763c6e7aaa842f5a5b8f39b0e4b32f74ab0707c

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