Helper class: the ASTRAProjector module

class astra.ASTRAProjector.ASTRAProjector2D(proj_geom, vol_geom, proj_type, useCUDA=False)[source]

Bases: object

Helps with various common ASTRA Toolbox 2D operations.

This class can perform several often used toolbox operations, such as:

  • Forward projecting
  • Back projecting
  • Reconstructing

Note that this class has a some computational overhead, because it copies a lot of data. If you use many repeated operations, directly using the PyAstraToolbox methods directly is faster.

You can use this class as an abstracted weight matrix \(W\): multiplying an instance proj of this class by an image results in a forward projection of the image, and multiplying proj.T by a sinogram results in a backprojection of the sinogram:

proj = ASTRAProjector2D(...)
fp = proj*image
bp = proj.T*sinogram
Parameters:
  • proj_geom (dict) – The projection geometry.
  • vol_geom (dict) – The volume geometry.
  • proj_type (string) – Projector type, such as 'line', 'linear', ...
  • useCUDA (bool) – If True, use CUDA for calculations, when possible.
backProject(data)[source]

Backproject a sinogram.

Parameters:data (numpy.ndarray or int) – The sinogram data or ID.
Returns:numpy.ndarray – The backprojection.
forwardProject(data)[source]

Forward project an image.

Parameters:data (numpy.ndarray or int) – The image data or ID.
Returns:numpy.ndarray – The forward projection.
reconstruct(data, method, **kwargs)[source]

Reconstruct an image from a sinogram.

Parameters:
Returns:

numpy.ndarray – The reconstruction.

Example of a SIRT reconstruction using CUDA:

proj = ASTRAProjector2D(...)
rec = proj.reconstruct(sinogram,'SIRT_CUDA',iterations=1000)
class astra.ASTRAProjector.ASTRAProjector2DTranspose(parentProj)[source]

Implements the proj.T functionality.

Do not use directly, since it can be accessed as member .T of an ASTRAProjector2D object.

Previous topic

Additional functions: the functions module

Next topic

MATLAB compatibility interface: the matlab module

This Page