Class DelaunayTools.Subdivision

java.lang.Object
qupath.lib.analysis.DelaunayTools.Subdivision
Enclosing class:
DelaunayTools

public static class DelaunayTools.Subdivision extends Object
Helper class for extracting information from a Delaunay triangulation computed from PathObjects.
  • Method Details

    • getImagePlane

      public ImagePlane getImagePlane()
      Get the ImagePlane for this subdivision. Because the subdivision is 2D, all object ROIs are expected to belong to the same plane.
      Returns:
    • getVoronoiFaces

      public Map<PathObject,Geometry> getVoronoiFaces()
      Get a map of Voronoi faces as JTS Geometry objects.
      Returns:
      See Also:
    • getVoronoiROIs

      public Map<PathObject,ROI> getVoronoiROIs(Geometry clip)
      Get a map of Voronoi faces, converted to ROI objects.
      Parameters:
      clip - optional region used to clip the total extent of the ROIs
      Returns:
      See Also:
    • getPathObjects

      @Deprecated public Collection<PathObject> getPathObjects()
      Deprecated.
      v0.6.0 use getObjects() instead.
      Get all the objects associated with this subdivision.
      Returns:
    • getObjects

      public Collection<PathObject> getObjects()
      Get all the objects associated with this subdivision.
      Returns:
    • getObjectsForRegion

      public Collection<PathObject> getObjectsForRegion(ImageRegion region)
      Get objects with edges that may intersect a specific region.

      This is especially useful for requesting objects that should be considered when drawing edges for a specific region, where the objects themselves don't need to fall within the region - but their edge might.

      The method should return all objects that have an edge that intersects the region, but it may also return additional objects that are not strictly necessary for drawing the region.

      Parameters:
      region -
      Returns:
    • getNearestNeighbor

      public PathObject getNearestNeighbor(PathObject pathObject)
      Get the nearest neighbor for the specified object.
      Parameters:
      pathObject - the object whose neighbor is requested
      Returns:
      the nearest neighbor, or null if no neighbor can be found
    • getNearestNeighbor

      public PathObject getNearestNeighbor(PathObject pathObject, BiPredicate<PathObject,PathObject> predicate)
      Get the nearest neighbor for the specified object, filtered by a predicate.
      Parameters:
      pathObject - the object whose neighbor is requested
      predicate - predicate used to establish weather two objects may be considered neighbors
      Returns:
      the nearest neighbor, or null if no neighbor can be found
    • getFilteredNeighbors

      public List<PathObject> getFilteredNeighbors(PathObject pathObject, BiPredicate<PathObject,PathObject> predicate)
      Get a list of neighbors for a specified object, filtering out objects that do not meet specified criteria.
      Parameters:
      pathObject - object for which the neighbors are requested
      predicate - predicate that determines if two objects may be considered neighbors
      Returns:
      list of neighbors
    • getNeighbors

      public List<PathObject> getNeighbors(PathObject pathObject)
      Get all neighbors for a specified object.
      Parameters:
      pathObject - object for which neighbors are requested
      Returns:
      list of neighbors
    • getFilteredNeighbors

      public Map<PathObject,List<PathObject>> getFilteredNeighbors(BiPredicate<PathObject,PathObject> predicate)
      Get a list of neighbors for all objects, filtering out objects that do not meet specified criteria. The filter may be used, for example, to impose a distance or classification threshold.
      Parameters:
      predicate - predicate that determines if two objects may be considered neighbors
      Returns:
      map in which keys correspond to objects and values represent all corresponding (filtered) neighbors
    • getAllNeighbors

      public Map<PathObject,List<PathObject>> getAllNeighbors()
      Get a list of neighbors for all objects.
      Returns:
      map in which keys correspond to objects and values represent all corresponding neighbors
    • isEmpty

      public boolean isEmpty()
      Query if the subdivision is empty, i.e. it contains no objects.
      Returns:
    • size

      public int size()
      Get the number of objects in this subdivision.
      Returns:
    • getClusters

      public List<Collection<PathObject>> getClusters(BiPredicate<PathObject,PathObject> predicate)
      Get clusters of connected objects, where connections are made between neighboring objects that meet the specified predicate.
      Parameters:
      predicate - predicate used to determine if two otherwise neighboring objects are considered connected
      Returns:
      a list of clusters, where each cluster is a collection of connected objects