Resampling
- class odl.Resampling(*args, **kwargs)
Bases:
OperatorAn operator that resamples on a different grid in the same set.
- __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'
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. ]
- domain