Package qupath.lib.gui.viewer.overlays
Class PixelClassificationOverlay
java.lang.Object
qupath.lib.gui.viewer.overlays.AbstractOverlay
qupath.lib.gui.viewer.overlays.AbstractImageOverlay
qupath.lib.gui.viewer.overlays.PixelClassificationOverlay
- All Implemented Interfaces:
- PathOverlay
PathOverlay that gives the results of pixel classification.- 
Property SummaryPropertiesProperties inherited from class qupath.lib.gui.viewer.overlays.AbstractImageOverlayinterpolation
- 
Nested Class SummaryNested classes/interfaces inherited from class qupath.lib.gui.viewer.overlays.AbstractOverlayAbstractOverlay.LocationStringFunction
- 
Method SummaryModifier and TypeMethodDescriptionvoidClear any cached tiles.static PixelClassificationOverlaycreate(OverlayOptions options, Function<ImageData<BufferedImage>, ImageServer<BufferedImage>> fun, ImageRenderer renderer) Create an overlay to display a live image that can be created from an existingImageData.static PixelClassificationOverlaycreate(OverlayOptions options, Map<ImageData<BufferedImage>, ImageServer<BufferedImage>> map, ImageRenderer renderer) Create an overlay to display a live image that can be created from an existingImageData.static PixelClassificationOverlaycreate(OverlayOptions options, PixelClassifier classifier) Create an overlay to display the live application of aPixelClassifierto an image, using the default number of parallel threads for classification.static PixelClassificationOverlaycreate(OverlayOptions options, PixelClassifier classifier, int nThreads) Create an overlay to display the live application of aPixelClassifierto an image.static PixelClassificationOverlaycreateFeatureDisplayOverlay(OverlayOptions options, Function<ImageData<BufferedImage>, ImageServer<BufferedImage>> fun, ImageRenderer renderer) Deprecated.static StringgetDefaultLocationString(ImageServer<BufferedImage> server, double x, double y, int z, int t) Default method for getting a location string from anImageServerusing cached tiles.booleanQuery whether live prediction is turned on.getLocationString(ImageData<BufferedImage> imageData, double x, double y, int z, int t) Get a location string to display when showing a specified image.intGet the maximum number of threads that may be used during live prediction.getPixelClassificationServer(ImageData<BufferedImage> imageData) Get theImageServerthat would be used by this overlay for the specifiedImageData.Get theImageRendererused with this overlay, which may be null.voidpaintOverlay(Graphics2D g2d, ImageRegion imageRegion, double downsampleFactor, ImageData<BufferedImage> imageData, boolean paintCompletely) Paint the overlay to a graphics object.Get theImageRendererproperty used with this overlay.voidsetLivePrediction(boolean livePrediction) Turn on or off live prediction.voidsetMaxThreads(int nThreads) Set the maximum number of threads that may be used during live prediction.voidsetRenderer(ImageRenderer renderer) Set theImageRendererto be used with this overlay.voidstop()Stop the overlap, halting any pending tile requests.Methods inherited from class qupath.lib.gui.viewer.overlays.AbstractImageOverlaygetInterpolation, interpolationProperty, setInterpolation, setInterpolationMethods inherited from class qupath.lib.gui.viewer.overlays.AbstractOverlaygetAlphaComposite, getLocationStringFunction, getOpacity, getOverlayOptions, getPreferredOverlayColor, isVisible, setAlphaComposite, setLocationStringFunction, setOpacity, setPreferredOverlayColor
- 
Property Details- 
rendererGet theImageRendererproperty used with this overlay.- See Also:
 
 
- 
- 
Method Details- 
createCreate an overlay to display the live application of aPixelClassifierto an image, using the default number of parallel threads for classification.- Parameters:
- options- the options controlling the overlay display
- classifier- the classifier
- Returns:
 
- 
createpublic static PixelClassificationOverlay create(OverlayOptions options, PixelClassifier classifier, int nThreads) Create an overlay to display the live application of aPixelClassifierto an image.- Parameters:
- options- the options controlling the overlay display
- classifier- the classifier
- nThreads- number of parallel threads to use for classification (will be clipped to 1 or greater)
- Returns:
 
