dival.reconstructors.odl_reconstructors module

Provides wrappers for reconstruction methods of odl.

class dival.reconstructors.odl_reconstructors.FBPReconstructor(ray_trafo, padding=True, hyper_params=None, pre_processor=None, post_processor=None, recompute_fbp_op=True, **kwargs)[source]

Bases: dival.reconstructors.reconstructor.Reconstructor

HYPER_PARAMS = {'filter_type': {'choices': ['Ram-Lak', 'Shepp-Logan', 'Cosine', 'Hamming', 'Hann'], 'default': 'Ram-Lak'}, 'frequency_scaling': {'default': 1.0, 'grid_search_options': {'num_samples': 11}, 'range': [0, 1]}}

Reconstructor applying filtered back-projection.

fbp_op

The operator applying filtered back-projection. It is computed in the constructor, and is recomputed for each reconstruction if recompute_fbp_op == True (since parameters could change).

Type

odl.operator.Operator

__init__(ray_trafo, padding=True, hyper_params=None, pre_processor=None, post_processor=None, recompute_fbp_op=True, **kwargs)[source]
Parameters
  • ray_trafo (odl.tomo.operators.RayTransform) – The forward operator. See odl.tomo.fbp_op for details.

  • padding (bool, optional) – Whether to use padding (the default is True). See odl.tomo.fbp_op for details.

  • pre_processor (callable, optional) – Callable that takes the observation and returns the sinogram that is passed to the filtered back-projection operator.

  • post_processor (callable, optional) – Callable that takes the filtered back-projection and returns the final reconstruction.

  • recompute_fbp_op (bool, optional) – Whether fbp_op should be recomputed on each call to reconstruct(). Must be True (default) if changes to ray_trafo, hyper_params or padding are planned in order to use the updated values in reconstruct(). If none of these attributes will change, you may specify recompute_fbp_op==False, so fbp_op can be computed only once, improving reconstruction time efficiency.

property filter_type
property frequency_scaling
class dival.reconstructors.odl_reconstructors.CGReconstructor(op, x0, niter, callback=None, op_is_symmetric=False, **kwargs)[source]

Bases: dival.reconstructors.reconstructor.IterativeReconstructor

Iterative reconstructor applying the conjugate gradient method.

op

The forward operator of the inverse problem.

Type

odl.operator.Operator

x0

Initial value.

Type

op.domain element

niter

Number of iterations.

Type

int

callback

Object that is called in each iteration.

Type

odl.solvers.util.callback.Callback or None

op_is_symmetric

If False (default), the normal equations are solved. If True, op is assumed to be self-adjoint and the system of equations is solved directly.

Type

bool

__init__(op, x0, niter, callback=None, op_is_symmetric=False, **kwargs)[source]

Calls odl.solvers.iterative.iterative.conjugate_gradient_normal (if op_is_symmetric == False) or odl.solvers.iterative.iterative.conjugate_gradient (if op_is_symmetric == True).

Parameters
  • op (odl.operator.Operator) – The forward operator of the inverse problem. If op_is_symmetric == False (default), the call op.derivative(x).adjoint must be valid. If op_is_symmetric == True, op must be linear and self-adjoint.

  • x0 (op.domain element) – Initial value.

  • niter (int) – Number of iterations.

  • callback (odl.solvers.util.callback.Callback, optional) – Object that is called in each iteration.

  • op_is_symmetric (bool, optional) – If False (default), the normal equations are solved. If True, op is required to be self-adjoint and the system of equations is solved directly.

property iterations
class dival.reconstructors.odl_reconstructors.GaussNewtonReconstructor(op, x0, niter, zero_seq_gen=None, callback=None, **kwargs)[source]

Bases: dival.reconstructors.reconstructor.IterativeReconstructor

Iterative reconstructor applying the Gauss-Newton method.

op

The forward operator of the inverse problem.

Type

odl.operator.Operator

x0

Initial value.

Type

op.domain element

niter

Maximum number of iterations.

Type

int

zero_seq_gen

Zero sequence generator used for regularization.

Type

generator

callback

Object that is called in each iteration.

Type

odl.solvers.util.callback.Callback or None

__init__(op, x0, niter, zero_seq_gen=None, callback=None, **kwargs)[source]

Calls odl.solvers.iterative.iterative.gauss_newton.

Parameters
  • op (odl.operator.Operator) – The forward operator of the inverse problem. The call op.derivative(x).adjoint must be valid.

  • x0 (op.domain element) – Initial value.

  • niter (int) – Maximum number of iterations.

  • zero_seq_gen (generator, optional) – Zero sequence generator used for regularization. Default: generator yielding 2^(-i).

  • callback (odl.solvers.util.callback.Callback, optional) – Object that is called in each iteration.

