Class NearestNeighborInterpolator<T>
- java.lang.Object
-
- net.imglib2.AbstractEuclideanSpace
-
- net.imglib2.position.transform.AbstractPositionableTransform<LocalizablePositionable>
-
- net.imglib2.position.transform.Round<RandomAccess<T>>
-
- net.imglib2.interpolation.randomaccess.NearestNeighborInterpolator<T>
-
- Type Parameters:
T
-
- All Implemented Interfaces:
EuclideanSpace
,Positionable
,RealLocalizable
,RealPositionable
,RealRandomAccess<T>
,Sampler<T>
public class NearestNeighborInterpolator<T> extends Round<RandomAccess<T>> implements RealRandomAccess<T>
RealRandomAccess
to aRandomAccess
by nearest neighbor interpolation.In ImgLib2, the coordinate of a sample corresponds to the 'center' point of the sample, i.e. the location at which the sample was acquired. This scheme is intuitive in both rasters and irregularly samples data but can trigger confusion when displaying images on a screen with a pixel raster which, in this scheme, spans the range [-0.5,width-0.5]. In the screen-friendly alternative scheme, where sample coordinates reference the top left corner of the pixel rectangle representing a sample the range covered by an image is [0,width], however, coordinate transfer functions other than translation and homogeneous scaling generate different results than in the center-scheme. Rendering an image using
FloorInterpolator
means using the top-left-scheme, rendering it usingNearestNeighborInterpolator
,NLinearInterpolator
, orLanczosInterpolator
means using the center-scheme.- Author:
- Tobias Pietzsch, Stephan Preibisch, Stephan Saalfeld
-
-
Field Summary
-
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 protected
NearestNeighborInterpolator(NearestNeighborInterpolator<T> nearestNeighborInterpolator)
protected
NearestNeighborInterpolator(RandomAccessible<T> randomAccessible)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NearestNeighborInterpolator<T>
copy()
NearestNeighborInterpolator<T>
copyRealRandomAccess()
T
get()
Access the actual T instance providing access to a pixel, sub-pixel or integral region value theSampler
points at.-
Methods inherited from class net.imglib2.position.transform.Round
move, move, move, move, move, round, round, round, round, round, 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 net.imglib2.AbstractEuclideanSpace
numDimensions
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.imglib2.EuclideanSpace
numDimensions
-
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
-
Methods inherited from interface net.imglib2.RealPositionable
move, move, move, move, move, setPosition, setPosition, setPosition, setPosition, setPosition
-
-
-
-
Constructor Detail
-
NearestNeighborInterpolator
protected NearestNeighborInterpolator(NearestNeighborInterpolator<T> nearestNeighborInterpolator)
-
NearestNeighborInterpolator
protected NearestNeighborInterpolator(RandomAccessible<T> randomAccessible)
-
-
Method Detail
-
get
public T get()
Description copied from interface:Sampler
Access the actual T instance providing access to a pixel, sub-pixel or integral region value theSampler
points at.
-
copy
public NearestNeighborInterpolator<T> copy()
- Specified by:
copy
in interfaceSampler<T>
- Returns:
- - A new
Sampler
in 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 anArrayCursor
for example)
-
copyRealRandomAccess
public NearestNeighborInterpolator<T> copyRealRandomAccess()
- Specified by:
copyRealRandomAccess
in interfaceRealRandomAccess<T>
-
-