T - the pixel typepublic static class StackView.MoveAllSlicesRA<T> extends Object implements RandomAccess<T>
RandomAccess on a StackView. It keeps a list of
RandomAccesses on all constituent hyper-slices of the
StackView.
When changing any dimension of the position, except the (n+1)th,
this position change is applied to the all slice
RandomAccesses. The current (n+1)th dimension of the
position is maintained as an index. When get() is called it is
forwarded to the slice RandomAccess at that index.
The potential advantage of this approach is that it does not need to do a
full setPosition() when changing slices.This is faster assuming
that we access in a loop over dimensions with the last dimension (the
hyper-slice dimension) in the inner loop.
Only use this if you know what you are doing.
| Constructor and Description |
|---|
MoveAllSlicesRA(RandomAccessibleInterval<T>[] slices) |
MoveAllSlicesRA(RandomAccessibleInterval<T>[] slices,
Interval interval) |
| Modifier and Type | Method and Description |
|---|---|
void |
bck(int d)
Move by -1 in one dimension.
|
StackView.MoveAllSlicesRA<T> |
copy() |
StackView.MoveAllSlicesRA<T> |
copyRandomAccess() |
void |
fwd(int d)
Move by 1 in one dimension.
|
T |
get()
Access the actual T instance providing access to a pixel,
sub-pixel or integral region value the
Sampler points at. |
double |
getDoublePosition(int d)
Return the current position in a given dimension.
|
float |
getFloatPosition(int d)
Return the current position in a given dimension.
|
int |
getIntPosition(int d)
Return the current position in a given dimension.
|
long |
getLongPosition(int d)
Return the current position in a given dimension.
|
void |
localize(double[] position)
Write the current position into the passed array.
|
void |
localize(float[] position)
Write the current position into the passed array.
|
void |
localize(int[] position)
Write the current position into the passed array.
|
void |
localize(long[] position)
Write the current position into the passed array.
|
void |
move(int[] distance)
Move the element relative to its current location using an int[] as
distance vector.
|
void |
move(int distance,
int d)
Move the element in one dimension for some distance.
|
void |
move(Localizable distance)
Move the element relative to its current location using an
Localizable as distance vector. |
void |
move(long[] distance)
Move the element relative to its current location using a long[] as
distance vector.
|
void |
move(long distance,
int d)
Move the element in one dimension for some distance.
|
int |
numDimensions()
Gets the space's number of dimensions.
|
void |
setPosition(int[] position)
Set the position of the element.
|
void |
setPosition(int position,
int d)
Set the position of the element for one dimension.
|
void |
setPosition(Localizable position)
Place the element at the same location as a given
Localizable |
void |
setPosition(long[] position)
Set the position of the element.
|
void |
setPosition(long position,
int d)
Set the position of the element for one dimension.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetPositionAndGet, setPositionAndGet, setPositionAndGetlocalize, positionAsLongArray, positionAsPointlocalize, positionAsDoubleArray, positionAsRealPointpublic MoveAllSlicesRA(RandomAccessibleInterval<T>[] slices)
public MoveAllSlicesRA(RandomAccessibleInterval<T>[] slices, Interval interval)
public void localize(int[] position)
Localizablelocalize in interface Localizableposition - receives current positionpublic void localize(long[] position)
Localizablelocalize in interface Localizableposition - receives current positionpublic int getIntPosition(int d)
LocalizablegetIntPosition in interface Localizabled - dimensionpublic long getLongPosition(int d)
LocalizablegetLongPosition in interface Localizabled - dimensionpublic void localize(float[] position)
RealLocalizablelocalize in interface RealLocalizableposition - receives current positionpublic void localize(double[] position)
RealLocalizablelocalize in interface RealLocalizableposition - receives current positionpublic float getFloatPosition(int d)
RealLocalizablegetFloatPosition in interface LocalizablegetFloatPosition in interface RealLocalizabled - dimensionpublic double getDoublePosition(int d)
RealLocalizablegetDoublePosition in interface LocalizablegetDoublePosition in interface RealLocalizabled - dimensionpublic int numDimensions()
EuclideanSpacenumDimensions in interface EuclideanSpacepublic void fwd(int d)
Positionablefwd in interface Positionabled - dimensionpublic void bck(int d)
Positionablebck in interface Positionabled - dimensionpublic void move(int distance,
int d)
Positionablemove in interface Positionabledistance - relative offset in dimension dd - dimensionpublic void move(long distance,
int d)
Positionablemove in interface Positionabledistance - relative offset in dimension dd - dimensionpublic void move(Localizable distance)
PositionableLocalizable as distance vector.move in interface Positionabledistance - relative offset, EuclideanSpace.numDimensions() must be
≥ EuclideanSpace.numDimensions()public void move(int[] distance)
Positionablemove in interface Positionabledistance - relative offset, length must be ≥ EuclideanSpace.numDimensions()public void move(long[] distance)
Positionablemove in interface Positionabledistance - relative offset, length must be ≥ EuclideanSpace.numDimensions()public void setPosition(Localizable position)
PositionableLocalizablesetPosition in interface Positionableposition - absolute position, EuclideanSpace.numDimensions() must be
≥ EuclideanSpace.numDimensions()public void setPosition(int[] position)
PositionablesetPosition in interface Positionableposition - absolute position, length must be ≥
EuclideanSpace.numDimensions()public void setPosition(long[] position)
PositionablesetPosition in interface Positionableposition - absolute position, length must be ≥
EuclideanSpace.numDimensions()public void setPosition(int position,
int d)
PositionablesetPosition in interface Positionableposition - absolute position in dimension dd - dimensionpublic void setPosition(long position,
int d)
PositionablesetPosition in interface Positionableposition - absolute position in dimension dd - dimensionpublic T get()
SamplerSampler points at.public StackView.MoveAllSlicesRA<T> copy()
copy in interface Sampler<T>Sampler in the same state accessing the same
values.
It does NOT copy T, just the state of the Sampler.
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 an
ArrayCursor for example)public StackView.MoveAllSlicesRA<T> copyRandomAccess()
copyRandomAccess in interface RandomAccess<T>Copyright © 2015–2022 ImgLib2. All rights reserved.