LinDeformFixedTempl

class odl.deform.linearized.LinDeformFixedTempl(*args, **kwargs)[source]

Bases: odl.operator.operator.Operator

Deformation operator with fixed template acting on displacement fields.

The operator has a fixed template I and maps a displacement field v to the new function x --> I(x + v(x)).

See also

LinDeformFixedDisp

Deformation with a fixed displacement.

Notes

For \Omega \subset \mathbb{R}^d, we take X = L^p(\Omega) to be the template space, i.e. I \in X. Then the vector field space is identified with V := X^d. Hence the deformation operator with fixed template maps V into X:

W_I : V \to X, \quad W_I(v) := I(\cdot + v(\cdot)),

i.e., W_I(v)(x) = I(x + v(x)).

Note that this operator is non-linear. Its derivative at v is an operator that maps V into X:

W_I'(v) : V \to X, \quad W_I'(v)(u) =
\big< \nabla I(\cdot + v(\cdot)), u \big>_{\mathbb{R}^d},

i.e., W_I'(v)(u)(x) = \nabla I(x + v(x))^T u(x),

which is to be understood as a point-wise inner product, resulting in a function in X. And the adjoint of the preceding derivative is also an operator that maps X into V:

W_I'(v)^* : X \to V, \quad W_I'(v)^*(J) =
J \, \nabla I(\cdot + v(\cdot)),

i.e., W_I'(v)^*(J)(x) = J(x) \, \nabla I(x + v(x)).

Attributes
adjoint

Adjoint of this operator (abstract).

domain

Set of objects on which this operator can be evaluated.

interp

Interpolation scheme or tuple of per-axis interpolation schemes.

interp_byaxis

Tuple of per-axis interpolation schemes.

inverse

Return the operator inverse.

is_functional

True if this operator’s range is a Field.

is_linear

True if this operator is linear.

range

Set in which the result of an evaluation of this operator lies.

template

Fixed template of this deformation operator.

Methods

_call(self, displacement[, out])

Implementation of self(displacement[, out]).

derivative(self, displacement)

Derivative of the operator at displacement.

norm(self[, estimate])

Return the operator norm of this operator.

__init__(self, template, domain=None, interp='linear')[source]

Initialize a new instance.

Parameters
templateDiscretizedSpaceElement

Fixed template that is to be deformed.

domainpower space of DiscretizedSpace, optional

The space of all allowed coordinates in the deformation. A ProductSpace of template.ndim copies of a function-space. It must fulfill domain[0].partition == template.space.partition, so this option is useful mainly when using different interpolations in displacement and template.

Default: template.space.real_space.tangent_bundle

interpstr or sequence of str

Interpolation type that should be used to sample the template on the deformed grid. A single value applies to all axes, and a sequence gives the interpolation scheme per axis.

Supported values: 'nearest', 'linear'

Warning

Choosing 'nearest' interpolation results in a formally non-differentiable operator since the gradient of the template is not well-defined. If the operator derivative is to be used, a differentiable interpolation scheme (e.g., 'linear') should be chosen.

Examples

Create a simple 1D template to initialize the operator and apply it to a displacement field. Where the displacement is zero, the output value is the same as the input value. In the 4-th point, the value is taken from 0.2 (one cell) to the left, i.e. 1.0.

>>> space = odl.uniform_discr(0, 1, 5)
>>> template = space.element([0, 0, 1, 0, 0])
>>> op = LinDeformFixedTempl(template, interp='nearest')
>>> disp_field = [[0, 0, 0, -0.2, 0]]
>>> print(op(disp_field))
[ 0.,  0.,  1.,  1.,  0.]

The result depends on the chosen interpolation. With ‘linear’ interpolation and an offset of half the distance between two points, 0.1, one gets the mean of the values.

>>> op = LinDeformFixedTempl(template, interp='linear')
>>> disp_field = [[0, 0, 0, -0.1, 0]]
>>> print(op(disp_field))
[ 0. ,  0. ,  1. ,  0.5,  0. ]