public class LocalizingIntervalIterator extends IntervalIterator
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.Modifier and Type | Field and Description |
---|---|
protected long[] |
position |
dimensions, index, lastIndex, steps
max, min
n
Constructor and Description |
---|
LocalizingIntervalIterator(int[] dimensions) |
LocalizingIntervalIterator(int[] min,
int[] max) |
LocalizingIntervalIterator(Interval interval) |
LocalizingIntervalIterator(long[] dimensions) |
LocalizingIntervalIterator(long[] min,
long[] max) |
Modifier and Type | Method and 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 the
Iterator , that is put it to where it would be if newly
created. |
create, dimension, dimensions, getIndex, hasNext, toString
max, max, max, min, min, min, realMax, realMax, realMax, realMin, realMin, realMin
numDimensions
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
localize, positionAsLongArray, positionAsPoint
localize, positionAsDoubleArray, positionAsRealPoint
numDimensions
maxAsLongArray, maxAsPoint, minAsLongArray, minAsPoint
maxAsDoubleArray, maxAsRealPoint, minAsDoubleArray, minAsRealPoint
allPositive, allPositive, dimensions, dimensionsAsLongArray, dimensionsAsPoint, verify, verify, verifyAllPositive, verifyAllPositive
public LocalizingIntervalIterator(long[] dimensions)
public LocalizingIntervalIterator(int[] dimensions)
public LocalizingIntervalIterator(long[] min, long[] max)
public LocalizingIntervalIterator(int[] min, int[] max)
public LocalizingIntervalIterator(Interval interval)
public void fwd()
Iterator
fwd
in interface Iterator
fwd
in class IntervalIterator
public void jumpFwd(long i)
Iterator
jumpFwd
in interface Iterator
jumpFwd
in class IntervalIterator
i
- number of steps to move forwardpublic void reset()
Iterator
Iterator
, that is put it to where it would be if newly
created.reset
in interface Iterator
reset
in class IntervalIterator
public void localize(float[] pos)
RealLocalizable
localize
in interface RealLocalizable
localize
in class IntervalIterator
pos
- receives current positionpublic void localize(double[] pos)
RealLocalizable
localize
in interface RealLocalizable
localize
in class IntervalIterator
pos
- receives current positionpublic void localize(int[] pos)
Localizable
localize
in interface Localizable
localize
in class IntervalIterator
pos
- receives current positionpublic void localize(long[] pos)
Localizable
localize
in interface Localizable
localize
in class IntervalIterator
pos
- receives current positionpublic float getFloatPosition(int d)
RealLocalizable
getFloatPosition
in interface Localizable
getFloatPosition
in interface RealLocalizable
getFloatPosition
in class IntervalIterator
d
- dimensionpublic double getDoublePosition(int d)
RealLocalizable
getDoublePosition
in interface Localizable
getDoublePosition
in interface RealLocalizable
getDoublePosition
in class IntervalIterator
d
- dimensionpublic int getIntPosition(int d)
Localizable
getIntPosition
in interface Localizable
getIntPosition
in class IntervalIterator
d
- dimensionpublic long getLongPosition(int d)
Localizable
getLongPosition
in interface Localizable
getLongPosition
in class IntervalIterator
d
- dimensionCopyright © 2015–2022 ImgLib2. All rights reserved.