public class IterableLine extends AbstractInterval implements IterableInterval<Void>
The cursors generated by the IterableInterval will iterate exactly
once over all the integer locations on a line between in proper order from
the specified start to the specified end points, included.
Two lines are considered equal iff their starting points and ending points
are at to the same locations. This is reflected in the
equals(Object), hashCode() and iterationOrder()
methods.
This implementation uses floating-point logic instead of the pure integer logic of Bresenham line (Wikipedia) but the results are quasi identical and the performance penalty small.
max, minn| Constructor and Description |
|---|
IterableLine(Localizable start,
Localizable end)
Instantiates a new line that goes from start to end points.
|
| Modifier and Type | Method and Description |
|---|---|
Cursor<Void> |
cursor()
Returns a
RealCursor that iterates with optimal speed without
calculating the location at each iteration step. |
boolean |
equals(Object o) |
Void |
firstElement()
Get the first element of this
IterableRealInterval. |
int |
hashCode() |
Object |
iterationOrder()
Returns the iteration order of this
IterableRealInterval. |
Iterator<Void> |
iterator() |
Cursor<Void> |
localizingCursor()
Returns a
RealLocalizable Iterator that calculates its
location at each iteration step. |
long |
size()
Returns the number of elements in this
Function. |
dimension, dimensions, max, max, max, min, min, min, realMax, realMax, realMax, realMin, realMin, realMin, toStringnumDimensionsclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratordimension, max, max, max, maxAsLongArray, maxAsPoint, min, min, min, minAsLongArray, minAsPoint, realMax, realMinmaxAsDoubleArray, maxAsRealPoint, minAsDoubleArray, minAsRealPoint, realMax, realMax, realMin, realMinallPositive, allPositive, dimensions, dimensions, dimensionsAsLongArray, dimensionsAsPoint, verify, verify, verifyAllPositive, verifyAllPositivenumDimensionspublic IterableLine(Localizable start, Localizable end)
start - the location of the start point.end - the location of the end point.public long size()
IterableRealInterval
Returns the number of elements in this Function.
size in interface IterableRealInterval<Void>public Void firstElement()
IterableRealIntervalIterableRealInterval. This is a
shortcut for cursor().next().
This can be used to create a new variable of type T using
firstElement().createVariable(), which is useful in generic
methods to store temporary results, e.g., a running sum over pixels in
the IterableRealInterval.firstElement in interface IterableRealInterval<Void>public Object iterationOrder()
IterableRealIntervalIterableRealInterval. If the
returned object equals (Object.equals(Object)) the iteration
order of another IterableRealInterval f then they can be
copied by synchronous iteration. That is, having an Iterator on
this and another Iterator on f, moving both in synchrony
will point both of them to corresponding locations in their source
domain. In other words, this and f have the same iteration order
and means and the same number of elements.iterationOrder in interface IterableRealInterval<Void>IterableRealInterval.FlatIterationOrderpublic Cursor<Void> cursor()
IterableRealInterval
Returns a RealCursor that iterates with optimal speed without
calculating the location at each iteration step. Localization is
performed on demand.
Use this where localization is required rarely/ not for each iteration.
cursor in interface IterableInterval<Void>cursor in interface IterableRealInterval<Void>public Cursor<Void> localizingCursor()
IterableRealInterval
Returns a RealLocalizable Iterator that calculates its
location at each iteration step. That is, localization is performed with
optimal speed.
Use this where localization is required often/ for each iteration.
localizingCursor in interface IterableInterval<Void>localizingCursor in interface IterableRealInterval<Void>Copyright © 2015–2022 ImgLib2. All rights reserved.