Package net.imglib2
Class AbstractCursor<T>
java.lang.Object
net.imglib2.AbstractEuclideanSpace
net.imglib2.AbstractCursor<T>
- Type Parameters:
T-
- All Implemented Interfaces:
Iterator<T>,Cursor<T>,EuclideanSpace,Iterator,Localizable,RealCursor<T>,RealLocalizable,Sampler<T>
- Direct Known Subclasses:
AbstractLongListImg.LongListCursor,CellCursor
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 long variant. For particular cursors, this may be implemented more efficiently saving at least one loop over n.
- Author:
- Stephan Preibisch, Stephan Saalfeld, Tobias Pietzsch
-
Field Summary
Fields inherited from class net.imglib2.AbstractEuclideanSpace
n -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract AbstractCursor<T> copy()abstract AbstractCursor<T> doublegetDoublePosition(int d) Return the current position in a given dimension.floatgetFloatPosition(int d) Return the current position in a given dimension.intgetIntPosition(int d) Return the current position in a given dimension.voidjumpFwd(long steps) Highly recommended to override this with a more efficient version.voidlocalize(double[] pos) Write the current position into the passed array.voidlocalize(float[] pos) Write the current position into the passed array.voidlocalize(int[] pos) Write the current position into the passed array.next()voidremove()toString()Methods inherited from class net.imglib2.AbstractEuclideanSpace
numDimensionsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.imglib2.EuclideanSpace
numDimensionsMethods inherited from interface java.util.Iterator
forEachRemaining, hasNextMethods inherited from interface net.imglib2.Localizable
getLongPosition, localize
-
Constructor Details
-
AbstractCursor
public AbstractCursor(int n) - Parameters:
n- number of dimensions in theImg.
-
-
Method Details
-
remove
public void remove() -
next
-
jumpFwd
public void jumpFwd(long steps) Highly recommended to override this with a more efficient version. -
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
-
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
-
localize
public void localize(int[] pos) Description copied from interface:LocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceLocalizable- Parameters:
pos- receives current position
-
getFloatPosition
public float getFloatPosition(int d) Description copied from interface:RealLocalizableReturn the current position in a given dimension.- 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 interfaceRealLocalizable- Parameters:
d- dimension- Returns:
- dimension of current position
-
getIntPosition
public int getIntPosition(int d) Description copied from interface:LocalizableReturn the current position in a given dimension.- Specified by:
getIntPositionin interfaceLocalizable- Parameters:
d- dimension- Returns:
- dimension of current position
-
toString
-
copy
- 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)
-
copyCursor
- Specified by:
copyCursorin interfaceCursor<T>- Specified by:
copyCursorin interfaceRealCursor<T>
-