vamtoolbox.projector.algebraicPropagation#
Module Contents#
Classes#
CPU implementation of algebraic propagator as a subclass of scipy sparse linear operator |
- class vamtoolbox.projector.algebraicPropagation.AlgebraicPropagator(target_geo, proj_geo)#
Bases:
scipy.sparse.linalg.LinearOperatorCPU implementation of algebraic propagator as a subclass of scipy sparse linear operator This operator is the A in Ax = b, or the P in Pf = g, where x or f is the real space object (flattened into 1D array) and b or g is the sinogram (flattened into 1D array).
Notes: Due to the demanding memory requirement in this algebraic propagation approach, it is often to only create projection matrix in 2D and apply it to both 2D and 3D problems. In this simplified case of decoupling a 3D problem into many 2D problems, the imported sparse matrix is only required to encode projection process of one z-layer.
Therefore, the number of real space voxels only has to be equal to the integer multiples of the number of columns in imported sparse matrix (.npz). This requirement reads as (x.size % A.shape[1]) == 0. For example, x.size = 256 * A.shape[1] when there are 256 z-layers but A only encode projection of one layer.
As in other projectors, the size of the sinogram is determined by the projection process itself. Forward propagation using this method produce sinogram that has the size of (number of rows of sparse propagation matrix * number of z-layer extension) Continuing from above example, it reads b.size = A.shape[0]*256
Backpropagation process will check for (b.size % A.shape[0]) == 0
#TODO: replace _rmatvec with _adjoint # use ravel() to perform z-tiled multiplication instead of loops #TODO: Performance mode to store 2 CSR copies of the matrix.
- _matvec(x)#
- _rmatvec(b)#
- forward(x)#
- backward(b)#
- inverseBackward(x, method='lsqr', atol=1e-06, btol=1e-06, iter_lim=10, show=True, x0=None, **kwargs)#
#Currently only works for one 2D slice.
(Approximate) inverse of backpropagation operator In x = (A^T)b, for a given x, find approximate solution b . In f = (P^T)g, for a given f, find approximate solution g.
#Options LSQR: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.lsqr.html LSMR: https://docs.scipy.org/doc/scipy-1.9.1/reference/generated/scipy.sparse.linalg.lsmr.html#scipy.sparse.linalg.lsmr
#TODO: Get it working for multiple layers. Also test if optimization works for linear model and zero initialization.