public class KNearestNeighborSearchOnIterableRealInterval<T> extends Object implements KNearestNeighborSearch<T>
IterableRealInterval
implemented as linear search.| Modifier and Type | Field and Description |
|---|---|
protected RealCursor<T>[] |
elements |
protected IterableRealInterval<T> |
iterable |
protected int |
k |
protected int |
n |
protected double[] |
referenceLocation |
protected double[] |
squareDistances |
| Constructor and Description |
|---|
KNearestNeighborSearchOnIterableRealInterval(IterableRealInterval<T> iterable,
int k) |
| Modifier and Type | Method and Description |
|---|---|
KNearestNeighborSearchOnIterableRealInterval<T> |
copy()
Create a copy.
|
double |
getDistance()
Access the Euclidean distance between the reference location as used for
the last search and the nearest neighbor, ordered by square Euclidean
distance.
|
double |
getDistance(int i)
Access the Euclidean distance between the reference location as used for
the last search and the ith nearest neighbor, ordered
by square Euclidean distance.
|
int |
getK()
Get the of k nearest neighbor points used in this search
|
RealLocalizable |
getPosition()
Access the position of the nearest neighbor, ordered by square Euclidean
distance.
|
RealLocalizable |
getPosition(int i)
Access the position of the ith nearest neighbor,
ordered by square Euclidean distance.
|
Sampler<T> |
getSampler()
Access the data of the nearest neighbor.
|
RealCursor<T> |
getSampler(int i)
Access the data of the ith nearest neighbor, ordered
by square Euclidean distance.
|
double |
getSquareDistance()
Access the square Euclidean distance between the reference location as
used for the last search and the nearest neighbor, ordered by square
Euclidean distance.
|
double |
getSquareDistance(int i)
Access the square Euclidean distance between the reference location as
used for the last search and the ith nearest
neighbor, ordered by square Euclidean distance.
|
int |
numDimensions()
Gets the space's number of dimensions.
|
void |
search(RealLocalizable reference)
Perform k-nearest-neighbor search for a reference coordinate.
|
protected double |
squareDistance(RealLocalizable query)
Calculate the square Euclidean distance of a query location to the
location stored in referenceLocation.
|
protected final IterableRealInterval<T> iterable
protected final int k
protected final int n
protected final RealCursor<T>[] elements
protected final double[] squareDistances
protected final double[] referenceLocation
public KNearestNeighborSearchOnIterableRealInterval(IterableRealInterval<T> iterable, int k)
protected final double squareDistance(RealLocalizable query)
public int numDimensions()
EuclideanSpacenumDimensions in interface EuclideanSpacepublic int getK()
KNearestNeighborSearchgetK in interface KNearestNeighborSearch<T>public void search(RealLocalizable reference)
KNearestNeighborSearchsearch in interface KNearestNeighborSearch<T>search in interface NearestNeighborSearch<T>public RealLocalizable getPosition(int i)
KNearestNeighborSearchgetPosition in interface KNearestNeighborSearch<T>public RealCursor<T> getSampler(int i)
KNearestNeighborSearchSampler
that guarantees write access if the underlying data set is writable.getSampler in interface KNearestNeighborSearch<T>public double getSquareDistance(int i)
KNearestNeighborSearchgetSquareDistance in interface KNearestNeighborSearch<T>public double getDistance(int i)
KNearestNeighborSearchgetDistance in interface KNearestNeighborSearch<T>public RealLocalizable getPosition()
NearestNeighborSearchgetPosition in interface NearestNeighborSearch<T>public Sampler<T> getSampler()
NearestNeighborSearchSampler that guarantees write access if the underlying data set
is writable.getSampler in interface NearestNeighborSearch<T>public double getSquareDistance()
NearestNeighborSearchgetSquareDistance in interface NearestNeighborSearch<T>public double getDistance()
NearestNeighborSearchgetDistance in interface NearestNeighborSearch<T>public KNearestNeighborSearchOnIterableRealInterval<T> copy()
KNearestNeighborSearchcopy in interface KNearestNeighborSearch<T>copy in interface NearestNeighborSearch<T>Copyright © 2015–2022 ImgLib2. All rights reserved.