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 virtualInterval
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 aLocalizingIntervalIterator
to aPositionable
.... LocalizingIntervalIterator i = new LocalizingIntervalIterator(image); RandomAccess<T> s = image.randomAccess(); while (i.hasNext()) { i.fwd(); s.setPosition(i); s.type().performOperation(...); ... } ...
LocalizingIntervalIterator
is 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), useIntervalIterator
instead.- Author:
- Stephan Preibisch, Stephan Saalfeld
-
-
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 void
fwd()
Move forward.double
getDoublePosition(int d)
Return the current position in a given dimension.float
getFloatPosition(int d)
Return the current position in a given dimension.int
getIntPosition(int d)
Return the current position in a given dimension.long
getLongPosition(int d)
Return the current position in a given dimension.void
jumpFwd(long i)
Move steps × forward.void
localize(double[] pos)
Write the current position into the passed array.void
localize(float[] pos)
Write the current position into the passed array.void
localize(int[] pos)
Write the current position into the passed array.void
localize(long[] pos)
Write the current position into the passed array.void
reset()
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.EuclideanSpace
numDimensions
-
-
-
-
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:Iterator
Move forward.- Specified by:
fwd
in interfaceIterator
- Overrides:
fwd
in classIntervalIterator
-
jumpFwd
public void jumpFwd(long i)
Description copied from interface:Iterator
Move steps × forward.- Specified by:
jumpFwd
in interfaceIterator
- Overrides:
jumpFwd
in classIntervalIterator
- Parameters:
i
- number of steps to move forward
-
reset
public void reset()
Description copied from interface:Iterator
Reset theIterator
, that is put it to where it would be if newly created.- Specified by:
reset
in interfaceIterator
- Overrides:
reset
in classIntervalIterator
-
localize
public void localize(float[] pos)
Description copied from interface:RealLocalizable
Write the current position into the passed array.- Specified by:
localize
in interfaceRealLocalizable
- Overrides:
localize
in classIntervalIterator
- Parameters:
pos
- receives current position
-
localize
public void localize(double[] pos)
Description copied from interface:RealLocalizable
Write the current position into the passed array.- Specified by:
localize
in interfaceRealLocalizable
- Overrides:
localize
in classIntervalIterator
- Parameters:
pos
- receives current position
-
localize
public void localize(int[] pos)
Description copied from interface:Localizable
Write the current position into the passed array.- Specified by:
localize
in interfaceLocalizable
- Overrides:
localize
in classIntervalIterator
- Parameters:
pos
- receives current position
-
localize
public void localize(long[] pos)
Description copied from interface:Localizable
Write the current position into the passed array.- Specified by:
localize
in interfaceLocalizable
- Overrides:
localize
in classIntervalIterator
- Parameters:
pos
- receives current position
-
getFloatPosition
public 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
-
getDoublePosition
public 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
-
getIntPosition
public 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
-
getLongPosition
public 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
-
-