https://github.com/matteo-ronchetti/torch-radon
Computational Tomography in PyTorch
https://github.com/matteo-ronchetti/torch-radon
cuda hacktoberfest inverse-problems pytorch radon-transform shearlet-transform tomography
Last synced: 14 days ago
JSON representation
Computational Tomography in PyTorch
- Host: GitHub
- URL: https://github.com/matteo-ronchetti/torch-radon
- Owner: matteo-ronchetti
- License: gpl-3.0
- Created: 2019-11-06T15:27:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-09-22T15:00:21.000Z (over 1 year ago)
- Last Synced: 2025-04-15T01:19:35.112Z (14 days ago)
- Topics: cuda, hacktoberfest, inverse-problems, pytorch, radon-transform, shearlet-transform, tomography
- Language: Python
- Homepage: https://torch-radon.readthedocs.io
- Size: 16 MB
- Stars: 235
- Watchers: 5
- Forks: 49
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](http://torch-radon.readthedocs.io/?badge=latest)

[](https://colab.research.google.com/drive/10GdKHk_6346aR4jl5VjPPAod1gTEsza9)
# TorchRadon: Fast Differentiable Routines for Computed TomographyTorchRadon is a PyTorch extension written in CUDA that implements differentiable routines
for solving computed tomography (CT) reconstruction problems.The library is designed to help researchers working on CT problems to combine deep learning
and model-based approaches.Main features:
- Forward projections, back projections and shearlet transforms are **differentiable** and
integrated with PyTorch `.backward()`.
- Up to 125x **faster** than Astra Toolbox.
- **Batch operations**: fully exploit the power of modern GPUs by processing multiple images
in parallel.
- **Transparent API**: all operations are seamlessly integrated with PyTorch,
gradients can be computed using `.backward()`, half precision can be used with Nvidia AMP.
- **Half precision**: storing data in half precision allows to get sensible speedups
when doing Radon forward and backward projections with a very small accuracy loss.
Implemented operations:
- Parallel Beam projections
- Fan Beam projections
- Shearlet transform
## Installation
Currently only Linux is supported, if you are running a different OS please use Google Colab or the Docker image.
### Precompiled packages
If you are running Linux you can install Torch Radon by running:
```shell script
wget -qO- https://raw.githubusercontent.com/matteo-ronchetti/torch-radon/master/auto_install.py | python -
```### Google Colab
You can try the library from your browser using Google Colab, you can find an example
notebook [here](https://colab.research.google.com/drive/10GdKHk_6346aR4jl5VjPPAod1gTEsza9?usp=sharing).### Docker Image
Docker images with PyTorch CUDA and Torch Radon are available [here](https://hub.docker.com/repository/docker/matteoronchetti/torch-radon).
```shell script
docker pull matteoronchetti/torch-radon
```
To use the GPU in docker you need to use [nvidia-docker](https://github.com/NVIDIA/nvidia-docker)### Build from source
You need to have [CUDA](https://developer.nvidia.com/cuda-toolkit) and [PyTorch](https://pytorch.org/get-started/locally/) installed, then run:
```shell script
git clone https://github.com/matteo-ronchetti/torch-radon.git
cd torch-radon
python setup.py install
```
If you encounter any problem please contact the author or open an issue.## Benchmarks
The library is noticeably faster than the Astra Toolbox, especially when data is already on the GPU. Main disadvantage of Astra is that it only takes inputs which are on the CPU, this makes training end-to-end neural networks very inefficient.
The following benchmark compares the speed of Astra Toolbox and Torch Radon:
If we set `clip_to_circle=True` (consider only the part of the image that is inside the circle) the speed difference is even larger:
These results hold also on a cheap laptop GPU:
## Cite
If you are using TorchRadon in your research, please cite the following paper:
```
@article{torch_radon,
Author = {Matteo Ronchetti},
Title = {TorchRadon: Fast Differentiable Routines for Computed Tomography},
Year = {2020},
Eprint = {arXiv:2009.14788},
journal={arXiv preprint arXiv:2009.14788},
}
```## Testing
Install testing dependencies with `pip install -r test_requirements.txt`
then test with:
```shell script
nosetests tests/
```