public interface RealRandomAccess<T> extends RealLocalizable, RealPositionable, Sampler<T>
Modifier and Type | Method and Description |
---|---|
RealRandomAccess<T> |
copyRealRandomAccess() |
default T |
setPositionAndGet(double... position)
Convenience method that moves the
RealRandomAccess to the given
position and gets the value at that position. |
default T |
setPositionAndGet(float... position)
Convenience method that moves the
RealRandomAccess to the given
position and gets the value at that position. |
default T |
setPositionAndGet(RealLocalizable position)
Convenience method that moves the
RealRandomAccess to the given
position and gets the value at that position. |
getDoublePosition, getFloatPosition, localize, localize, localize, positionAsDoubleArray, positionAsRealPoint
move, move, move, move, move, setPosition, setPosition, setPosition, setPosition, setPosition
bck, fwd, move, move, move, move, move, setPosition, setPosition, setPosition, setPosition, setPosition
numDimensions
RealRandomAccess<T> copyRealRandomAccess()
default T setPositionAndGet(double... position)
RealRandomAccess
to the given
position and gets the value at that position. It's a shortcut for:
setPosition( position );
get();
WARNING: The return value is invalidated by next call to
setPositionAndGet(double...)
or RealPositionable.setPosition(net.imglib2.RealLocalizable)
.
// This is wrong!!!
a = randomAccess.setPositionAndGet( positionA );
b = randomAccess.setPositionAndGet( positionB ); // this invalidates "a" !!!
wrongDifference = a.getRealDouble() - b.getRealDouble();
// Correct:
// Use individual RandomAccesses to query a and b
a = randomAccess_A.setPositionAndGet( positionA );
b = randomAccess_B.setPositionAndGet( positionB ); // this is fine because a different RandomAccess is used
difference = a.getRealDouble() - b.getRealDouble();
default T setPositionAndGet(float... position)
RealRandomAccess
to the given
position and gets the value at that position. It's a shortcut for:
setPosition( position );
get();
WARNING: The return value is invalidated by next call to
setPositionAndGet(double...)
or RealPositionable.setPosition(net.imglib2.RealLocalizable)
.
// This is wrong!!!
a = randomAccess.setPositionAndGet( positionA );
b = randomAccess.setPositionAndGet( positionB ); // this invalidates "a" !!!
wrongDifference = a.getRealDouble() - b.getRealDouble();
// Correct:
// Use individual RandomAccesses to query a and b
a = randomAccess_A.setPositionAndGet( positionA );
b = randomAccess_B.setPositionAndGet( positionB ); // this is fine because a different RandomAccess is used
difference = a.getRealDouble() - b.getRealDouble();
default T setPositionAndGet(RealLocalizable position)
RealRandomAccess
to the given
position and gets the value at that position. It's a shortcut for:
setPosition( position );
get();
WARNING: The return value is invalidated by next call to
setPositionAndGet(double...)
or RealPositionable.setPosition(net.imglib2.RealLocalizable)
.
// This is wrong!!!
a = randomAccess.setPositionAndGet( positionA );
b = randomAccess.setPositionAndGet( positionB ); // this invalidates "a" !!!
wrongDifference = a.getRealDouble() - b.getRealDouble();
// Correct:
// Use individual RandomAccesses to query a and b
a = randomAccess_A.setPositionAndGet( positionA );
b = randomAccess_B.setPositionAndGet( positionB ); // this is fine because a different RandomAccess is used
difference = a.getRealDouble() - b.getRealDouble();
Copyright © 2015–2022 ImgLib2. All rights reserved.