Package net.imglib2.iterator
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.- Author:
- Stephan Preibisch, Stephan Saalfeld
-
Field Summary
Fields inherited from class net.imglib2.iterator.IntervalIterator
dimensions, index, lastIndex, stepsFields inherited from class net.imglib2.AbstractInterval
max, minFields inherited from class net.imglib2.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 net.imglib2.iterator.IntervalIterator
create, dimension, dimensions, fwd, getIndex, hasNext, jumpFwd, reset, toStringMethods inherited from class net.imglib2.AbstractInterval
max, max, max, min, min, min, 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
numDimensions
-
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
-
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
-
getDoublePosition
public final double getDoublePosition(int d) Description copied from interface:RealLocalizableReturn the current position in a given dimension.- 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
-
getFloatPosition
public final float getFloatPosition(int d) Description copied from interface:RealLocalizableReturn the current position in a given dimension.- 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
-