Package qupath.lib.analysis
Class DelaunayTools.Subdivision
java.lang.Object
qupath.lib.analysis.DelaunayTools.Subdivision
- Enclosing class:
DelaunayTools
Helper class for extracting information from a Delaunay triangulation computed from PathObjects.
-
Method Summary
Modifier and TypeMethodDescriptionGet a list of neighbors for all objects.getClusters
(BiPredicate<PathObject, PathObject> predicate) Get clusters of connected objects, where connections are made between neighboring objects that meet the specified predicate.getFilteredNeighbors
(BiPredicate<PathObject, PathObject> predicate) Get a list of neighbors for all objects, filtering out objects that do not meet specified criteria.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.Get theImagePlane
for this subdivision.getNearestNeighbor
(PathObject pathObject) Get the nearest neighbor for the specified object.getNearestNeighbor
(PathObject pathObject, BiPredicate<PathObject, PathObject> predicate) Get the nearest neighbor for the specified object, filtered by a predicate.getNeighbors
(PathObject pathObject) Get all neighbors for a specified object.Get all the objects associated with this subdivision.getObjectsForRegion
(ImageRegion region) Get objects with edges that may intersect a specific region.Deprecated.Get a map of Voronoi faces as JTSGeometry
objects.getVoronoiROIs
(Geometry clip) Get a map of Voronoi faces, converted toROI
objects.boolean
isEmpty()
Query if the subdivision is empty, i.e.int
size()
Get the number of objects in this subdivision.
-
Method Details
-
getImagePlane
Get theImagePlane
for this subdivision. Because the subdivision is 2D, all object ROIs are expected to belong to the same plane.- Returns:
-
getVoronoiFaces
Get a map of Voronoi faces as JTSGeometry
objects.- Returns:
- See Also:
-
getVoronoiROIs
Get a map of Voronoi faces, converted toROI
objects.- Parameters:
clip
- optional region used to clip the total extent of the ROIs- Returns:
- See Also:
-
getPathObjects
Deprecated.v0.6.0 usegetObjects()
instead.Get all the objects associated with this subdivision.- Returns:
-
getObjects
Get all the objects associated with this subdivision.- Returns:
-
getObjectsForRegion
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
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 requestedpredicate
- 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 requestedpredicate
- predicate that determines if two objects may be considered neighbors- Returns:
- list of neighbors
-
getNeighbors
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
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
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
-
getObjects()
instead.