public abstract class AbstractNeighborhood<T> extends Object implements Positionable, IterableInterval<T>
Positionable
IterableInterval
that serves as a local
neighborhood, e.g. in filtering operation.
This particular class implements a movable nD domain, defined by a
span long[]
array. The span
array is such that the
bounding box of the neighborhood in dimension d
will be
2 x span[d] + 1
.
Modifier and Type | Field and Description |
---|---|
protected long[] |
center
The pixel coordinates of the center of this regions.
|
protected ExtendedRandomAccessibleInterval<T,RandomAccessibleInterval<T>> |
extendedSource |
protected int |
n |
protected OutOfBoundsFactory<T,RandomAccessibleInterval<T>> |
outOfBounds |
protected RandomAccessibleInterval<T> |
source |
protected long[] |
span
The span of this neighborhood, such that the size of the bounding box in
dimension
d will be 2 x span[d] + 1 . |
Constructor and Description |
---|
AbstractNeighborhood(int numDims,
OutOfBoundsFactory<T,RandomAccessibleInterval<T>> outOfBounds) |
Modifier and Type | Method and Description |
---|---|
void |
bck(int d)
Move by -1 in one dimension.
|
abstract AbstractNeighborhood<T> |
copy()
Copies the
AbstractNeighborhood . |
long |
dimension(int d)
Default implementation of
Dimensions.dimension(int) . |
void |
dimensions(long[] dimensions)
Write the number of pixels in each dimension into long[].
|
T |
firstElement()
Return the element at the top-left corner of this nD neighborhood.
|
void |
fwd(int d)
Move by 1 in one dimension.
|
Object |
iterationOrder()
Returns the iteration order of this
IterableRealInterval . |
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.
|
int |
numDimensions()
Gets the space's number of dimensions.
|
void |
realMax(double[] max)
Write the maximum of each dimension into double[].
|
double |
realMax(int d)
Get the maximum in dimension d.
|
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)
Get the minimum in dimension d.
|
void |
realMin(RealPositionable min)
Sets a
RealPositionable to the minimum of this Interval |
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 |
setSpan(long[] span)
Set the span of this neighborhood.
|
void |
updateSource(RandomAccessibleInterval<T> source)
Updates the source.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cursor, localizingCursor
size
forEach, iterator, spliterator
maxAsLongArray, maxAsPoint, minAsLongArray, minAsPoint
maxAsDoubleArray, maxAsRealPoint, minAsDoubleArray, minAsRealPoint
allPositive, allPositive, dimensions, dimensionsAsLongArray, dimensionsAsPoint, verify, verify, verifyAllPositive, verifyAllPositive
protected final long[] center
protected final long[] span
d
will be 2 x span[d] + 1
.protected ExtendedRandomAccessibleInterval<T,RandomAccessibleInterval<T>> extendedSource
protected RandomAccessibleInterval<T> source
protected OutOfBoundsFactory<T,RandomAccessibleInterval<T>> outOfBounds
protected int n
public AbstractNeighborhood(int numDims, OutOfBoundsFactory<T,RandomAccessibleInterval<T>> outOfBounds)
public void setSpan(long[] span)
The neighborhood span is such that the size of the neighborhood in
dimension d
will be 2 x span[d] + 1
.
span
- this array content will be copied to the neighborhood internal
field.public int numDimensions()
EuclideanSpace
numDimensions
in interface EuclideanSpace
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[] position)
Positionable
setPosition
in interface Positionable
position
- absolute position, length must be ≥
EuclideanSpace.numDimensions()
public void setPosition(long[] position)
Positionable
setPosition
in interface Positionable
position
- absolute position, length must be ≥
EuclideanSpace.numDimensions()
public void setPosition(int position, int d)
Positionable
setPosition
in interface Positionable
position
- absolute position in dimension dd
- dimensionpublic void setPosition(long position, int d)
Positionable
setPosition
in interface Positionable
position
- absolute position in dimension dd
- dimensionpublic T firstElement()
firstElement
in interface IterableRealInterval<T>
public Object iterationOrder()
IterableRealInterval
IterableRealInterval
. 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<T>
IterableRealInterval
.FlatIterationOrder
public double realMin(int d)
RealInterval
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)
RealInterval
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
public void updateSource(RandomAccessibleInterval<T> source)
public abstract AbstractNeighborhood<T> copy()
AbstractNeighborhood
.Copyright © 2015–2022 ImgLib2. All rights reserved.