T - public class BresenhamLine<T> extends Object implements Cursor<T>
This implementation uses eager initialization: all the coordinates along the
line are calculated at once when the reset(Localizable, Localizable)
method is called.
Adapted from the Bresenham3D class in VIB-lib by Johannes
Schindelin.
| Constructor and Description |
|---|
BresenhamLine(RandomAccess<T> ra,
Localizable P1,
Localizable P2) |
BresenhamLine(RandomAccessible<T> source) |
BresenhamLine(RandomAccessible<T> source,
Localizable P1,
Localizable P2) |
| Modifier and Type | Method and Description |
|---|---|
BresenhamLine<T> |
copy() |
BresenhamLine<T> |
copyCursor() |
void |
fwd()
Move forward.
|
static ArrayList<long[]> |
generateCoords(Localizable start,
Localizable end) |
T |
get()
Access the actual T instance providing access to a pixel,
sub-pixel or integral region value the
Sampler points at. |
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.
|
boolean |
hasNext()
Returns true if another step forward is possible.
|
void |
jumpFwd(long steps)
Move steps × forward.
|
void |
localize(double[] position)
Write the current position into the passed array.
|
void |
localize(float[] position)
Write the current position into the passed array.
|
void |
localize(int[] position)
Write the current position into the passed array.
|
void |
localize(long[] position)
Write the current position into the passed array.
|
T |
next() |
int |
numDimensions()
Gets the space's number of dimensions.
|
void |
remove() |
void |
reset()
Reset the
Iterator, that is put it to where it would be if newly
created. |
void |
reset(Localizable P1,
Localizable P2) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemaininglocalize, positionAsLongArray, positionAsPointlocalize, positionAsDoubleArray, positionAsRealPointpublic BresenhamLine(RandomAccessible<T> source)
public BresenhamLine(RandomAccessible<T> source, Localizable P1, Localizable P2)
public BresenhamLine(RandomAccess<T> ra, Localizable P1, Localizable P2)
public void reset(Localizable P1, Localizable P2)
public T get()
SamplerSampler points at.public void fwd()
Iteratorpublic void reset()
IteratorIterator, that is put it to where it would be if newly
created.public boolean hasNext()
Iteratorpublic void localize(long[] position)
Localizablelocalize in interface Localizableposition - receives current positionpublic long getLongPosition(int d)
LocalizablegetLongPosition in interface Localizabled - dimensionpublic BresenhamLine<T> copy()
copy in interface Sampler<T>Sampler in the same state accessing the same
values.
It does NOT copy T, just the state of the Sampler.
Otherwise use T.copy() if available.
Sampler.copy().get() == Sampler.get(), i.e. both hold the same
value, not necessarily the same instance (this is the case for an
ArrayCursor for example)public BresenhamLine<T> copyCursor()
copyCursor in interface Cursor<T>copyCursor in interface RealCursor<T>public void localize(float[] position)
RealLocalizablelocalize in interface RealLocalizableposition - receives current positionpublic void localize(double[] position)
RealLocalizablelocalize in interface RealLocalizableposition - receives current positionpublic float getFloatPosition(int d)
RealLocalizablegetFloatPosition in interface LocalizablegetFloatPosition in interface RealLocalizabled - dimensionpublic double getDoublePosition(int d)
RealLocalizablegetDoublePosition in interface LocalizablegetDoublePosition in interface RealLocalizabled - dimensionpublic int numDimensions()
EuclideanSpacenumDimensions in interface EuclideanSpacepublic void jumpFwd(long steps)
Iteratorsteps - number of steps to move forwardpublic void localize(int[] position)
Localizablelocalize in interface Localizableposition - receives current positionpublic int getIntPosition(int d)
LocalizablegetIntPosition in interface Localizabled - dimensionpublic static final ArrayList<long[]> generateCoords(Localizable start, Localizable end)
Copyright © 2015–2022 ImgLib2. All rights reserved.