Class ZeroMinIntervalIterator
java.lang.Object
net.imglib2.AbstractEuclideanSpace
net.imglib2.AbstractInterval
net.imglib2.iterator.IntervalIterator
net.imglib2.iterator.ZeroMinIntervalIterator
- All Implemented Interfaces:
Dimensions, EuclideanSpace, Interval, Iterator, Localizable, RealInterval, RealLocalizable
Use this class to iterate a virtual rectangular
Interval whose
min coordinates are at 0n in flat order, that
is: row by row, plane by plane, cube by cube, ... This is useful for
iterating an arbitrary interval in a defined order. For that, connect a
ZeroMinIntervalIterator to a Positionable.
...
ZeroMinIntervalIterator i = new ZeroMinIntervalIterator(image);
RandomAccess<T> s = image.randomAccess();
while (i.hasNext()) {
i.fwd();
s.setPosition(i);
s.type().performOperation(...);
...
}
...
Note that ZeroMinIntervalIterator is the right choice in situations
where not for each pixel you want to localize and/or set the
Positionable [Sampler], that is in a sparse sampling
situation. For localizing at each iteration step (as in the simplified
example above), use LocalizingZeroMinIntervalIterator instead.-
Field Summary
Fields inherited from class IntervalIterator
dimensions, index, lastIndex, stepsFields inherited from class AbstractInterval
max, minFields inherited from class AbstractEuclideanSpace
n -
Constructor Summary
ConstructorsConstructorDescriptionZeroMinIntervalIterator(long[] dimensions) ZeroMinIntervalIterator(Interval interval) -
Method Summary
Modifier and TypeMethodDescriptionfinal doublegetDoublePosition(int d) Return the current position in a given dimension.final floatgetFloatPosition(int d) Return the current position in a given dimension.final intgetIntPosition(int d) Return the current position in a given dimension.final longgetLongPosition(int d) Return the current position in a given dimension.final voidlocalize(double[] position) Write the current position into the passed array.final voidlocalize(float[] position) Write the current position into the passed array.final voidlocalize(int[] position) Write the current position into the passed array.final voidlocalize(long[] position) Write the current position into the passed array.Methods inherited from class IntervalIterator
create, dimension, dimensions, fwd, getIndex, hasNext, jumpFwd, reset, toStringMethods inherited from class AbstractInterval
max, max, max, min, min, min, realMax, realMax, realMax, realMin, realMin, realMinMethods inherited from class AbstractEuclideanSpace
numDimensionsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Dimensions
dimensions, dimensionsAsLongArray, dimensionsAsPointMethods inherited from interface EuclideanSpace
numDimensionsMethods inherited from interface Interval
maxAsLongArray, maxAsPoint, minAsLongArray, minAsPointMethods inherited from interface Localizable
localize, localize, positionAsLongArray, positionAsPointMethods inherited from interface RealInterval
maxAsDoubleArray, maxAsRealPoint, minAsDoubleArray, minAsRealPointMethods inherited from interface RealLocalizable
positionAsDoubleArray, positionAsRealPoint
-
Constructor Details
-
ZeroMinIntervalIterator
public ZeroMinIntervalIterator(long[] dimensions) -
ZeroMinIntervalIterator
-
-
Method Details
-
getLongPosition
public final long getLongPosition(int d) Description copied from interface:LocalizableReturn the current position in a given dimension.- Specified by:
getLongPositionin interfaceLocalizable- Overrides:
getLongPositionin classIntervalIterator- Parameters:
d- dimension- Returns:
- dimension of current position
-
localize
public final void localize(long[] position) Description copied from interface:LocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceLocalizable- Overrides:
localizein classIntervalIterator- Parameters:
position- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
getIntPosition
public final int getIntPosition(int d) Description copied from interface:LocalizableReturn the current position in a given dimension.- Specified by:
getIntPositionin interfaceLocalizable- Overrides:
getIntPositionin classIntervalIterator- Parameters:
d- dimension- Returns:
- dimension of current position
-
localize
public final void localize(int[] position) Description copied from interface:LocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceLocalizable- Overrides:
localizein classIntervalIterator- Parameters:
position- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
getDoublePosition
public final double getDoublePosition(int d) Description copied from interface:RealLocalizableReturn the current position in a given dimension.- Specified by:
getDoublePositionin interfaceLocalizable- Specified by:
getDoublePositionin interfaceRealLocalizable- Overrides:
getDoublePositionin classIntervalIterator- Parameters:
d- dimension- Returns:
- dimension of current position
-
localize
public final void localize(double[] position) Description copied from interface:RealLocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceRealLocalizable- Overrides:
localizein classIntervalIterator- Parameters:
position- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
getFloatPosition
public final float getFloatPosition(int d) Description copied from interface:RealLocalizableReturn the current position in a given dimension.- Specified by:
getFloatPositionin interfaceLocalizable- Specified by:
getFloatPositionin interfaceRealLocalizable- Overrides:
getFloatPositionin classIntervalIterator- Parameters:
d- dimension- Returns:
- dimension of current position
-
localize
public final void localize(float[] position) Description copied from interface:RealLocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceRealLocalizable- Overrides:
localizein classIntervalIterator- Parameters:
position- receives current position, length must be ≥EuclideanSpace.numDimensions()
-