Package qupath.lib.gui.images.servers
Class RenderedImageServer
java.lang.Object
qupath.lib.images.servers.AbstractImageServer<BufferedImage>
qupath.lib.images.servers.AbstractTileableImageServer
qupath.lib.gui.images.servers.RenderedImageServer
- All Implemented Interfaces:
AutoCloseable
,GeneratingImageServer<BufferedImage>
,ImageServer<BufferedImage>
public class RenderedImageServer
extends AbstractTileableImageServer
implements GeneratingImageServer<BufferedImage>
An ImageServer that can display a rendered image, with optional overlays.
This is intended for use when exporting 'flattened' RGB images.
- Author:
- Pete Bankhead
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder to create an ImageServer to display rendered images, with optional overlay layers. -
Method Summary
Modifier and TypeMethodDescriptionprotected BufferedImage
createDefaultRGBImage
(int width, int height) Create the default (blank) RGB image for this server.protected String
createID()
Create a unique ID for the server, which can be returned as the default value ofAbstractImageServer.getPath()
.static ImageServer
<BufferedImage> createRenderedServer
(QuPathViewer viewer) Create anImageServer
that returns tiles based on how approximately they would appear within the viewer.static ImageServer
<BufferedImage> createRenderedServer
(ImageServer<BufferedImage> server, ImageRenderer renderer) Create anImageServer
that converts the image to RGB using the specifiedImageRenderer
.protected ImageServerBuilder.ServerBuilder
<BufferedImage> Create a ServerBuilder, which can be used to construct an identical ImageServer.Get the original metadata read during creation of the server.A string describing the type of server, for example the name of the library used (Openslide, Bioformats...)getURIs()
Get the URIs for images required for this server.protected boolean
hasAlpha()
protected BufferedImage
readTile
(TileRequest tileRequest) Read a single image tile.Methods inherited from class qupath.lib.images.servers.AbstractTileableImageServer
allowSmoothInterpolation, getDefaultColorModel, getEmptyTile, getEmptyTile, getTile, readRegion
Methods inherited from class qupath.lib.images.servers.AbstractImageServer
close, finalize, getAssociatedImage, getAssociatedImageList, getBuilder, getCache, getCachedTile, getChannel, getDefaultThumbnail, getDownsampleForResolution, getHeight, getImageClass, getMetadata, getPath, getPixelType, getPreferredDownsamples, getThumbnailDownsampleFactor, getTileRequestManager, getWidth, isEmptyRegion, isRGB, nChannels, nResolutions, nTimepoints, nZSlices, setMetadata, toString
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.AutoCloseable
close
Methods inherited from interface qupath.lib.images.servers.ImageServer
getAssociatedImage, getAssociatedImageList, getBuilder, getCachedTile, getChannel, getDefaultThumbnail, getDownsampleForResolution, getHeight, getImageClass, getMetadata, getPath, getPixelCalibration, getPixelType, getPreferredDownsamples, getTileRequestManager, getWidth, isEmptyRegion, isRGB, nChannels, nResolutions, nTimepoints, nZSlices, readBufferedImage, readRegion, readRegion, readRegion, setMetadata
-
Method Details
-
createRenderedServer
public static ImageServer<BufferedImage> createRenderedServer(QuPathViewer viewer) throws IOException Create anImageServer
that returns tiles based on how approximately they would appear within the viewer. Note that- the server uses fixed downsample values, while the viewer can adapt annotation line thickness continuously - therefore the agreement is not exact
- changing display settings in the viewer may impact how later tiles are rendered
- the server cannot be serialized to JSON
- Parameters:
viewer
-- Returns:
- Throws:
IOException
- See Also:
-
createRenderedServer
public static ImageServer<BufferedImage> createRenderedServer(ImageServer<BufferedImage> server, ImageRenderer renderer) throws IOException Create anImageServer
that converts the image to RGB using the specifiedImageRenderer
.- Parameters:
server
-renderer
-- Returns:
- Throws:
IOException
-
getURIs
Description copied from interface:ImageServer
Get the URIs for images required for this server. In the simplest case, this is a singleton list returning a URI representing a local file. However, some ImageServers may not have an associated URI at all, whereas others may depend upon multiple URIs (e.g. if concatenating images).Note: A URI alone may not be sufficient to recreate even a simple ImageServer; see
ImageServer.getBuilder()
.- Specified by:
getURIs
in interfaceImageServer<BufferedImage>
- Returns:
-
getServerType
Description copied from interface:ImageServer
A string describing the type of server, for example the name of the library used (Openslide, Bioformats...)- Specified by:
getServerType
in interfaceImageServer<BufferedImage>
- Returns:
-
getOriginalMetadata
Description copied from interface:ImageServer
Get the original metadata read during creation of the server. This may or may not be correct.- Specified by:
getOriginalMetadata
in interfaceImageServer<BufferedImage>
- Returns:
- See Also:
-
readTile
Description copied from class:AbstractTileableImageServer
Read a single image tile.- Specified by:
readTile
in classAbstractTileableImageServer
- Parameters:
tileRequest
-- Returns:
- Throws:
IOException
-
hasAlpha
protected boolean hasAlpha() -
createDefaultRGBImage
Description copied from class:AbstractTileableImageServer
Create the default (blank) RGB image for this server.By default this will have
TYPE_INT_RGB
but a subclass may change this if necessary (e.g. to incorporate an alpha channel).- Overrides:
createDefaultRGBImage
in classAbstractTileableImageServer
- Parameters:
width
-height
-- Returns:
-
createServerBuilder
Description copied from class:AbstractImageServer
Create a ServerBuilder, which can be used to construct an identical ImageServer. This should also include the current metadata. It is permissible to return null for an ImageServer that cannot be recreated via aImageServerBuilder.ServerBuilder
.- Specified by:
createServerBuilder
in classAbstractImageServer<BufferedImage>
- Returns:
-
createID
Description copied from class:AbstractImageServer
Create a unique ID for the server, which can be returned as the default value ofAbstractImageServer.getPath()
. A suggested implementation isgetClass().getName() + ": " + URI + parameters
This will be called on demand wheneverAbstractImageServer.getPath()
is first required.- Specified by:
createID
in classAbstractImageServer<BufferedImage>
- Returns:
-