Package qupath.lib.gui.viewer
Class PathObjectPainter
java.lang.Object
qupath.lib.gui.viewer.PathObjectPainter
Static methods to assist with painting PathObjects.
- Author:
- Pete Bankhead
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stroke
getCachedStroke
(double thickness) Get aBasicStroke
with the specified thickness.static void
paintConnections
(PathObjectConnections connections, PathObjectHierarchy hierarchy, Graphics2D g2d, Color color, double downsampleFactor, ImagePlane plane) Paint connections between objects (e.g.static void
paintHandles
(List<Point2> handles, Graphics2D g2d, double minHandleSize, double maxHandleSize, Color colorStroke, Color colorFill) Paint the handles onto a Graphics object, if we have a suitable (non-point) ROI.static void
paintHandles
(RoiEditor roiEditor, Graphics2D g2d, double minHandleSize, double maxHandleSize, Color colorStroke, Color colorFill) Paint the handles onto a Graphics object, if we have a suitable (non-point) ROI.static boolean
paintObject
(PathObject pathObject, Graphics2D g, OverlayOptions overlayOptions, PathObjectSelectionModel selectionModel, double downsample) Paint an object (or, more precisely, its ROI).static void
paintShape
(Shape shape, Graphics2D g2d, Color colorStroke, Stroke stroke, Color colorFill) Paint the specified shape with specified stroke and fill colors.static void
paintSpecifiedObjects
(Graphics2D g2d, Collection<? extends PathObject> pathObjects, OverlayOptions overlayOptions, PathObjectSelectionModel selectionModel, double downsample) Paint the specified objects.static void
paintTMAGrid
(Graphics2D g2d, TMAGrid tmaGrid, OverlayOptions overlayOptions, PathObjectSelectionModel selectionModel, double downsample) Paint the specified tissue microarray grid.
-
Method Details
-
paintSpecifiedObjects
public static void paintSpecifiedObjects(Graphics2D g2d, Collection<? extends PathObject> pathObjects, OverlayOptions overlayOptions, PathObjectSelectionModel selectionModel, double downsample) Paint the specified objects.- Parameters:
g2d
- the graphics object on which the objects should be paintedpathObjects
- the objects to paintoverlayOptions
- the overlay options defining how objects should be paintedselectionModel
- the selection model used to determine the selection status of each objectdownsample
- the downsample factor; this should already be applied to the graphics object, but is needed to determine some line thicknesses
-
paintTMAGrid
public static void paintTMAGrid(Graphics2D g2d, TMAGrid tmaGrid, OverlayOptions overlayOptions, PathObjectSelectionModel selectionModel, double downsample) Paint the specified tissue microarray grid.- Parameters:
g2d
- the graphics object on which the objects should be paintedtmaGrid
- the TMA gridoverlayOptions
- the overlay options defining how objects should be paintedselectionModel
- the selection model used to determine the selection status of each objectdownsample
- the downsample factor; this should already be applied to the graphics object, but is needed to determine some line thicknesses
-
paintObject
public static boolean paintObject(PathObject pathObject, Graphics2D g, OverlayOptions overlayOptions, PathObjectSelectionModel selectionModel, double downsample) Paint an object (or, more precisely, its ROI). This is subject to the OverlayOptions, and therefore may not actually end up painting anything (if the settings are such that objects of the class provided are not to be displayed)- Parameters:
pathObject
-g
-overlayOptions
-selectionModel
-downsample
-- Returns:
- true if anything was painted, false otherwise
-
paintShape
public static void paintShape(Shape shape, Graphics2D g2d, Color colorStroke, Stroke stroke, Color colorFill) Paint the specified shape with specified stroke and fill colors.- Parameters:
shape
- shape to paintg2d
- graphics objectcolorStroke
- stroke color (may be null)stroke
- stroke (may be null)colorFill
- fill color (may be null)
-
getCachedStroke
Get aBasicStroke
with the specified thickness.- Parameters:
thickness
-- Returns:
-
paintHandles
public static void paintHandles(RoiEditor roiEditor, Graphics2D g2d, double minHandleSize, double maxHandleSize, Color colorStroke, Color colorFill) Paint the handles onto a Graphics object, if we have a suitable (non-point) ROI.The minimum and maximum handle size can be specified; if the same, all handles will have the same size. If different, then the distance between consecutive handles will be used to influence the actual handle size. This is helpful when handles are densely packed.
- Parameters:
roiEditor
-g2d
-minHandleSize
-maxHandleSize
-colorStroke
-colorFill
-
-
paintHandles
public static void paintHandles(List<Point2> handles, Graphics2D g2d, double minHandleSize, double maxHandleSize, Color colorStroke, Color colorFill) Paint the handles onto a Graphics object, if we have a suitable (non-point) ROI.The minimum and maximum handle size can be specified; if the same, all handles will have the same size. If different, then the distance between consecutive handles will be used to influence the actual handle size. This is helpful when handles are densely packed.
- Parameters:
handles
-g2d
-minHandleSize
-maxHandleSize
-colorStroke
-colorFill
-
-
paintConnections
public static void paintConnections(PathObjectConnections connections, PathObjectHierarchy hierarchy, Graphics2D g2d, Color color, double downsampleFactor, ImagePlane plane) Paint connections between objects (e.g. from Delaunay triangulation).- Parameters:
connections
-hierarchy
-g2d
-color
-downsampleFactor
-plane
-
-