Class PathObjectPainter

java.lang.Object
qupath.lib.gui.viewer.PathObjectPainter

public class PathObjectPainter extends Object
Static methods to assist with painting PathObjects.
Author:
Pete Bankhead
  • 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 painted
      pathObjects - the objects to paint
      overlayOptions - the overlay options defining how objects should be painted
      selectionModel - the selection model used to determine the selection status of each object
      downsample - 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 painted
      tmaGrid - the TMA grid
      overlayOptions - the overlay options defining how objects should be painted
      selectionModel - the selection model used to determine the selection status of each object
      downsample - 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 paint
      g2d - graphics object
      colorStroke - stroke color (may be null)
      stroke - stroke (may be null)
      colorFill - fill color (may be null)
    • getCachedStroke

      public static Stroke getCachedStroke(double thickness)
      Get a BasicStroke 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 -