OpTomo class: the optomo module¶

class astra.optomo.OpTomo(proj_id)[source]

Bases: scipy.sparse.linalg.interface.LinearOperator

Object that imitates a projection matrix with a given projector.

This object can do forward projection by using the * operator:

W = astra.OpTomo(proj_id)
fp = W*image
bp = W.T*sinogram


It can also be used in minimization methods of the scipy.sparse.linalg module:

W = astra.OpTomo(proj_id)
output = scipy.sparse.linalg.lsqr(W,sinogram)

Parameters: proj_id (int) – ID to a projector.
BP(s, out=None)[source]

Perform backprojection.

Output must have the right 2D/3D shape. Input may also be flattened.

Output must also be contiguous and float32. This isn’t required for the input, but it is more efficient if it is.

:param : The projection data. :type s: numpy.ndarray :param out: Array to store result in. :type out: numpy.ndarray

FP(v, out=None)[source]

Perform forward projection.

Output must have the right 2D/3D shape. Input may also be flattened.

Output must also be contiguous and float32. This isn’t required for the input, but it is more efficient if it is.

Parameters: v (numpy.ndarray) – Volume to forward project. out (numpy.ndarray) – Array to store result in.
reconstruct(method, s, iterations=1, extraOptions=None)[source]

Reconstruct an object.

Parameters: method (string) – Method to use for reconstruction. s (numpy.ndarray) – The projection data. iterations (int) – Number of iterations to use. extraOptions (dict) – Extra options to use during reconstruction (i.e. for cfg[‘option’]).
rmatvec(s)[source]

Implements the transpose operator.

Parameters: s (numpy.ndarray) – The projection data.
class astra.optomo.OpTomoTranspose(parent)[source]

Bases: scipy.sparse.linalg.interface.LinearOperator

This object provides the transpose operation (.T) of the OpTomo object.

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

rmatvec(v)[source]