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.-
Field Summary
FieldsFields inherited from class IntervalIterator
dimensions, index, lastIndex, stepsFields inherited from class AbstractInterval
max, minFields inherited from class 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 IntervalIterator
create, dimension, dimensions, getIndex, hasNext, toStringMethods inherited from class AbstractInterval
max, max, max, min, min, min, realMax, realMax, realMax, realMin, realMin, realMinMethods inherited from class AbstractEuclideanSpace
numDimensionsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Dimensions
dimensions, dimensionsAsLongArray, dimensionsAsPointMethods inherited from interface EuclideanSpace
numDimensionsMethods inherited from interface Interval
maxAsLongArray, maxAsPoint, minAsLongArray, minAsPointMethods inherited from interface Localizable
localize, localize, positionAsLongArray, positionAsPointMethods inherited from interface RealInterval
maxAsDoubleArray, maxAsRealPoint, minAsDoubleArray, minAsRealPointMethods inherited from interface RealLocalizable
positionAsDoubleArray, positionAsRealPoint
-
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.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
-
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
-