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
Use this class to iterate a virtual
Interval 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
LocalizingIntervalIterator to a Positionable.
...
LocalizingIntervalIterator i = new LocalizingIntervalIterator(image);
RandomAccess<T> s = image.randomAccess();
while (i.hasNext()) {
i.fwd();
s.setPosition(i);
s.type().performOperation(...);
...
}
...
Note that LocalizingIntervalIterator is the right choice in
situations where, for each pixel, you want to localize and/or set
the RandomAccess, that is, in a dense sampling situation. For
localizing sparsely (e.g. under an external condition), use
IntervalIterator instead.- Author:
- Stephan Preibisch, Stephan Saalfeld
-
Field Summary
FieldsFields 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
ConstructorsConstructorDescriptionLocalizingIntervalIterator(int[] dimensions) LocalizingIntervalIterator(int[] min, int[] max) LocalizingIntervalIterator(long[] dimensions) LocalizingIntervalIterator(long[] min, long[] max) LocalizingIntervalIterator(Interval interval) -
Method Summary
Modifier and TypeMethodDescriptionvoidfwd()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, 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
-
Field Details
-
position
protected final long[] position
-
-
Constructor Details
-
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
-
-
Method Details
-
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.- 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
-
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
-
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
-
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
-
getFloatPosition
public 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
-
getDoublePosition
public 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
-
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
-