Package net.imglib2.iterator
Class LocalizingIntervalIterator
- java.lang.Object
-
- net.imglib2.AbstractEuclideanSpace
-
- net.imglib2.AbstractInterval
-
- net.imglib2.iterator.IntervalIterator
-
- net.imglib2.iterator.LocalizingIntervalIterator
-
- All Implemented Interfaces:
Dimensions,EuclideanSpace,Interval,Iterator,Localizable,RealInterval,RealLocalizable
- Direct Known Subclasses:
LocalizingZeroMinIntervalIterator,NtreeCursor,OffsetableLocalizingIntervalIterator
public class LocalizingIntervalIterator extends IntervalIterator
Use this class to iterate a virtualIntervalin 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 aLocalizingIntervalIteratorto aPositionable.
Note that... LocalizingIntervalIterator i = new LocalizingIntervalIterator(image); RandomAccess<T> s = image.randomAccess(); while (i.hasNext()) { i.fwd(); s.setPosition(i); s.type().performOperation(...); ... } ...LocalizingIntervalIteratoris the right choice in situations where, for each pixel, you want to localize and/or set theRandomAccess, that is, in a dense sampling situation. For localizing sparsely (e.g. under an external condition), useIntervalIteratorinstead.
-
-
Field Summary
Fields Modifier and Type Field Description protected long[]position-
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 LocalizingIntervalIterator(int[] dimensions)LocalizingIntervalIterator(int[] min, int[] max)LocalizingIntervalIterator(long[] dimensions)LocalizingIntervalIterator(long[] min, long[] max)LocalizingIntervalIterator(Interval interval)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfwd()Move forward.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.voidjumpFwd(long i)Move steps × forward.voidlocalize(double[] pos)Write the current position into the passed array.voidlocalize(float[] pos)Write the current position into the passed array.voidlocalize(int[] pos)Write the current position into the passed array.voidlocalize(long[] pos)Write the current position into the passed array.voidreset()Reset theIterator, that is put it to where it would be if newly created.-
Methods inherited from class net.imglib2.iterator.IntervalIterator
create, dimension, dimensions, getIndex, hasNext, 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
-
LocalizingIntervalIterator
public LocalizingIntervalIterator(long[] dimensions)
-
LocalizingIntervalIterator
public LocalizingIntervalIterator(int[] dimensions)
-
LocalizingIntervalIterator
public LocalizingIntervalIterator(long[] min, long[] max)
-
LocalizingIntervalIterator
public LocalizingIntervalIterator(int[] min, int[] max)
-
LocalizingIntervalIterator
public LocalizingIntervalIterator(Interval interval)
-
-
Method Detail
-
fwd
public void fwd()
Description copied from interface:IteratorMove forward.- Specified by:
fwdin interfaceIterator- Overrides:
fwdin classIntervalIterator
-
jumpFwd
public void jumpFwd(long i)
Description copied from interface:IteratorMove steps × forward.Highly recommended to override this with a more efficient version.
- Specified by:
jumpFwdin interfaceIterator- Overrides:
jumpFwdin classIntervalIterator- Parameters:
i- number of steps to move forward
-
reset
public void reset()
Description copied from interface:IteratorReset theIterator, that is put it to where it would be if newly created.- Specified by:
resetin interfaceIterator- Overrides:
resetin classIntervalIterator
-
localize
public void localize(float[] pos)
Description copied from interface:RealLocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceRealLocalizable- Overrides:
localizein classIntervalIterator- Parameters:
pos- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
localize
public void localize(double[] pos)
Description copied from interface:RealLocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceRealLocalizable- Overrides:
localizein classIntervalIterator- Parameters:
pos- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
localize
public void localize(int[] pos)
Description copied from interface:LocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceLocalizable- Overrides:
localizein classIntervalIterator- Parameters:
pos- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
localize
public void localize(long[] pos)
Description copied from interface:LocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceLocalizable- Overrides:
localizein classIntervalIterator- Parameters:
pos- 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 interfaceLocalizable- Specified by:
getFloatPositionin interfaceRealLocalizable- Overrides:
getFloatPositionin classIntervalIterator- 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 interfaceLocalizable- Specified by:
getDoublePositionin interfaceRealLocalizable- Overrides:
getDoublePositionin classIntervalIterator- Parameters:
d- dimension- Returns:
- dimension of current position
-
getIntPosition
public 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
-
getLongPosition
public 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
-
-