Class NLinearInterpolator2D<T extends NumericType<T>>
- java.lang.Object
-
- net.imglib2.AbstractEuclideanSpace
-
- net.imglib2.position.transform.AbstractPositionableTransform<LocalizablePositionable>
-
- net.imglib2.position.transform.Floor<RandomAccess<T>>
-
- net.imglib2.interpolation.randomaccess.NLinearInterpolator<T>
-
- net.imglib2.interpolation.randomaccess.NLinearInterpolator2D<T>
-
- Type Parameters:
T-
- All Implemented Interfaces:
EuclideanSpace,Positionable,RealLocalizable,RealPositionable,RealRandomAccess<T>,Sampler<T>,Typed<T>
public class NLinearInterpolator2D<T extends NumericType<T>> extends NLinearInterpolator<T>
-
-
Field Summary
-
Fields inherited from class net.imglib2.interpolation.randomaccess.NLinearInterpolator
accumulator, code, tmp, weights
-
Fields inherited from class net.imglib2.position.transform.AbstractPositionableTransform
discrete, position, target
-
Fields inherited from class net.imglib2.AbstractEuclideanSpace
n
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNLinearInterpolator2D(NLinearInterpolator2D<T> interpolator)protectedNLinearInterpolator2D(RandomAccessible<T> randomAccessible)protectedNLinearInterpolator2D(RandomAccessible<T> randomAccessible, T type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NLinearInterpolator2D<T>copy()protected voidfillWeights()Fill theNLinearInterpolator.weightsarray.Tget()Get the interpolated value at the current position.intnumDimensions()Gets the space's number of dimensions.-
Methods inherited from class net.imglib2.interpolation.randomaccess.NLinearInterpolator
getType
-
Methods inherited from class net.imglib2.position.transform.Floor
floor, floor, floor, floor, floor, move, move, move, move, move, setPosition, setPosition, setPosition, setPosition, setPosition
-
Methods inherited from class net.imglib2.position.transform.AbstractPositionableTransform
bck, fwd, getDoublePosition, getFloatPosition, localize, localize, move, move, move, move, move, setPosition, setPosition, setPosition, setPosition, setPosition, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.imglib2.Positionable
bck, fwd, move, move, move, move, move, setPosition, setPosition, setPosition, setPosition, setPosition
-
Methods inherited from interface net.imglib2.RealLocalizable
getDoublePosition, getFloatPosition, localize, localize, localize, positionAsDoubleArray, positionAsRealPoint
-
Methods inherited from interface net.imglib2.RealPositionable
move, move, move, move, move, setPosition, setPosition, setPosition, setPosition, setPosition
-
Methods inherited from interface net.imglib2.RealRandomAccess
copyRealRandomAccess, setPositionAndGet, setPositionAndGet, setPositionAndGet
-
-
-
-
Constructor Detail
-
NLinearInterpolator2D
protected NLinearInterpolator2D(NLinearInterpolator2D<T> interpolator)
-
NLinearInterpolator2D
protected NLinearInterpolator2D(RandomAccessible<T> randomAccessible, T type)
-
NLinearInterpolator2D
protected NLinearInterpolator2D(RandomAccessible<T> randomAccessible)
-
-
Method Detail
-
numDimensions
public final int numDimensions()
Description copied from interface:EuclideanSpaceGets the space's number of dimensions.- Specified by:
numDimensionsin interfaceEuclideanSpace- Overrides:
numDimensionsin classAbstractEuclideanSpace
-
fillWeights
protected void fillWeights()
Description copied from class:NLinearInterpolatorFill theNLinearInterpolator.weightsarray.Let w_d denote the fraction of a pixel at which the sample position p_d lies from the floored position pf_d in dimension d. That is, the value at pf_d contributes with (1 - w_d) to the sampled value; the value at ( pf_d + 1 ) contributes with w_d.
At every pixel, the total weight results from multiplying the weights of all dimensions for that pixel. That is, the "top-left" contributing pixel (position floored in all dimensions) gets assigned weight (1-w_0)(1-w_1)...(1-w_n).
We work through the weights array starting from the highest dimension. For the highest dimension, the first half of the weights contain the factor (1 - w_n) because this first half corresponds to floored pixel positions in the highest dimension. The second half contain the factor w_n. In this first step, the first weight of the first half gets assigned (1 - w_n). The first element of the second half gets assigned w_n
From their, we work recursively down to dimension 0. That is, each half of weights is again split recursively into two partitions. The first element of the second partitions is the first element of the half multiplied with (w_d). The first element of the first partitions is multiplied with (1 - w_d).
When we have reached dimension 0, all weights will have a value assigned.
- Overrides:
fillWeightsin classNLinearInterpolator<T extends NumericType<T>>
-
get
public T get()
Description copied from class:NLinearInterpolatorGet the interpolated value at the current position.To visit the pixels that contribute to an interpolated value, we move in a (binary-reflected) Gray code pattern, such that only one dimension of the target position is modified per move.
- Specified by:
getin interfaceSampler<T extends NumericType<T>>- Overrides:
getin classNLinearInterpolator<T extends NumericType<T>>
-
copy
public NLinearInterpolator2D<T> copy()
- Specified by:
copyin interfaceRealRandomAccess<T extends NumericType<T>>- Specified by:
copyin interfaceSampler<T extends NumericType<T>>- Overrides:
copyin classNLinearInterpolator<T extends NumericType<T>>- Returns:
- - A new
Samplerin the same state accessing the same values. It does NOT copy T, just the state of theSampler. Otherwise use T.copy() if available. Sampler.copy().get() == Sampler.get(), i.e. both hold the same value, not necessarily the same instance (this is the case for anArrayCursorfor example)
-
-