LinDeformFixedDisp

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

Bases: odl.operator.operator.Operator

Deformation operator with fixed displacement acting on templates.

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

See also

LinDeformFixedTempl

Deformation with a fixed template.

Notes

For \Omega \subset \mathbb{R}^d, we take V := X^d to be the space of displacement fields, where X = L^p(\Omega) is the template space. Hence the deformation operator with the fixed displacement field v \in V maps X into X:

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

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

This operator is linear, so its derivative is itself, but it may not be bounded and may thus not have a formal adjoint. For “small” v, though, one can approximate the adjoint by

W_v^*(I) \approx \exp(-\mathrm{div}\, v) \, I(\cdot - v(\cdot)),

i.e., W_v^*(I)(x) \approx \exp(-\mathrm{div}\,v(x))\, I(x - v(x)).

Attributes
adjoint

Adjoint of the linear operator.

displacement

Fixed displacement field of this deformation operator.

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

Inverse deformation using -v as displacement.

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.

Methods

_call(self, template[, out])

Implementation of self(template[, out]).

derivative(self, point)

Return the operator derivative at point.

norm(self[, estimate])

Return the operator norm of this operator.

__init__(self, displacement, templ_space=None, interp='linear')[source]

Initialize a new instance.

Parameters
displacementelement of a power space of DiscretizedSpace

Fixed displacement field used in the deformation.

templ_spaceDiscretizedSpace, optional

Template space on which this operator is applied, i.e. the operator domain and range. It must fulfill templ_space[0].partition == displacement.space.partition, so this option is useful mainly for support of complex spaces and if different interpolations should be used for displacement and template.

Default: displacement.space[0]

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'

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)
>>> disp_field = space.tangent_bundle.element([[0, 0, 0, -0.2, 0]])
>>> op = odl.deform.LinDeformFixedDisp(disp_field, interp='nearest')
>>> template = [0, 0, 1, 0, 0]
>>> print(op([0, 0, 1, 0, 0]))
[ 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.

>>> disp_field = space.tangent_bundle.element([[0, 0, 0, -0.1, 0]])
>>> op = odl.deform.LinDeformFixedDisp(disp_field, interp='linear')
>>> template = [0, 0, 1, 0, 0]
>>> print(op(template))
[ 0. ,  0. ,  1. ,  0.5,  0. ]