public class RealPointSample<T> extends AbstractRealLocalizable implements RealRandomAccess<T>
RealRandomAccess that can be used
to combine a real location and a sample value, e.g. as output of a
FunctionRealRandomAccessible.| Modifier and Type | Field and Description |
|---|---|
protected Supplier<T> |
sampleSupplier |
positionn| Modifier | Constructor and Description |
|---|---|
|
RealPointSample(Supplier<T> sampleSupplier,
double... position)
Create a point at a definite location in a space of the dimensionality of
the position.
|
protected |
RealPointSample(Supplier<T> sampleSupplier,
double[] position,
boolean copyPosition)
Protected constructor that can re-use the passed position array.
|
|
RealPointSample(Supplier<T> sampleSupplier,
float... position)
Create a point at a definite location in a space of the dimensionality of
the position.
|
|
RealPointSample(Supplier<T> sampleSupplier,
int n)
Create a point in nDimensional space initialized to 0,0,...
|
|
RealPointSample(Supplier<T> sampleSupplier,
RealLocalizable localizable)
Create a point using the position and dimensionality of a
RealLocalizable |
| Modifier and Type | Method and Description |
|---|---|
void |
bck(int d)
Move by -1 in one dimension.
|
RealPointSample<T> |
copy() |
boolean |
equals(Object obj) |
void |
fwd(int d)
Move by 1 in one dimension.
|
T |
get()
Access the actual T instance providing access to a pixel,
sub-pixel or integral region value the
Sampler points at. |
int |
hashCode() |
void |
move(double[] distance)
Move the element relative to its current location using a float[] as
distance vector.
|
void |
move(double distance,
int d)
Move the element in one dimension for some distance.
|
void |
move(float[] distance)
Move the element relative to its current location using a float[] as
distance vector.
|
void |
move(float distance,
int d)
Move the element in one dimension for some distance.
|
void |
move(int[] distance)
Move the element relative to its current location using an int[] as
distance vector.
|
void |
move(int distance,
int d)
Move the element in one dimension for some distance.
|
void |
move(Localizable localizable)
Move the element relative to its current location using an
Localizable as distance vector. |
void |
move(long[] distance)
Move the element relative to its current location using a long[] as
distance vector.
|
void |
move(long distance,
int d)
Move the element in one dimension for some distance.
|
void |
move(RealLocalizable localizable)
Move the element relative to its current location using a
RealLocalizable as distance vector. |
void |
setPosition(double[] position)
Set the position of the element.
|
void |
setPosition(double position,
int d)
Set the position of the element for one dimension.
|
void |
setPosition(float[] position)
Set the position of the element.
|
void |
setPosition(float position,
int d)
Set the position of the element for one dimension.
|
void |
setPosition(int[] position)
Set the position of the element.
|
void |
setPosition(int position,
int d)
Set the position of the element for one dimension.
|
void |
setPosition(Localizable localizable)
Place the element at the same location as a given
Localizable |
void |
setPosition(long[] position)
Set the position of the element.
|
void |
setPosition(long position,
int d)
Set the position of the element for one dimension.
|
void |
setPosition(RealLocalizable localizable)
Place the element at the same location as a given
RealLocalizable |
String |
toString() |
static <T> RealPointSample<T> |
wrap(T sample,
double[] position)
Create a
RealPointSample that carries the provided sample and
stores its coordinates in the provided position array. |
static <T> RealPointSample<T> |
wrapSupplier(Supplier<T> sampleSupplier,
double[] position)
Create a
RealPointSample that carries the provided sample and
stores its coordinates in the provided position array. |
getDoublePosition, getFloatPosition, localize, localizenumDimensionsclone, finalize, getClass, notify, notifyAll, wait, wait, waitcopyRealRandomAccess, setPositionAndGet, setPositionAndGet, setPositionAndGetgetDoublePosition, getFloatPosition, localize, localize, localize, positionAsDoubleArray, positionAsRealPointnumDimensionsprotected RealPointSample(Supplier<T> sampleSupplier, double[] position, boolean copyPosition)
sampleSupplier - position - array used to store the position.copyPosition - flag indicating whether position array should be duplicated.public RealPointSample(Supplier<T> sampleSupplier, int n)
n - number of dimensions of the spacepublic RealPointSample(Supplier<T> sampleSupplier, double... position)
position - the initial position. The length of the array determines the
dimensionality of the space.public RealPointSample(Supplier<T> sampleSupplier, float... position)
position - the initial position. The length of the array determines the
dimensionality of the space.public RealPointSample(Supplier<T> sampleSupplier, RealLocalizable localizable)
RealLocalizablelocalizable - the initial position. Its dimensionality determines the
dimensionality of the space.public void fwd(int d)
Positionablefwd in interface Positionabled - dimensionpublic void bck(int d)
Positionablebck in interface Positionabled - dimensionpublic void move(int distance,
int d)
Positionablemove in interface Positionabledistance - relative offset in dimension dd - dimensionpublic void move(long distance,
int d)
Positionablemove in interface Positionabledistance - relative offset in dimension dd - dimensionpublic void move(Localizable localizable)
PositionableLocalizable as distance vector.move in interface Positionablelocalizable - relative offset, EuclideanSpace.numDimensions() must be
≥ EuclideanSpace.numDimensions()public void move(int[] distance)
Positionablemove in interface Positionabledistance - relative offset, length must be ≥ EuclideanSpace.numDimensions()public void move(long[] distance)
Positionablemove in interface Positionabledistance - relative offset, length must be ≥ EuclideanSpace.numDimensions()public void setPosition(Localizable localizable)
PositionableLocalizablesetPosition in interface Positionablelocalizable - absolute position, EuclideanSpace.numDimensions() must be
≥ EuclideanSpace.numDimensions()public void setPosition(int[] position)
PositionablesetPosition in interface Positionableposition - absolute position, length must be ≥
EuclideanSpace.numDimensions()public void setPosition(long[] position)
PositionablesetPosition in interface Positionableposition - absolute position, length must be ≥
EuclideanSpace.numDimensions()public void setPosition(int position,
int d)
PositionablesetPosition in interface Positionableposition - absolute position in dimension dd - dimensionpublic void setPosition(long position,
int d)
PositionablesetPosition in interface Positionableposition - absolute position in dimension dd - dimensionpublic void move(float distance,
int d)
RealPositionablemove in interface RealPositionablepublic void move(double distance,
int d)
RealPositionablemove in interface RealPositionablepublic void move(RealLocalizable localizable)
RealPositionableRealLocalizable as distance vector.move in interface RealPositionablelocalizable - relative offset, EuclideanSpace.numDimensions() must
be ≥ EuclideanSpace.numDimensions()public void move(float[] distance)
RealPositionablemove in interface RealPositionablepublic void move(double[] distance)
RealPositionablemove in interface RealPositionablepublic void setPosition(RealLocalizable localizable)
RealPositionableRealLocalizablesetPosition in interface RealPositionablelocalizable - absolute position, EuclideanSpace.numDimensions()
must be ≥ EuclideanSpace.numDimensions()public void setPosition(float[] position)
RealPositionablesetPosition in interface RealPositionableposition - absolute position, length must be ≥
EuclideanSpace.numDimensions()public void setPosition(double[] position)
RealPositionablesetPosition in interface RealPositionableposition - absolute position, length must be ≥
EuclideanSpace.numDimensions()public void setPosition(float position,
int d)
RealPositionablesetPosition in interface RealPositionablepublic void setPosition(double position,
int d)
RealPositionablesetPosition in interface RealPositionablepublic static <T> RealPointSample<T> wrap(T sample, double[] position)
RealPointSample that carries the provided sample and
stores its coordinates in the provided position array.
Note that making a copy() of the result will not make a copy of
the sample.sample - the re-usable sample instance that is used by this
PointSample (like Type)position - array to use for storing the position.public static <T> RealPointSample<T> wrapSupplier(Supplier<T> sampleSupplier, double[] position)
RealPointSample that carries the provided sample and
stores its coordinates in the provided position array.sampleSupplier - a supplier to create the sample instance (can be () -> t) for
instances that are re-used (like Type).position - array to use for storing the position.public T get()
SamplerSampler points at.public RealPointSample<T> copy()
copy in interface RealRandomAccess<T>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)Copyright © 2009–2022 ImgLib2. All rights reserved.