public class PositionableInterval extends AbstractLocalizable implements Positionable, Interval
It is constructed with an initial source interval. After construction it has position 0, and interval bounds that are identical to the initial source interval.
If after that it is moved, both the position and interval bounds move.
Additionally, it is possible to move the origin()
, which is useful
for example to make the min corner or the center of the interval coincide
with the position.
Modifier and Type | Field and Description |
---|---|
protected long[] |
currentOffset |
protected long[] |
initialMax |
protected long[] |
initialMin |
position
n
Modifier | Constructor and Description |
---|---|
|
PositionableInterval(Interval initial) |
protected |
PositionableInterval(PositionableInterval other)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
bck(int d)
Move by -1 in one dimension.
|
long |
dimension(int d)
Default implementation of
Dimensions.dimension(int) . |
void |
dimensions(long[] dimensions)
Write the number of pixels in each dimension into long[].
|
void |
fwd(int d)
Move by 1 in one dimension.
|
long |
max(int d)
Get the maximum in dimension d.
|
void |
max(long[] max)
Write the maximum of each dimension into long[].
|
void |
max(Positionable max)
Sets a
Positionable to the maximum of this Interval |
long |
min(int d)
Get the minimum in dimension d.
|
void |
min(long[] min)
Write the minimum of each dimension into long[].
|
void |
min(Positionable min)
Sets a
Positionable to the minimum of this Interval |
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.
|
PositionableLocalizable |
origin()
Get the
Positionable , Localizable origin of this
interval. |
void |
realMax(double[] max)
Write the maximum of each dimension into double[].
|
double |
realMax(int d)
Default implementation of
RealInterval.realMax(int) . |
void |
realMax(RealPositionable max)
Sets a
RealPositionable to the maximum of this Interval |
void |
realMin(double[] min)
Write the minimum of each dimension into double[].
|
double |
realMin(int d)
Default implementation of
RealInterval.realMin(int) . |
void |
realMin(RealPositionable min)
Sets a
RealPositionable to the minimum of this Interval |
void |
setPosition(int[] pos)
Set the position of the element.
|
void |
setPosition(int pos,
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[] pos)
Set the position of the element.
|
void |
setPosition(long pos,
int d)
Set the position of the element for one dimension.
|
String |
toString() |
getDoublePosition, getFloatPosition, getIntPosition, getLongPosition, localize, localize, localize, localize
numDimensions
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
maxAsLongArray, maxAsPoint, minAsLongArray, minAsPoint
maxAsDoubleArray, maxAsRealPoint, minAsDoubleArray, minAsRealPoint
allPositive, allPositive, dimensions, dimensionsAsLongArray, dimensionsAsPoint, verify, verify, verifyAllPositive, verifyAllPositive
numDimensions
localize, positionAsLongArray, positionAsPoint
localize, positionAsDoubleArray, positionAsRealPoint
protected final long[] currentOffset
protected final long[] initialMin
protected final long[] initialMax
public PositionableInterval(Interval initial)
protected PositionableInterval(PositionableInterval other)
public PositionableLocalizable origin()
Positionable
, Localizable
origin of this
interval.
The origin is the relative offset of the position to the minimum. For
example if a positionable (bitmask) region is made from a BitType
image with a circular pattern, then it is more natural if the region
position refers to the center of the pattern instead of the upper left
corner of the BitType
image. This can be achieved by positioning
the origin.
Assume a region is created from a 9x9 bitmask. The region initially has
min=(0,0), max=(8,8), position=(0,0). Because both position and min are
(0,0), initially origin=(0,0). Now assume the origin is moved to the
center of the bitmask using
origin().setPosition(new int[]{4,4})
. After this,
min=(-4,-4), max=(4,4), position=(0,0), and origin=(4,4).
public void fwd(int d)
Positionable
fwd
in interface Positionable
d
- dimensionpublic void bck(int d)
Positionable
bck
in interface Positionable
d
- dimensionpublic void move(int distance, int d)
Positionable
move
in interface Positionable
distance
- relative offset in dimension dd
- dimensionpublic void move(long distance, int d)
Positionable
move
in interface Positionable
distance
- relative offset in dimension dd
- dimensionpublic void move(Localizable localizable)
Positionable
Localizable
as distance vector.move
in interface Positionable
localizable
- relative offset, EuclideanSpace.numDimensions()
must be
≥ EuclideanSpace.numDimensions()
public void move(int[] distance)
Positionable
move
in interface Positionable
distance
- relative offset, length must be ≥ EuclideanSpace.numDimensions()
public void move(long[] distance)
Positionable
move
in interface Positionable
distance
- relative offset, length must be ≥ EuclideanSpace.numDimensions()
public void setPosition(Localizable localizable)
Positionable
Localizable
setPosition
in interface Positionable
localizable
- absolute position, EuclideanSpace.numDimensions()
must be
≥ EuclideanSpace.numDimensions()
public void setPosition(int[] pos)
Positionable
setPosition
in interface Positionable
pos
- absolute position, length must be ≥
EuclideanSpace.numDimensions()
public void setPosition(long[] pos)
Positionable
setPosition
in interface Positionable
pos
- absolute position, length must be ≥
EuclideanSpace.numDimensions()
public void setPosition(int pos, int d)
Positionable
setPosition
in interface Positionable
pos
- absolute position in dimension dd
- dimensionpublic void setPosition(long pos, int d)
Positionable
setPosition
in interface Positionable
pos
- absolute position in dimension dd
- dimensionpublic double realMin(int d)
Interval
RealInterval.realMin(int)
.realMin
in interface Interval
realMin
in interface RealInterval
d
- dimensionpublic void realMin(double[] min)
RealInterval
realMin
in interface RealInterval
public void realMin(RealPositionable min)
RealInterval
RealPositionable
to the minimum of this Interval
realMin
in interface RealInterval
public double realMax(int d)
Interval
RealInterval.realMax(int)
.realMax
in interface Interval
realMax
in interface RealInterval
d
- dimensionpublic void realMax(double[] max)
RealInterval
realMax
in interface RealInterval
public void realMax(RealPositionable max)
RealInterval
RealPositionable
to the maximum of this Interval
realMax
in interface RealInterval
public long min(int d)
Interval
public void min(long[] min)
Interval
public void min(Positionable min)
Interval
Positionable
to the minimum of this Interval
public long max(int d)
Interval
public void max(long[] max)
Interval
public void max(Positionable max)
Interval
Positionable
to the maximum of this Interval
public void dimensions(long[] dimensions)
Dimensions
dimensions
in interface Dimensions
public long dimension(int d)
Interval
Dimensions.dimension(int)
.dimension
in interface Dimensions
dimension
in interface Interval
Copyright © 2015–2022 ImgLib2. All rights reserved.