Package net.imglib2.iterator
Class LocalizingRealIntervalIterator
java.lang.Object
net.imglib2.AbstractEuclideanSpace
net.imglib2.AbstractRealInterval
net.imglib2.iterator.LocalizingRealIntervalIterator
- All Implemented Interfaces:
EuclideanSpace,Iterator,RealInterval,RealLocalizable
public class LocalizingRealIntervalIterator
extends AbstractRealInterval
implements Iterator, RealLocalizable
Use this class to iterate a virtual
RealInterval in flat order, that
is: with the first dimension varying most quickly and the last dimension
varying most slowly. This is useful for iterating an arbitrary real interval
in a defined order.-
Field Summary
FieldsFields inherited from class net.imglib2.AbstractRealInterval
max, minFields inherited from class net.imglib2.AbstractEuclideanSpace
n -
Constructor Summary
ConstructorsConstructorDescriptionLocalizingRealIntervalIterator(double[] min, double[] max, double[] step) Iterates anRealIntervalwith given min and max the the provided step along each dimension.LocalizingRealIntervalIterator(RealInterval interval, double[] step) Iterates anRealIntervalwith given min and max with the provided step along each dimension. -
Method Summary
Modifier and TypeMethodDescriptionvoidfwd()Move forward.private voidfwdDim(int d) doublegetDoublePosition(int d) Return the current position in a given dimension.floatgetFloatPosition(int d) Return the current position in a given dimension.booleanhasNext()Returns true if another step forward is possible.voidjumpFwd(long steps) Move steps × forward.voidlocalize(double[] position) Write the current position into the passed array.voidlocalize(float[] position) Write the current position into the passed array.voidreset()Reset theIterator, that is put it to where it would be if newly created.toString()Methods inherited from class net.imglib2.AbstractRealInterval
realMax, realMax, realMax, realMin, realMin, realMinMethods 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 net.imglib2.RealInterval
maxAsDoubleArray, maxAsRealPoint, minAsDoubleArray, minAsRealPointMethods inherited from interface net.imglib2.RealLocalizable
localize, positionAsDoubleArray, positionAsRealPoint
-
Field Details
-
step
protected final double[] step -
location
protected final double[] location
-
-
Constructor Details
-
LocalizingRealIntervalIterator
Iterates anRealIntervalwith given min and max with the provided step along each dimension.- Parameters:
interval- the real intervalstep- iteration step
-
LocalizingRealIntervalIterator
public LocalizingRealIntervalIterator(double[] min, double[] max, double[] step) Iterates anRealIntervalwith given min and max the the provided step along each dimension.- Parameters:
min- real interval minmax- real interval minstep- iteration steps
-
-
Method Details
-
reset
public void reset()Description copied from interface:IteratorReset theIterator, that is put it to where it would be if newly created. -
hasNext
public boolean hasNext()Description copied from interface:IteratorReturns true if another step forward is possible. -
toString
- Overrides:
toStringin classAbstractRealInterval
-
localize
public void localize(float[] position) Description copied from interface:RealLocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceRealLocalizable- Parameters:
position- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
localize
public void localize(double[] position) Description copied from interface:RealLocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceRealLocalizable- Parameters:
position- receives current position, length 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 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
-
jumpFwd
public void jumpFwd(long steps) Description copied from interface:IteratorMove steps × forward.Highly recommended to override this with a more efficient version.
-
fwd
public void fwd()Description copied from interface:IteratorMove forward. -
fwdDim
private void fwdDim(int d)
-