Skip to main content
PyPI version https://travis-ci.org/theHamsta/pyronn-torch.svg?branch=master

pyronn-torch

This repository provides PyTorch bindings for PYRO-NN, a collection of back-propagatable projectors for CT reconstruction.

Feel free to cite our publication:

@article{PYRONN2019,
author = {Syben, Christopher and Michen, Markus and Stimpel, Bernhard and Seitz, Stephan and Ploner, Stefan and Maier, Andreas K.},
title = {Technical Note: PYRO-NN: Python reconstruction operators in neural networks},
year = {2019},
journal = {Medical Physics},
}

Installation

From PyPI:

pip install pyronn-torch

From this repository:

git clone --recurse-submodules --recursive https://github.com/theHamsta/pyronn-torch.git
cd pyronn-torch
pip install torch
pip install -e .

You can build a binary wheel using

python setup.py bdist_wheel

Important

If you’re using an older CUDA version you might get an error about '-allow-unsupported-compiler' not being a valid compiler option. In that case remove that compiler option from this project’s setup.py.

Usage

import pyronn_torch
import numpy as np

projector = pyronn_torch.ConeBeamProjector(
    (128, 128, 128),  # volume shape
    (2.0, 2.0, 2.0),  # volume spacing in mm
    (-127.5, -127.5, -127.5),  # volume origin in mm
    (2, 480, 620),  # projection_shape (n, width, height)
    [1.0, 1.0],  # projection_spacing in mm
    (0, 0),  # projection_origin
    np.array([[[-3.10e+2, -1.20e+03,  0.00e+00,  1.86e+5],
               [-2.40e+2,  0.00e+00,  1.20e+03,  1.44e+5],
               [-1.00e+00,  0.00e+00,  0.00e+00,  6.00e+2]],
              [[-2.89009888e+2, -1.20522754e+3, -1.02473585e-13,
                1.86000000e+5],
               [-2.39963440e+2, -4.18857765e+0,  1.20000000e+3,
                1.44000000e+5],
               [-9.99847710e-01, -1.74524058e-2,  0.00000000e+0,
                6.00000000e+2]]])  # two projection matrices in shape (n, 3, 4)
                # optionally: source_isocenter_distance=1, source_detector_distance=1 for a scalar weighting the projections
)
projection = projector.new_projection_tensor(requires_grad=True)

projection = projection + 1.
result = projector.project_backward(projection, use_texture=True)

assert projection.requires_grad
assert result.requires_grad

loss = result.mean()
loss.backward()

Or easier with PyCONRAD (pip install pyconrad)

projector = pyronn_torch.ConeBeamProjector.from_conrad_config()

The configuration can then be done using CONRAD (startable using conrad from command line)

Metadata

Release files for pyronn-torch 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyronn-torch 0.2.3
File Size Uploaded
pyronn-torch-0.2.3.tar.gz 42.9 kB Details

Release files / pyronn-torch-0.2.3.tar.gz

Download URL pyronn-torch-0.2.3.tar.gz
Size 42.9 kB
Tags Source
SHA-256 checksum
How to use checksums
aab785ce1a15da69bc3de3fc88b345f27e85939956b6b7757b92c8628118ffdd
BLAKE2b-256 checksum
How to use checksums
0b4f4df1bc8f715fa1acd53214f808b53ae2aa91f201222d48fa64946fc107b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.2.3 This release

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

5 release files

0.0.9

5 release files

0.0.8

5 release files

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page