Metadata-Version: 2.4
Name: difftomo
Version: 0.1.0
Summary: Differentiable library for tomography
License-Expression: Apache-2.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: gdown
Requires-Dist: torch
Requires-Dist: torchvision
Dynamic: license-file

# DiffTomo

A PyTorch library for **differentiable tomographic and medical image reconstruction**, bringing together classical and deep learning methods in one place.

DiffTomo is designed to cover multiple imaging modalities, including CT, MRI and PET, with differentiable forward and backward operators that can sit directly inside neural network pipelines. At the moment the library contains CT functions only. MRI and PET reconstruction are planned.

## Features

### Currently available (CT)

- **Differentiable projectors** implemented as CUDA kernels with autograd support
  - Parallel-beam: forward projection, backprojection and filtered backprojection (FBP)
  - Fan-beam: forward projection, backprojection and filtered backprojection (FBP)
- **FBP filters:** `ram-lak`, `shepp-logan`, `cosine`, `hamming`, `hann`
- **Iterative reconstruction:** ART, SART, SIRT, CGLS, TV regularization, TGV regularization, DRP
- **Data:** Shepp-Logan phantom and sample datasets (carved cheese, walnut)
- **Pretrained models:** loading support for a small set of models

### Planned

- MRI reconstruction
- PET reconstruction
- More classical and deep learning methods across modalities

## Requirements

- Python 3.10+
- PyTorch with CUDA support
- An NVIDIA GPU and a CUDA toolkit (`nvcc`) matching your PyTorch build
- `ninja` (the CUDA extension is compiled just in time)

## Documentation

For guidelines and how to use the library, see the [docs](docs/).

## Installation

```bash
git clone https://github.com/yourusername/difftomo.git
cd difftomo
pip install -e .
```

## Repository layout

```
difftomo/         # library source
  CT/             # projectors and iterative methods
  data/           # phantoms and datasets
docs/             # documentation and examples
test/             # tests
```

## Next features coming up

- [ ] Helsinki CT dataset and more pretrained models
- [ ] A learned, transformer attention-based iterative filter that replaces the fixed FBP filter, to study how the filter affects reconstruction quality
- [ ] MRI reconstruction functions
- [ ] PET reconstruction functions
