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, steps
Fields inherited from class net.imglib2.AbstractInterval
max, min
Fields inherited from class net.imglib2.AbstractEuclideanSpace
n
-
Constructor Summary
ConstructorsConstructorDescriptionZeroMinIntervalIterator
(long[] dimensions) ZeroMinIntervalIterator
(Interval interval) -
Method Summary
Modifier and TypeMethodDescriptionfinal double
getDoublePosition
(int d) Return the current position in a given dimension.final float
getFloatPosition
(int d) Return the current position in a given dimension.final int
getIntPosition
(int d) Return the current position in a given dimension.final long
getLongPosition
(int d) Return the current position in a given dimension.final void
localize
(double[] position) Write the current position into the passed array.final void
localize
(float[] position) Write the current position into the passed array.final void
localize
(int[] position) Write the current position into the passed array.final void
localize
(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, toString
Methods inherited from class net.imglib2.AbstractInterval
max, max, max, min, min, min, realMax, realMax, realMax, realMin, realMin, realMin
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
-
Constructor Details
-
ZeroMinIntervalIterator
public ZeroMinIntervalIterator(long[] dimensions) -
ZeroMinIntervalIterator
-
-
Method Details
-
getLongPosition
public final long getLongPosition(int d) Description copied from interface:Localizable
Return the current position in a given dimension.- Specified by:
getLongPosition
in interfaceLocalizable
- Overrides:
getLongPosition
in classIntervalIterator
- Parameters:
d
- dimension- Returns:
- dimension of current position
-
localize
public final void localize(long[] position) Description copied from interface:Localizable
Write the current position into the passed array.- Specified by:
localize
in interfaceLocalizable
- Overrides:
localize
in classIntervalIterator
- Parameters:
position
- receives current position
-
getIntPosition
public final int getIntPosition(int d) Description copied from interface:Localizable
Return the current position in a given dimension.- Specified by:
getIntPosition
in interfaceLocalizable
- Overrides:
getIntPosition
in classIntervalIterator
- Parameters:
d
- dimension- Returns:
- dimension of current position
-
localize
public final void localize(int[] position) Description copied from interface:Localizable
Write the current position into the passed array.- Specified by:
localize
in interfaceLocalizable
- Overrides:
localize
in classIntervalIterator
- Parameters:
position
- receives current position
-
getDoublePosition
public final double getDoublePosition(int d) Description copied from interface:RealLocalizable
Return the current position in a given dimension.- Specified by:
getDoublePosition
in interfaceRealLocalizable
- Overrides:
getDoublePosition
in classIntervalIterator
- Parameters:
d
- dimension- Returns:
- dimension of current position
-
localize
public final void localize(double[] position) Description copied from interface:RealLocalizable
Write the current position into the passed array.- Specified by:
localize
in interfaceRealLocalizable
- Overrides:
localize
in classIntervalIterator
- Parameters:
position
- receives current position
-
getFloatPosition
public final float getFloatPosition(int d) Description copied from interface:RealLocalizable
Return the current position in a given dimension.- Specified by:
getFloatPosition
in interfaceRealLocalizable
- Overrides:
getFloatPosition
in classIntervalIterator
- Parameters:
d
- dimension- Returns:
- dimension of current position
-
localize
public final void localize(float[] position) Description copied from interface:RealLocalizable
Write the current position into the passed array.- Specified by:
localize
in interfaceRealLocalizable
- Overrides:
localize
in classIntervalIterator
- Parameters:
position
- receives current position
-