OpTomo class: the optomo module
- class astra.optomo.OpTomo(*args, **kwargs)[source]
Bases:
LinearOperatorObject 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.linalgmodule: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’]).
- class astra.optomo.OpTomoTranspose(*args, **kwargs)[source]
Bases:
LinearOperatorThis object provides the transpose operation (
.T) of the OpTomo object.Do not use directly, since it can be accessed as member
.Tof anOpTomoobject.- rmatvec(v)[source]
Adjoint matrix-vector multiplication.
Applies
A^Hto x, whereAis anMxNlinear operator (or batch of linear operators) and x is a row vector (or batch of such vectors).Parameters
- x{matrix, ndarray}
An array with shape
(..., M)representing a row vector (or batch of row vectors), or an array with shape(M, 1)representing a column vector.Added in version 1.18.0: A
FutureWarningis now emitted for column vector input of shape(M, 1), for which an array with shape(N, 1)is returned. rmatmat can be called instead for identical behaviour on such input.
Returns
- y{matrix, ndarray}
An array with shape
(..., N).
Notes
This method wraps the user-specified
rmatvecroutine or overridden_rmatvecmethod to ensure that y has the correct shape and type.