Package qupath.lib.roi
Class ShapeSimplifier
java.lang.Object
qupath.lib.roi.ShapeSimplifier
Helper methods for simplifying shapes, such removing polygon points while retaining the a similar overall
shape at a coarser level.
This can help manage storage and performance requirements when working with large numbers of ROIs, especially in terms of repainting speed.
- Author:
- Pete Bankhead
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Path2D
simplifyPath
(Path2D path, double altitudeThreshold) Create a simplified path (fewer coordinates) using method based on Visvalingam's Algorithm.static PolygonROI
simplifyPolygon
(PolygonROI polygon, double altitudeThreshold) Create a simplified polygon (fewer coordinates) using method based on Visvalingam's Algorithm.static void
simplifyPolygonPoints
(List<Point2> points, double altitudeThreshold) Create a simplified polygon (fewer coordinates) using method based on Visvalingam's Algorithm.static ROI
simplifyShape
(ROI shapeROI, double altitudeThreshold) Create a simplified shape (fewer coordinates) using method based on Visvalingam's Algorithm.smoothPoints
(List<Point2> points) Apply a simple 3-point moving average to a list of points.
-
Constructor Details
-
ShapeSimplifier
public ShapeSimplifier()
-
-
Method Details
-
simplifyPolygonPoints
Create a simplified polygon (fewer coordinates) using method based on Visvalingam's Algorithm. The input is a list of points (the vertices) belonging to a closed polygon. This list is modified in place.See references: https://hydra.hull.ac.uk/resources/hull:8338 https://www.jasondavies.com/simplify/ http://bost.ocks.org/mike/simplify/
- Parameters:
points
-altitudeThreshold
-
-
simplifyPolygon
Create a simplified polygon (fewer coordinates) using method based on Visvalingam's Algorithm.See references: https://hydra.hull.ac.uk/resources/hull:8338 https://www.jasondavies.com/simplify/ http://bost.ocks.org/mike/simplify/
- Parameters:
polygon
-altitudeThreshold
-- Returns:
-
simplifyShape
Create a simplified shape (fewer coordinates) using method based on Visvalingam's Algorithm.See references: https://hydra.hull.ac.uk/resources/hull:8338 https://www.jasondavies.com/simplify/ http://bost.ocks.org/mike/simplify/
- Parameters:
shapeROI
-altitudeThreshold
-- Returns:
-
simplifyPath
Create a simplified path (fewer coordinates) using method based on Visvalingam's Algorithm.See references: https://hydra.hull.ac.uk/resources/hull:8338 https://www.jasondavies.com/simplify/ http://bost.ocks.org/mike/simplify/
- Parameters:
path
-altitudeThreshold
-- Returns:
-
smoothPoints
Apply a simple 3-point moving average to a list of points.- Parameters:
points
-- Returns:
-