Package net.imglib2
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>
- 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.
- 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 AbstractCursorInt
<T> copy()
abstract AbstractCursorInt
<T> double
getDoublePosition
(int d) Return the current position in a given dimension.float
getFloatPosition
(int d) Return the current position in a given dimension.long
getLongPosition
(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
(long[] pos) Write the current position into the passed array.next()
void
remove()
toString()
Methods inherited from class net.imglib2.AbstractEuclideanSpace
numDimensions
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.imglib2.EuclideanSpace
numDimensions
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext
Methods inherited from interface net.imglib2.Localizable
getIntPosition, localize
-
Constructor Details
-
AbstractCursorInt
public AbstractCursorInt(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:RealLocalizable
Write the current position into the passed array.- Specified by:
localize
in interfaceRealLocalizable
- Parameters:
pos
- receives current position
-
localize
public void localize(double[] pos) Description copied from interface:RealLocalizable
Write the current position into the passed array.- Specified by:
localize
in interfaceRealLocalizable
- Parameters:
pos
- receives current position
-
localize
public void localize(long[] pos) Description copied from interface:Localizable
Write the current position into the passed array.- Specified by:
localize
in interfaceLocalizable
- Parameters:
pos
- receives current position
-
getFloatPosition
public float getFloatPosition(int d) Description copied from interface:RealLocalizable
Return the current position in a given dimension.- Specified by:
getFloatPosition
in interfaceRealLocalizable
- Parameters:
d
- dimension- Returns:
- dimension of current position
-
getDoublePosition
public double getDoublePosition(int d) Description copied from interface:RealLocalizable
Return the current position in a given dimension.- Specified by:
getDoublePosition
in interfaceRealLocalizable
- Parameters:
d
- dimension- Returns:
- dimension of current position
-
getLongPosition
public long getLongPosition(int d) Description copied from interface:Localizable
Return the current position in a given dimension.- Specified by:
getLongPosition
in interfaceLocalizable
- Parameters:
d
- dimension- Returns:
- dimension of current position
-
toString
-
copy
- Specified by:
copy
in interfaceSampler<T>
- Returns:
- - A new
Sampler
in 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 anArrayCursor
for example)
-
copyCursor
- Specified by:
copyCursor
in interfaceCursor<T>
- Specified by:
copyCursor
in interfaceRealCursor<T>
-