Skip to main content

PyTorch bindings for PYRO-NN (https://github.com/csyben/PYRO-NN)

Project description

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-rotatable 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

Usage

import pyronn_torch

#ConeBeamProjector(volume_shape,
#                  volume_spacing,
#                  volume_origin,
#                  projection_shape,
#                  projection_spacing,
#                  projection_origin,
#                  projection_matrices)
projector = pyronn_torch.ConeBeamProjector(
    (128, 128, 128),
    (2.0, 2.0, 2.0),
    (-127.5, -127.5, -127.5),
    (2, 480, 620),
    [1.0, 1.0],
    (0, 0),
    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
)
projection = projector.new_projection_tensor(requires_grad=True)

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)

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

pyronn-torch-0.0.5.tar.gz (30.6 kB view details)

Uploaded Source

File details

Details for the file pyronn-torch-0.0.5.tar.gz.

File metadata

  • Download URL: pyronn-torch-0.0.5.tar.gz
  • Upload date:
  • Size: 30.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.1.0 requests-toolbelt/0.8.0 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for pyronn-torch-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ad0fbebe6788b66dd7d8a91af082e3845f111486dc156e9c000efff582737a87
MD5 33668aaf33e0e429b4eaa7c3eeb288af
BLAKE2b-256 40b37b31955fcd33f4e3c6a1694562bbdf90cfeba85e4d12c439aa28acc29b0a

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