public class EllipseCursor<T> extends Object implements Cursor<T>
Each point of the ellipse is iterated exactly once, and there is no "hole" in the ellipse. A bitmap excerpt from such a ellipse looks like this:
.......... OOO....... ...OO..... .....O.... .....O....
The circle generated with equal X and Y radii is not strictly equivalent to
the circle generated by the CircleCursor.
| Constructor and Description |
|---|
EllipseCursor(RandomAccessible<T> rai,
Localizable center,
long radiusX,
long radiusY)
Iterates over a Bresenham ellipse in the target
RandomAccessible. |
EllipseCursor(RandomAccessible<T> rai,
Localizable center,
long radiusX,
long radiusY,
int dimX,
int dimY)
Iterates over a Bresenham ellipse in the target
RandomAccessible. |
| Modifier and Type | Method and Description |
|---|---|
Sampler<T> |
copy() |
Cursor<T> |
copyCursor() |
void |
fwd()
Move forward.
|
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 |
reset()
Reset the
Iterator, that is put it to where it would be if newly
created. |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEachRemaining, removelocalize, positionAsLongArray, positionAsPointlocalize, positionAsDoubleArray, positionAsRealPointpublic EllipseCursor(RandomAccessible<T> rai, Localizable center, long radiusX, long radiusY)
RandomAccessible.
Each point of the ellipse is iterated exactly once, and there is no
"hole" in the ellipse. The ellipse is written in a plane in dimensions 0
and 1.rai - the random accessible. It is the caller responsibility to
ensure it can be accessed everywhere the ellipse will be
iterated.center - the ellipse center. Must be at least of dimension 2.
Dimensions 0 and 1 are used to specify the ellipse center.radiusX - the ellipse radius in the dimension 0.radiusY - the ellipse radius in the dimension 1.public EllipseCursor(RandomAccessible<T> rai, Localizable center, long radiusX, long radiusY, int dimX, int dimY)
RandomAccessible.
Each point of the ellipse is iterated exactly once, and there is no
"hole" in the ellipse.rai - the random accessible. It is the caller responsibility to
ensure it can be accessed everywhere the ellipse will be
iterated.center - the ellipse center. Must be at least of dimension 2.
Dimensions 0 and 1 are used to specify the ellipse center.radiusX - the ellipse radius in dimension X.radiusY - the ellipse radius in dimension Y.dimX - the first dimension of the plane in which to draw the ellipse.dimY - the second dimension of the plane in which to draw the
ellipse.public void reset()
IteratorIterator, that is put it to where it would be if newly
created.public void fwd()
Iteratorpublic boolean hasNext()
Iteratorpublic 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 T get()
SamplerSampler points at.public Sampler<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 void jumpFwd(long steps)
Iteratorsteps - number of steps to move forwardpublic void localize(int[] position)
Localizablelocalize in interface Localizableposition - receives current positionpublic void localize(long[] position)
Localizablelocalize in interface Localizableposition - receives current positionpublic int getIntPosition(int d)
LocalizablegetIntPosition in interface Localizabled - dimensionpublic long getLongPosition(int d)
LocalizablegetLongPosition in interface Localizabled - dimensionpublic Cursor<T> copyCursor()
copyCursor in interface Cursor<T>copyCursor in interface RealCursor<T>Copyright © 2015–2022 ImgLib2. All rights reserved.