T
- the pixel typepublic static class StackView.MoveAllSlicesRA<T> extends Object implements RandomAccess<T>
RandomAccess
on a StackView
. It keeps a list of
RandomAccess
es 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
RandomAccess
es. 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, wait
setPositionAndGet, setPositionAndGet, setPositionAndGet
localize, positionAsLongArray, positionAsPoint
localize, positionAsDoubleArray, positionAsRealPoint
public MoveAllSlicesRA(RandomAccessibleInterval<T>[] slices)
public MoveAllSlicesRA(RandomAccessibleInterval<T>[] slices, Interval interval)
public void localize(int[] position)
Localizable
localize
in interface Localizable
position
- receives current positionpublic void localize(long[] position)
Localizable
localize
in interface Localizable
position
- receives current positionpublic int getIntPosition(int d)
Localizable
getIntPosition
in interface Localizable
d
- dimensionpublic long getLongPosition(int d)
Localizable
getLongPosition
in interface Localizable
d
- dimensionpublic void localize(float[] position)
RealLocalizable
localize
in interface RealLocalizable
position
- receives current positionpublic void localize(double[] position)
RealLocalizable
localize
in interface RealLocalizable
position
- receives current positionpublic float getFloatPosition(int d)
RealLocalizable
getFloatPosition
in interface Localizable
getFloatPosition
in interface RealLocalizable
d
- dimensionpublic double getDoublePosition(int d)
RealLocalizable
getDoublePosition
in interface Localizable
getDoublePosition
in interface RealLocalizable
d
- dimensionpublic int numDimensions()
EuclideanSpace
numDimensions
in interface EuclideanSpace
public void fwd(int d)
Positionable
fwd
in interface Positionable
d
- dimensionpublic void bck(int d)
Positionable
bck
in interface Positionable
d
- dimensionpublic void move(int distance, int d)
Positionable
move
in interface Positionable
distance
- relative offset in dimension dd
- dimensionpublic void move(long distance, int d)
Positionable
move
in interface Positionable
distance
- relative offset in dimension dd
- dimensionpublic void move(Localizable distance)
Positionable
Localizable
as distance vector.move
in interface Positionable
distance
- relative offset, EuclideanSpace.numDimensions()
must be
≥ EuclideanSpace.numDimensions()
public void move(int[] distance)
Positionable
move
in interface Positionable
distance
- relative offset, length must be ≥ EuclideanSpace.numDimensions()
public void move(long[] distance)
Positionable
move
in interface Positionable
distance
- relative offset, length must be ≥ EuclideanSpace.numDimensions()
public void setPosition(Localizable position)
Positionable
Localizable
setPosition
in interface Positionable
position
- absolute position, EuclideanSpace.numDimensions()
must be
≥ EuclideanSpace.numDimensions()
public void setPosition(int[] position)
Positionable
setPosition
in interface Positionable
position
- absolute position, length must be ≥
EuclideanSpace.numDimensions()
public void setPosition(long[] position)
Positionable
setPosition
in interface Positionable
position
- absolute position, length must be ≥
EuclideanSpace.numDimensions()
public void setPosition(int position, int d)
Positionable
setPosition
in interface Positionable
position
- absolute position in dimension dd
- dimensionpublic void setPosition(long position, int d)
Positionable
setPosition
in interface Positionable
position
- absolute position in dimension dd
- dimensionpublic T get()
Sampler
Sampler
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.