Package net.imglib2

Class KDTree<T>

    • Constructor Detail

      • KDTree

        public KDTree​(java.util.List<T> values,
                      java.util.List<L> positions)
        Construct a KDTree from the elements in the given list.

        Note that the constructor can be called with the same list for both values == positions if T extends RealLocalizable.

        Parameters:
        values - a list of values
        positions - a list of positions corresponding to the values
      • KDTree

        public KDTree​(IterableRealInterval<T> interval)
        Construct a KDTree from the elements of the given IterableRealInterval.
        Parameters:
        interval - elements in the tree are obtained by iterating this
      • KDTree

        public KDTree​(int numPoints,
                      java.lang.Iterable<T> values,
                      java.lang.Iterable<L> positions)
    • Method Detail

      • treeData

        public KDTreeData<T> treeData()
        Access to underlying data for serialization.
      • impl

        public KDTreeImpl impl()
        Access to pure coordinate kD Tree implementation.
      • verifySize

        private static int verifySize​(java.util.List<?> values,
                                      java.util.List<?> positions)
      • getRoot

        @Deprecated
        public KDTreeNode<T> getRoot()
        Deprecated.
        KDTreeNode is now a re-usable proxy (like NativeType). To work with existing code, KDTreeNode.left(), KDTreeNode.right(), getRoot() etc create new objects in each call, instead of re-using existing proxies. Code using that should be rewritten to reuse proxies, if possible.
        Get the root node.
        Returns:
        the root node.
      • getType

        public T getType()
        Description copied from interface: IterableRealInterval
        Get an instance of T.

        It should not be assumed that the returned T instance is an independent copy. In particular, repeated calls to getType() may return the same instance.

        The default implementation returns IterableRealInterval.firstElement(). Derived classes may choose different implementations for improved performance.

        Specified by:
        getType in interface IterableRealInterval<T>
        Specified by:
        getType in interface Typed<T>
        Returns:
        an instance of T
      • realMin

        public double realMin​(int d)
        Description copied from interface: RealInterval
        Get the minimum in dimension d.
        Specified by:
        realMin in interface RealInterval
        Parameters:
        d - dimension
        Returns:
        minimum in dimension d.
      • realMax

        public double realMax​(int d)
        Description copied from interface: RealInterval
        Get the maximum in dimension d.
        Specified by:
        realMax in interface RealInterval
        Parameters:
        d - dimension
        Returns:
        maximum in dimension d.
      • cursor

        public KDTree.KDTreeCursor cursor()
        Description copied from interface: IterableRealInterval

        Returns a RealCursor that iterates with optimal speed without calculating the location at each iteration step. Localization is performed on demand.

        Use this where localization is required rarely/ not for each iteration.

        Specified by:
        cursor in interface IterableRealInterval<T>
        Returns:
        fast iterating iterator
      • iterationOrder

        public java.lang.Object iterationOrder()
        Description copied from interface: IterableRealInterval
        Returns the iteration order of this 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.
        Specified by:
        iterationOrder in interface IterableRealInterval<T>
        Returns:
        the iteration order of this IterableRealInterval.
        See Also:
        FlatIterationOrder
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toString

        private java.lang.String toString​(int node,
                                          java.lang.String indent,
                                          KDTreeNode<T> ref)