- 
createpublic static PixelClassificationOverlay create(OverlayOptions options, Function<ImageData<BufferedImage>, ImageServer<BufferedImage>> fun, ImageRenderer renderer) Create an overlay to display a live image that can be created from an existingImageData.- Parameters:
- options- options to control the overlay display
- fun- function to create an- ImageServerfrom the- ImageData. Note that the server generated by the function call will be cached. If it is necessary to control the caching, this needs to be done externally and- create(OverlayOptions, Map, ImageRenderer)should be used instead.
- renderer- rendered used to create an RGB image
- Returns:
- the PixelClassificationOverlay
 
- 
createpublic static PixelClassificationOverlay create(OverlayOptions options, Map<ImageData<BufferedImage>, ImageServer<BufferedImage>> map, ImageRenderer renderer) Create an overlay to display a live image that can be created from an existingImageData. This differs fromcreate(OverlayOptions, Function, ImageRenderer)in that a cached map of classifier servers is used directly.- Parameters:
- options- options to control the overlay display
- map- map to obtain an- ImageServerfrom an- ImageData
- renderer- rendered used to create an RGB image
- Returns:
- the PixelClassificationOverlay
 
- 
createFeatureDisplayOverlay@Deprecated public static PixelClassificationOverlay createFeatureDisplayOverlay(OverlayOptions options, Function<ImageData<BufferedImage>, ImageServer<BufferedImage>> fun, ImageRenderer renderer) Deprecated.Usecreate(OverlayOptions, Function, ImageRenderer)instead.Create an overlay to display a live image that can be created from an existingImageData.- Parameters:
- options- options to control the overlay display
- fun- function to create an- ImageServerfrom the- ImageData
- renderer- rendered used to create an RGB image
- Returns:
- the PixelClassificationOverlay
 
- 
rendererPropertyGet theImageRendererproperty used with this overlay.- Returns:
- See Also:
 
- 
getRendererGet theImageRendererused with this overlay, which may be null.- Returns:
 
- 
setMaxThreadspublic void setMaxThreads(int nThreads) Set the maximum number of threads that may be used during live prediction.- Parameters:
- nThreads-
 
- 
getMaxThreadspublic int getMaxThreads()Get the maximum number of threads that may be used during live prediction.- Returns:
 
- 
setRendererSet theImageRendererto be used with this overlay.- Parameters:
- renderer-
 
- 
getLivePredictionpublic boolean getLivePrediction()Query whether live prediction is turned on.- Returns:
 
- 
setLivePredictionpublic void setLivePrediction(boolean livePrediction) Turn on or off live prediction. This requests tile classifications as the overlay is being viewed.- Parameters:
- livePrediction-
 
- 
getPixelClassificationServerGet theImageServerthat would be used by this overlay for the specifiedImageData. Note that the servers are cached internally.- Parameters:
- imageData-
- 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.
 
- 
clearCachepublic void clearCache()Clear any cached tiles.
- 
stoppublic void stop()Stop the overlap, halting any pending tile requests.
- 
getLocationStringpublic String getLocationString(ImageData<BufferedImage> imageData, double x, double y, int z, int t) Description copied from interface:PathOverlayGet a location string to display when showing a specified image.The default implementation returns null. If subclasses override this method, they must return quickly, as it may be used to determine text to display as the mouse moves over an image. - Specified by:
- getLocationStringin interface- PathOverlay
- Overrides:
- getLocationStringin class- AbstractOverlay
- Parameters:
- imageData-
- x- x-coordinate, in the image space (not the viewer component space)
- y- y-coordinate, in the image space (not the viewer component space)
- z- z-index for the region currently being viewed
- t- t-index for the region currently being viewed
- Returns:
 
- 
getDefaultLocationStringpublic static String getDefaultLocationString(ImageServer<BufferedImage> server, double x, double y, int z, int t) Default method for getting a location string from anImageServerusing cached tiles. If tiles are not cached, no string is returned.May be used by classes implementing PathOverlay.getLocationString(ImageData, double, double, int, int)- Parameters:
- server-
- x-
- y-
- z-
- t-
- Returns:
- location String based upon pixel values and cached tiles, or null if no String is available
 
 
- 
create(OverlayOptions, Function, ImageRenderer)instead.