Class AbstractCursorInt<T>
java.lang.Object
net.imglib2.AbstractEuclideanSpace
net.imglib2.AbstractCursorInt<T>
- Type Parameters:
T-
- All Implemented Interfaces:
Iterator<T>, Cursor<T>, EuclideanSpace, Iterator, Localizable, RealCursor<T>, RealLocalizable, Sampler<T>, Typed<T>
- Direct Known Subclasses:
AbstractArrayCursor, ListCursor, PlanarCursor, PlanarPlaneSubsetCursor
Abstract implementation of
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 int variant. For particular cursors, this may be implemented more efficiently saving at least one loop over n.
This is identical to AbstractCursor, except that default
implementations build on the abstract int instead of long variant here.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int[]used internally to forward all localize() versions to the (abstract) int[] version.Fields inherited from class AbstractEuclideanSpace
n -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract AbstractCursorInt<T> copy()doublegetDoublePosition(int d) Return the current position in a given dimension.floatgetFloatPosition(int d) Return the current position in a given dimension.longgetLongPosition(int d) Return the current position in a given dimension.voidlocalize(double[] pos) Write the current position into the passed array.voidlocalize(float[] pos) Write the current position into the passed array.voidlocalize(long[] pos) Write the current position into the passed array.voidlocalize(Positionable position) Write the current position into the passedPositionable.voidlocalize(RealPositionable position) Write the current position into the passedPositionable.toString()Methods inherited from class AbstractEuclideanSpace
numDimensionsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Cursor
copyCursorMethods inherited from interface EuclideanSpace
numDimensionsMethods inherited from interface Iterator
forEachRemaining, hasNext, removeMethods inherited from interface Localizable
getIntPosition, localize, positionAsLongArray, positionAsPointMethods inherited from interface RealCursor
nextMethods inherited from interface RealLocalizable
positionAsDoubleArray, positionAsRealPoint
-
Field Details
-
tmp
private final int[] tmpused internally to forward all localize() versions to the (abstract) int[] version.
-
-
Constructor Details
-
AbstractCursorInt
public AbstractCursorInt(int n) - Parameters:
n- number of dimensions in theImg.
-
-
Method Details
-
localize
public void localize(float[] pos) Description copied from interface:RealLocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceRealLocalizable- Parameters:
pos- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
localize
public void localize(double[] pos) Description copied from interface:RealLocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceRealLocalizable- Parameters:
pos- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
localize
public void localize(long[] pos) Description copied from interface:LocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceLocalizable- Parameters:
pos- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
localize
Description copied from interface:LocalizableWrite the current position into the passedPositionable. Note for developers: This default implementation forwards toPositionable.setPosition(Localizable), so don't do the same there.- Specified by:
localizein interfaceLocalizable- Parameters:
position- receives current position,EuclideanSpace.numDimensions()must be ≥EuclideanSpace.numDimensions()
-
localize
Description copied from interface:RealLocalizableWrite the current position into the passedPositionable. Note for developers: This default implementation forwards toRealPositionable.setPosition(RealLocalizable), so don't do the same there.- Specified by:
localizein interfaceLocalizable- Specified by:
localizein interfaceRealLocalizable- Parameters:
position- receives current positionEuclideanSpace.numDimensions()must be ≥EuclideanSpace.numDimensions()
-
getFloatPosition
public float getFloatPosition(int d) Description copied from interface:RealLocalizableReturn the current position in a given dimension.- Specified by:
getFloatPositionin interfaceLocalizable- Specified by:
getFloatPositionin interfaceRealLocalizable- Parameters:
d- dimension- Returns:
- dimension of current position
-
getDoublePosition
public double getDoublePosition(int d) Description copied from interface:RealLocalizableReturn the current position in a given dimension.- Specified by:
getDoublePositionin interfaceLocalizable- Specified by:
getDoublePositionin interfaceRealLocalizable- Parameters:
d- dimension- Returns:
- dimension of current position
-
getLongPosition
public long getLongPosition(int d) Description copied from interface:LocalizableReturn the current position in a given dimension.- Specified by:
getLongPositionin interfaceLocalizable- Parameters:
d- dimension- Returns:
- dimension of current position
-
toString
-
copy
- Specified by:
copyin interfaceCursor<T>- Specified by:
copyin interfaceRealCursor<T>- Specified by:
copyin interfaceSampler<T>- Returns:
- - A new
Samplerin 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 anArrayCursorfor example)
-