property iterations
class dival.reconstructors.odl_reconstructors.KaczmarzReconstructor(ops, x0, niter, omega=1, random=False, projection=None, callback=None, callback_loop='outer', **kwargs)[source]

Bases: dival.reconstructors.reconstructor.IterativeReconstructor

Iterative reconstructor applying Kaczmarz’s method.

ops

The forward operators of the inverse problem.

Type

sequence of odl.Operator

x0

Initial value.

Type

op.domain element

niter

Number of iterations.

Type

int

omega

Relaxation parameter. If a single float is given it is used for all operators.

Type

positive float or sequence of positive floats

random

Whether the order of the operators is randomized in each iteration.

Type

bool

projection

Callable that can be used to modify the iterates in each iteration.

Type

callable

callback

Object that is called in each iteration.

Type

odl.solvers.util.callback.Callback or None

callback_loop

Whether the callback should be called in the inner or outer loop.

Type

{‘inner’, ‘outer’}

__init__(ops, x0, niter, omega=1, random=False, projection=None, callback=None, callback_loop='outer', **kwargs)[source]

Calls odl.solvers.iterative.iterative.kaczmarz.

Parameters
  • ops (sequence of odl.Operator) – The forward operators of the inverse problem. The call ops[i].derivative(x).adjoint must be valid for all i.

  • x0 (op.domain element) – Initial value.

  • niter (int) – Number of iterations.

  • omega (positive float or sequence of positive floats, optional) – Relaxation parameter. If a single float is given it is used for all operators.

  • random (bool, optional) – Whether the order of the operators is randomized in each iteration.

  • projection (callable, optional) – Callable that can be used to modify the iterates in each iteration.

  • callback (odl.solvers.util.callback.Callback, optional) – Object that is called in each iteration.

  • callback_loop ({'inner', 'outer'}) – Whether the callback should be called in the inner or outer loop.

property iterations
class dival.reconstructors.odl_reconstructors.LandweberReconstructor(op, x0, niter, omega=None, projection=None, callback=None, **kwargs)[source]

Bases: dival.reconstructors.reconstructor.IterativeReconstructor

Iterative reconstructor applying Landweber’s method.

op

The forward operator of the inverse problem.

Type

odl.operator.Operator

x0

Initial value.

Type

op.domain element

niter

Number of iterations.

Type

int

omega

Relaxation parameter.

Type

positive float

projection

Callable that can be used to modify the iterates in each iteration.

Type

callable

callback

Object that is called in each iteration.

Type

odl.solvers.util.callback.Callback or None

__init__(op, x0, niter, omega=None, projection=None, callback=None, **kwargs)[source]

Calls odl.solvers.iterative.iterative.landweber.

Parameters
  • op (odl.operator.Operator) – The forward operator of the inverse problem. The call op.derivative(x).adjoint must be valid.

  • x0 (op.domain element) – Initial value.

  • niter (int) – Number of iterations.

  • omega (positive float, optional) – Relaxation parameter.

  • projection (callable, optional) – Callable that can be used to modify the iterates in each iteration. One argument is passed and expected be modified in-place.

  • callback (odl.solvers.util.callback.Callback, optional) – Object that is called in each iteration.

property iterations
class dival.reconstructors.odl_reconstructors.MLEMReconstructor(op, x0, niter, noise='poisson', callback=None, sensitivities=None, **kwargs)[source]

Bases: dival.reconstructors.reconstructor.IterativeReconstructor

Iterative reconstructor applying Maximum Likelihood Expectation Maximization.

If multiple operators are given, Ordered Subsets MLEM is applied.

op

The forward operator(s) of the inverse problem.

Type

odl.operator.Operator or sequence of odl.operator.Operator

x0

Initial value.

Type

op.domain element

niter

Number of iterations.

Type

int

noise

Noise model determining the variant of MLEM.

Type

{‘poisson’} or None

callback

Object that is called in each iteration.

Type

odl.solvers.util.callback.Callback or None

sensitivities

Usable with noise='poisson'. The algorithm contains an A^T 1 term, if this parameter is given, it is replaced by it. Default: op[i].adjoint(op[i].range.one())

Type

float or op.domain element-like

__init__(op, x0, niter, noise='poisson', callback=None, sensitivities=None, **kwargs)[source]

Calls odl.solvers.iterative.statistical.osmlem.

