Git Product home page Git Product logo

gratopy's Introduction

Gratopy

DOI Documentation Status Gratopy Tests

The gratopy (Graz accelerated tomographic projections for Python) toolbox is a Python3 software package for the efficient and high-quality computation of Radon transforms, fanbeam transforms as well as the associated backprojections. The included operators are based on pixel-driven projection methods which were shown to possess favorable approximation properties. The toolbox offers a powerful parallel OpenCL/GPU implementation which admits high execution speed and allows for seamless integration into PyOpenCL. Gratopy can efficiently be combined with other PyOpenCL code and is well-suited for the development of iterative tomographic reconstruction approaches, in particular, for those involving optimization algorithms.

Highlights

  • Easy-to-use tomographic projection toolbox.
  • High-quality 2D projection operators.
  • Fast projection due to custom OpenCL/GPU implementation.
  • Seamless integration into PyOpenCL.
  • Basic iterative reconstruction schemes included (Landweber, CG, total variation).
  • Comprehensive documentation, tests and example code.

The fanbeam projection of a walnut and gratopy’s Landweber and total variation reconstructions (from left to right).

Installation

The toolbox can easily be installed using pip:

pip install gratopy

Alternatively, a release or snapshot archive file can directly be downloaded and unpacked. Calling

pip install .

inside the main folder then installs the toolbox. Gratopy supports setuptools for installation such that

python setup.py install

has the same effect. For more details we refer to the documentation.

As a further alternative, if no dedicated installation is needed for the toolbox, the code can simply be downloaded and the contents of the gratopy directory can be imported as a module. Please make sure to have the following Python modules installed, most of which should be standard.

Requirements

Note that in particular, correctly installing and configuring PyOpenCL might take some time, as dependent on the used platform/GPU, suitable drivers must be installed. We refer to PyOpenCL's documentation.

Getting started

We refer to the extensive documentation, in particular to the getting started guide, as well as to the test files for the Radon transform and fanbeam transform. The following rudimentary example is also included in the documentation.

# initial import
import numpy as np
import pyopencl as cl
import matplotlib.pyplot as plt

import gratopy

# discretization parameters
number_angles = 60
number_detectors = 300
Nx = 300
# Alternatively to number_angles one could give as angle input
# angles = np.linspace(0, np.pi, number_angles+1)[:-1]

# create pyopencl context
ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx)

# create phantom as test image (a pyopencl.array.Array of dimensions (Nx, Nx))
phantom = gratopy.phantom(queue,Nx)

# create suitable projectionsettings
PS = gratopy.ProjectionSettings(queue, gratopy.RADON, phantom.shape,
                                number_angles, number_detectors)

# compute forward projection and backprojection of created sinogram
# results are pyopencl arrays
sino = gratopy.forwardprojection(phantom, PS)
backproj = gratopy.backprojection(sino, PS)

# plot results
plt.figure()
plt.title("Generated Phantom")
plt.imshow(phantom.get(), cmap="gray")

plt.figure()
plt.title("Sinogram")
plt.imshow(sino.get(), cmap="gray")

plt.figure()
plt.title("Backprojection")
plt.imshow(backproj.get(), cmap="gray")
plt.show()

Authors

All authors are affiliated with the Institute of Mathematics and Scientific Computing at the University of Graz.

Publications

If you find this tool useful, please cite the following associated publication.

Acknowledgements

The development of this software was supported by the following projects:

  • Regularization Graphs for Variational Imaging, funded by the Austrian Science Fund (FWF), grant P-29192,

  • International Research Training Group IGDK 1754 Optimization and Numerical Analysis for Partial Differential Equations with Nonsmooth Structures, funded by the German Research Council (DFG) and the Austrian Science Fund (FWF), grant W-1244.

The walnut data set included in this toolbox is licensed under CC BY 4.0 and available on Zenodo:

  • Keijo Hämäläinen, Lauri Harhanen, Aki Kallonen, Antti Kujanpää, Esa Niemi and Samuli Siltanen. (2015). Tomographic X-ray data of a walnut (Version 1.0.0) [Data set]. Zenodo. https://doi.org/10.5281/zenodo.1254206

The phantom creation code is based on Phantominator, copyright by its contributors and licensed under GPLv3. See https://github.com/mckib2/phantominator.

License

This project is licensed under the GPLv3 license - see LICENSE for details.

gratopy's People

Contributors

behackl avatar kbredies avatar richardhuber92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gratopy's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.