T
- public abstract class AbstractCursor<T> extends AbstractEuclideanSpace implements Cursor<T>
Cursor
. Java's Iterator
interface is implemented by mapping to abstract Iterator.fwd()
and
Sampler.get()
.
For localization, default implementations are available that all build on the abstract long variant. For particular cursors, this may be implemented more efficiently saving at least one loop over n.
n
Constructor and Description |
---|
AbstractCursor(int n) |
Modifier and Type | Method and Description |
---|---|
abstract AbstractCursor<T> |
copy() |
abstract AbstractCursor<T> |
copyCursor() |
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.
|
void |
jumpFwd(long steps)
Highly recommended to override this with a more efficient version.
|
void |
localize(double[] pos)
Write the current position into the passed array.
|
void |
localize(float[] pos)
Write the current position into the passed array.
|
void |
localize(int[] pos)
Write the current position into the passed array.
|
T |
next() |
void |
remove() |
String |
toString() |
numDimensions
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEachRemaining, hasNext
getLongPosition, localize, localize, positionAsLongArray, positionAsPoint
localize, positionAsDoubleArray, positionAsRealPoint
numDimensions
public AbstractCursor(int n)
n
- number of dimensions in the Img
.public void jumpFwd(long steps)
steps
- public void localize(float[] pos)
RealLocalizable
localize
in interface RealLocalizable
pos
- receives current positionpublic void localize(double[] pos)
RealLocalizable
localize
in interface RealLocalizable
pos
- receives current positionpublic void localize(int[] pos)
Localizable
localize
in interface Localizable
pos
- 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 getIntPosition(int d)
Localizable
getIntPosition
in interface Localizable
d
- dimensionpublic abstract AbstractCursor<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 abstract AbstractCursor<T> copyCursor()
copyCursor
in interface Cursor<T>
copyCursor
in interface RealCursor<T>
Copyright © 2015–2022 ImgLib2. All rights reserved.