Parameters
  • op (odl.operator.Operator or sequence of odl.operator.Operator) – The forward operator(s) of the inverse problem. If an operator sequence is given, Ordered Subsets MLEM is applied.

  • x0 (op.domain element) – Initial value.

  • niter (int) – Number of iterations.

  • noise ({'poisson'}, optional) – Noise model determining the variant of MLEM. For 'poisson', the initial value of x should be non-negative.

  • callback (odl.solvers.util.callback.Callback, optional) – Object that is called in each iteration.

  • sensitivities (float or op.domain element-like, optional) – Usable with noise='poisson'. The algorithm contains an A^T 1 term, if this parameter is given, it is replaced by it. Default: op[i].adjoint(op[i].range.one())

property iterations
class dival.reconstructors.odl_reconstructors.ISTAReconstructor(op, x0, niter, gamma=0.001, reg=<class 'odl.solvers.functional.default_functionals.L1Norm'>, accelerated=True, lam=1.0, callback=None, **kwargs)[source]

Bases: dival.reconstructors.reconstructor.IterativeReconstructor

Iterative reconstructor applying proximal gradient algorithm for convex optimization, also known as Iterative Soft-Thresholding Algorithm (ISTA).

op

The forward operator of the inverse problem.

Type

odl.operator.Operator

x0

Initial value.

Type

op.domain element

niter

Number of iterations.

Type

int

gamma

Step size parameter.

Type

positive float

reg

The regularization operator of the inverse problem. Needs to have f.proximal.

Type

odl.solvers.functional.Functional

accelerated

Indicates which algorithm to use. If False, then the “Iterative Soft-Thresholding Algorithm” (ISTA) is used. If True, then the accelerated version FISTA is used.

Type

boolean

lam

Overrelaxation step size (default 1.0). If callable, it should take an index (starting at zero) and return the corresponding step size.

Type

float or callable

callback

Object that is called in each iteration.

Type

odl.solvers.util.callback.Callback or None

__init__(op, x0, niter, gamma=0.001, reg=<class 'odl.solvers.functional.default_functionals.L1Norm'>, accelerated=True, lam=1.0, callback=None, **kwargs)[source]

Calls odl.solvers.nonsmooth.proximal_gradient_solvers.proximal_gradient or odl.solvers.nonsmooth.proximal_gradient_solvers .accelerated_proximal_gradient.

Parameters
  • op (odl.operator.Operator) – The forward operator of the inverse problem.

  • x0 (op.domain element) – Initial value.

  • niter (int) – Number of iterations.

  • gamma (positive float, optional) – Step size parameter (default 0.001).

  • reg ([type of ] odl.solvers.functional.Functional, optional) – The regularization functional of the inverse problem. Needs to have f.proximal. If a type is passed instead, the functional is constructed by calling reg(op.domain). Default: odl.solvers.L1Norm.

  • accelerated (boolean, optional) – Indicates which algorithm to use. If False, then the “Iterative Soft-Thresholding Algorithm” (ISTA) is used. If True, then the accelerated version FISTA is used. Default: True.

  • lam (float or callable, optional) – Overrelaxation step size (default 1.0). If callable, it should take an index (starting at zero) and return the corresponding step size.

  • callback (odl.solvers.util.callback.Callback, optional) – Object that is called in each iteration.

property iterations
class dival.reconstructors.odl_reconstructors.PDHGReconstructor(op, x0, niter, lam=0.01, callback=None, **kwargs)[source]

Bases: dival.reconstructors.reconstructor.IterativeReconstructor

Primal-Dual Hybrid Gradient (PDHG) algorithm from the 2011 paper https://link.springer.com/article/10.1007/s10851-010-0251-1 with TV regularization.

op

The forward operator of the inverse problem.

Type

odl.operator.Operator

x0

Initial value.

Type

op.domain element

niter

Number of iterations.

Type

int

lam

TV-regularization rate (default 0.01).

Type

positive float, optional

callback

Object that is called in each iteration.

Type

odl.solvers.util.callback.Callback or None

__init__(op, x0, niter, lam=0.01, callback=None, **kwargs)[source]

Calls odl.solvers.nonsmooth.primal_dual_hybrid_gradient.pdhg.

Parameters
  • op (odl.operator.Operator) – The forward operator of the inverse problem.

  • x0 (op.domain element) – Initial value.

  • niter (int) – Number of iterations.

  • lam (positive float, optional) – TV-regularization rate (default 0.01).

  • callback (odl.solvers.util.callback.Callback or None) – Object that is called in each iteration.

property iterations
class dival.reconstructors.odl_reconstructors.DouglasRachfordReconstructor(op, x0, niter, lam=0.01, callback=None, **kwargs)[source]

Bases: dival.reconstructors.reconstructor.IterativeReconstructor

Douglas-Rachford primal-dual splitting algorithm from the 2012 paper https://arxiv.org/abs/1212.0326 with TV regularization.

