Package qupath.lib.images.servers
Class SparseImageServer
java.lang.Object
qupath.lib.images.servers.AbstractImageServer<BufferedImage>
qupath.lib.images.servers.AbstractTileableImageServer
qupath.lib.images.servers.SparseImageServer
- All Implemented Interfaces:
AutoCloseable
,ImageServer<BufferedImage>
An ImageServer that combines regions from multiple separate ImageServers,
repositioning these as necessary to generate one larger field of view.
Regions are currently defined within a JSON file passed as the 'path' argument, and this also contains the full paths to the other ImageServers.
- Author:
- Pete Bankhead
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder to create a newSparseImageServer
.static class
Helper class for SparseImageServers, capable of returning the appropriate ImageServer for different ImageRegions and different resolutions. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected String
createID()
Returns a UUID.protected ImageServerBuilder.ServerBuilder
<BufferedImage> Create a ServerBuilder, which can be used to construct an identical ImageServer.protected ColorModel
Get an appropriate colormodel that may be used.Get the manager, which defines from whence the regions originate.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 BufferedImage
readTile
(TileRequest tileRequest) Read a single image tile.static List
<SparseImageServer> splitConnectedRegions
(SparseImageServer server, double distancePixels, boolean permitBoundsOverlap) Split aSparseImageServer
into multiple servers, whereby each split server represents one connected region.Methods inherited from class qupath.lib.images.servers.AbstractTileableImageServer
allowSmoothInterpolation, createDefaultRGBImage, getEmptyTile, getEmptyTile, getTile, readRegion
Methods inherited from class qupath.lib.images.servers.AbstractImageServer
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 qupath.lib.images.servers.ImageServer
getPixelCalibration, readBufferedImage, readRegion, readRegion
-
Method Details
-
getDefaultColorModel
Description copied from class:AbstractTileableImageServer
Get an appropriate colormodel that may be used. The default implementation uses the default RGB color model for RGB images, or else requests a low-resolution thumbnail to extract the color model from it. If neither implementation is sufficient, subclasses should override this method.- Overrides:
getDefaultColorModel
in classAbstractTileableImageServer
- Returns:
-
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()
.- Returns:
-
createID
Returns a UUID.- Specified by:
createID
in classAbstractImageServer<BufferedImage>
- Returns:
-
getManager
Get the manager, which defines from whence the regions originate.- Returns:
-
getServerType
Description copied from interface:ImageServer
A string describing the type of server, for example the name of the library used (Openslide, Bioformats...)- Returns:
-
getOriginalMetadata
Description copied from interface:ImageServer
Get the original metadata read during creation of the server. This may or may not be correct.- Returns:
- See Also:
-
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:
-
close
- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classAbstractImageServer<BufferedImage>
- Throws:
Exception
-
readTile
Description copied from class:AbstractTileableImageServer
Read a single image tile.- Specified by:
readTile
in classAbstractTileableImageServer
- Parameters:
tileRequest
-- Returns:
- Throws:
IOException
-
splitConnectedRegions
public static List<SparseImageServer> splitConnectedRegions(SparseImageServer server, double distancePixels, boolean permitBoundsOverlap) throws IOException Split aSparseImageServer
into multiple servers, whereby each split server represents one connected region. This can be useful whenever a sparse server contains (for example) multiple pieces of tissue with a substantial gap between them, because it allows each piece to be treated as a separate image.- Parameters:
server
- the sparse server to be splitdistancePixels
- the maximum separation between regions for them to be considered part of the same server after splitting. Must be a positive value or zero; suggested default is 1.permitBoundsOverlap
- if true, the bounding boxes for each server may overlap. If unsure, it is strongly advised to use 'false', since otherwise part of a returned server may be 'empty' because the corresponding region was assigned to another server, creating the misleading impression there was nothing there.- Returns:
- Throws:
IOException
-