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
public class ZeroMinIntervalIterator extends IntervalIterator
Use this class to iterate a virtual rectangularIntervalwhose 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 aZeroMinIntervalIteratorto aPositionable.
Note that... ZeroMinIntervalIterator i = new ZeroMinIntervalIterator(image); RandomAccess<T> s = image.randomAccess(); while (i.hasNext()) { i.fwd(); s.setPosition(i); s.type().performOperation(...); ... } ...ZeroMinIntervalIteratoris the right choice in situations where not for each pixel you want to localize and/or set thePositionable[Sampler], that is in a sparse sampling situation. For localizing at each iteration step (as in the simplified example above), useLocalizingZeroMinIntervalIteratorinstead.
-
-
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
Constructors Constructor Description ZeroMinIntervalIterator(long[] dimensions)ZeroMinIntervalIterator(Interval interval)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetDoublePosition(int d)Return the current position in a given dimension.floatgetFloatPosition(int d)Return the current position in a given dimension.intgetIntPosition(int d)Return the current position in a given dimension.longgetLongPosition(int d)Return the current position in a given dimension.voidlocalize(double[] position)Write the current position into the passed array.voidlocalize(float[] position)Write the current position into the passed array.voidlocalize(int[] position)Write the current position into the passed array.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, 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.Dimensions
dimensions, dimensionsAsLongArray, dimensionsAsPoint
-
Methods inherited from interface net.imglib2.EuclideanSpace
numDimensions
-
Methods inherited from interface net.imglib2.Interval
maxAsLongArray, maxAsPoint, minAsLongArray, minAsPoint
-
Methods inherited from interface net.imglib2.Localizable
localize, localize, positionAsLongArray, positionAsPoint
-
Methods inherited from interface net.imglib2.RealInterval
maxAsDoubleArray, maxAsRealPoint, minAsDoubleArray, minAsRealPoint
-
Methods inherited from interface net.imglib2.RealLocalizable
positionAsDoubleArray, positionAsRealPoint
-
-
-
-
Constructor Detail
-
ZeroMinIntervalIterator
public ZeroMinIntervalIterator(long[] dimensions)
-
ZeroMinIntervalIterator
public ZeroMinIntervalIterator(Interval interval)
-
-
Method Detail
-
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()
-
-