op

The forward operator of the inverse problem.

Type

odl.operator.Operator

x0

Initial value.

Type

op.domain element

niter

Number of iterations.

Type

int

lam

TV-regularization rate (default 0.01).

Type

positive float, optional

callback

Object that is called in each iteration.

Type

odl.solvers.util.callback.Callback or None

__init__(op, x0, niter, lam=0.01, callback=None, **kwargs)[source]

Calls odl.solvers.nonsmooth.douglas_rachford.douglas_rachford_pd.

Parameters
  • op (odl.operator.Operator) – The forward operator of the inverse problem.

  • x0 (op.domain element) – Initial value.

  • niter (int) – Number of iterations.

  • lam (positive float, optional) – TV-regularization rate (default 0.01).

  • callback (odl.solvers.util.callback.Callback or None) – Object that is called in each iteration.

property iterations
class dival.reconstructors.odl_reconstructors.ForwardBackwardReconstructor(op, x0, niter, lam=0.01, tau=0.01, callback=None, **kwargs)[source]

Bases: dival.reconstructors.reconstructor.IterativeReconstructor

The forward-backward primal-dual splitting algorithm.

op

The forward operator of the inverse problem.

Type

odl.operator.Operator

x0

Initial value.

Type

op.domain element

niter

Number of iterations.

Type

int

lam

TV-regularization rate (default 0.01).

Type

positive float, optional

tau

Step-size like parameter for f (default is 0.01).

Type

positive float, optional

callback

Object that is called in each iteration.

Type

odl.solvers.util.callback.Callback or None

__init__(op, x0, niter, lam=0.01, tau=0.01, callback=None, **kwargs)[source]

Calls odl.solvers.forward_backward_pd.

Parameters
  • op (odl.operator.Operator) – The forward operator of the inverse problem.

  • x0 (op.domain element) – Initial value.

  • niter (int) – Number of iterations.

  • lam (positive float, optional) – TV-regularization rate (default 0.01).

  • tau (positive float, optional) – Step-size like parameter for f (default is 0.01).

  • callback (odl.solvers.util.callback.Callback or None) – Object that is called in each iteration.

property iterations
class dival.reconstructors.odl_reconstructors.ADMMReconstructor(op, x0, niter, lam=0.01, tau=0.01, callback=None, **kwargs)[source]

Bases: dival.reconstructors.reconstructor.IterativeReconstructor

Generic linearized ADMM method for convex problems. ADMM stands for ‘Alternating Direction Method of Multipliers’.

op

The forward operator of the inverse problem.

Type

odl.operator.Operator

x0

Initial value.

Type

op.domain element

niter

Number of iterations.

Type

int

lam

TV-regularization weight (default 0.01).

Type

positive float, optional

tau

Step-size like parameter for f (default is 0.01).

Type

positive float, optional

callback

Object that is called in each iteration.

Type

odl.solvers.util.callback.Callback or None

__init__(op, x0, niter, lam=0.01, tau=0.01, callback=None, **kwargs)[source]

Calls odl.solvers.nonsmooth.admm.admm_linearized.

Parameters
  • op (odl.operator.Operator) – The forward operator of the inverse problem.

  • x0 (op.domain element) – Initial value.

  • niter (int) – Number of iterations.

  • lam (positive float, optional) – TV-regularization weight (default 0.01).

  • tau (positive float, optional) – Step-size like parameter for f (default is 0.01).

  • callback (odl.solvers.util.callback.Callback or None) – Object that is called in each iteration.

property iterations
class dival.reconstructors.odl_reconstructors.BFGSReconstructor(op, x0, niter, lam=0.01, callback=None, **kwargs)[source]

Bases: dival.reconstructors.reconstructor.IterativeReconstructor

Quasi-Newton BFGS method to minimize a differentiable function. The TV regularization term is smoothed using the Moreau envelope.

op

The forward operator of the inverse problem.

Type

odl.operator.Operator

x0

Initial value.

Type

op.domain element

niter

Number of iterations.

Type

int

lam

TV-regularization weight (default 0.01).

Type

positive float, optional

callback

Object that is called in each iteration.

Type

odl.solvers.util.callback.Callback or None

__init__(op, x0, niter, lam=0.01, callback=None, **kwargs)[source]

Calls odl.solvers.smooth.newton.bfgs_method.

Parameters
  • op (odl.operator.Operator) – The forward operator of the inverse problem.

  • x0 (op.domain element) – Initial value.

  • niter (int) – Number of iterations.

  • lam (positive float, optional) – TV-regularization weight (default 0.01).

  • callback (odl.solvers.util.callback.Callback or None) – Object that is called in each iteration.

property iterations