Resampling¶
- class odl.discr.discr_ops.Resampling(*args, **kwargs)[source]¶
Bases:
OperatorAn operator that resamples on a different grid in the same set.
- Attributes:
adjointReturn an (approximate) adjoint.
domainSet of objects on which this operator can be evaluated.
interpInterpolation scheme or tuple of per-axis interpolation schemes.
interp_byaxisTuple of per-axis interpolation schemes.
inverseAn (approximate) inverse of this resampling operator.
is_functionalTrueif this operator's range is aField.is_linearTrueif this operator is linear.rangeSet in which the result of an evaluation of this operator lies.
Methods
__call__(x[, out])Return
self(x[, out, **kwargs]).derivative(point)Return the operator derivative at
point.norm([estimate])Return the operator norm of this operator.
- __init__(domain, range, interp)[source]¶
Initialize a new instance.
- Parameters:
- domain
DiscretizedSpace Set of elements that are to be resampled.
- range
DiscretizedSpace Set in which the resampled elements lie. Must have the same
DiscretizedSpace.domainasdomain.- interpstr or sequence of str
Interpolation type that should be used to resample. A single value applies to all axes, and a sequence gives the interpolation scheme per axis.
Supported values:
'nearest','linear'
- domain
Examples
Create two spaces with different number of points and a resampling operator using nearest-neighbor interpolation:
>>> coarse_discr = odl.uniform_discr(0, 1, 3) >>> fine_discr = odl.uniform_discr(0, 1, 6) >>> resampling = odl.Resampling(coarse_discr, fine_discr, 'nearest') >>> resampling.domain uniform_discr(0.0, 1.0, 3) >>> resampling.range uniform_discr(0.0, 1.0, 6) >>> resampling.interp 'nearest'
Apply the corresponding resampling operator to an element:
>>> print(resampling([0, 1, 0])) [ 0., 0., 1., 1., 0., 0.]
With linear interpolation:
>>> resampling = odl.Resampling(coarse_discr, fine_discr, 'linear') >>> print(resampling([0, 1, 0])) [ 0. , 0.25, 0.75, 0.75, 0.25, 0. ]