Package qupath.lib.gui.viewer.overlays
Class BufferedImageOverlay
java.lang.Object
qupath.lib.gui.viewer.overlays.AbstractOverlay
qupath.lib.gui.viewer.overlays.AbstractImageOverlay
qupath.lib.gui.viewer.overlays.BufferedImageOverlay
- All Implemented Interfaces:
- ChangeListener<ImageData<BufferedImage>>,- PathOverlay
public class BufferedImageOverlay
extends AbstractImageOverlay
implements ChangeListener<ImageData<BufferedImage>>
An overlay used to display one or more 
BufferedImage objects on top of a primary image shown in a viewer.
 
 The scaling for the BufferedImage is determined by an associated ImageRegion.
- 
Property SummaryProperties inherited from class qupath.lib.gui.viewer.overlays.AbstractImageOverlayinterpolation
- 
Nested Class SummaryNested classes/interfaces inherited from class qupath.lib.gui.viewer.overlays.AbstractOverlayAbstractOverlay.LocationStringFunction
- 
Constructor SummaryConstructorsConstructorDescriptionBufferedImageOverlay(OverlayOptions options) Create an empty overlay without any images to display.BufferedImageOverlay(OverlayOptions options, Map<? extends ImageRegion, BufferedImage> regions) Create an overlay to display multiple image regions.BufferedImageOverlay(OverlayOptions options, ImageRegion region, BufferedImage img) Create an overlay to display one specified image region.BufferedImageOverlay(QuPathViewer viewer, BufferedImage img) Create an overlay to show an image rescaled to overlay the entire current image in the specified viewer.BufferedImageOverlay(QuPathViewer viewer, Map<ImageRegion, BufferedImage> map) Create an overlay to show an image rescaled to overlay the entire current image in the specified viewer.BufferedImageOverlay(QuPathViewer viewer, OverlayOptions options, Map<? extends ImageRegion, BufferedImage> regions) Create an overlay to display multiple image regions.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddAllRegions(ImageServer<BufferedImage> server, int level) Add all regions for a specific level of anImageServer.voidchanged(ObservableValue<? extends ImageData<BufferedImage>> observable, ImageData<BufferedImage> oldValue, ImageData<BufferedImage> newValue) Get an unmodifiableMapcontaining image regions to paint on this overlay.voidpaintOverlay(Graphics2D g2d, ImageRegion imageRegion, double downsampleFactor, ImageData<BufferedImage> imageData, boolean paintCompletely) Paint the overlay to a graphics object.voidsetColorModel(ColorModel colorModel) Optionally set a customColorModel.Methods inherited from class qupath.lib.gui.viewer.overlays.AbstractImageOverlaygetInterpolation, interpolationProperty, setInterpolation, setInterpolationMethods inherited from class qupath.lib.gui.viewer.overlays.AbstractOverlaygetAlphaComposite, getLocationString, getLocationStringFunction, getOpacity, getOverlayOptions, getPreferredOverlayColor, isVisible, setAlphaComposite, setLocationStringFunction, setOpacity, setPreferredOverlayColor
- 
Constructor Details- 
BufferedImageOverlayCreate an overlay to show an image rescaled to overlay the entire current image in the specified viewer.- Parameters:
- viewer-
- img-
 
- 
BufferedImageOverlayCreate an overlay to show an image rescaled to overlay the entire current image in the specified viewer.- Parameters:
- viewer-
- map-
 
- 
BufferedImageOverlayCreate an empty overlay without any images to display.- Parameters:
- options-
 
- 
BufferedImageOverlayCreate an overlay to display one specified image region.- Parameters:
- options-
- region-
- img-
 
- 
BufferedImageOverlaypublic BufferedImageOverlay(OverlayOptions options, Map<? extends ImageRegion, BufferedImage> regions) Create an overlay to display multiple image regions.- Parameters:
- options-
- regions-
 
- 
BufferedImageOverlaypublic BufferedImageOverlay(QuPathViewer viewer, OverlayOptions options, Map<? extends ImageRegion, BufferedImage> regions) Create an overlay to display multiple image regions.- Parameters:
- viewer-
- options-
- regions-
 
 
- 
- 
Method Details- 
addAllRegionsAdd all regions for a specific level of anImageServer. Note that this results in all regions being read immediately. Therefore it should only be used for 'small' images that can be held in main memory.- Parameters:
- server- the server whose tiles should be drawn on the overlay
- level- the level from which to request regions; for the highest available resolution, use 0
- Throws:
- IOException
 
- 
setColorModelOptionally set a customColorModel. This makes it possible to display theBufferedImagewith a different color model than its original model.- Parameters:
- colorModel-
 
- 
getColorModel- Returns:
- the custom color model, if any is found.
 
- 
changedpublic void changed(ObservableValue<? extends ImageData<BufferedImage>> observable, ImageData<BufferedImage> oldValue, ImageData<BufferedImage> newValue) - Specified by:
- changedin interface- ChangeListener<ImageData<BufferedImage>>
 
- 
getRegionMapGet an unmodifiableMapcontaining image regions to paint on this overlay.- Returns:
 
- 
paintOverlaypublic void paintOverlay(Graphics2D g2d, ImageRegion imageRegion, double downsampleFactor, ImageData<BufferedImage> imageData, boolean paintCompletely) Description copied from interface:PathOverlayPaint the overlay to a graphics object. The graphics object will have a transform applied to it, so the painting should make use of coordinates in the original image space.- Specified by:
- paintOverlayin interface- PathOverlay
- Overrides:
- paintOverlayin class- AbstractImageOverlay
- Parameters:
- g2d- Graphics2D object to which drawing should be performed. This should have any transform already applied to it.
- imageRegion- The maximum image region that should be shown.
- downsampleFactor- The downsample factor at which the overlay will be viewed. There is no need for rescaling according to this value since it has already been applied to the- Graphics2Das part of its- AffineTransform, however it may optionally be needed within the method e.g. to correct line thicknesses.
- imageData- the- ImageDataassociated with this overlay. If the overlay is being displayed on a viewer, this is the- ImageDataopen within the viewer. Not all overlays require this, and it may be null.
- paintCompletely- If true, the method is permitted to return without completely painting everything, for performance reasons.
 
 
-