Package qupath.lib.images.servers
Class ImageServers
java.lang.Object
qupath.lib.images.servers.ImageServers
Helper class for working with
ImageServer objects.
The main use is to convert ImageServers to and from serialized representations for use within a Project.
- Author:
- Pete Bankhead
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ImageServer<BufferedImage>buildServer(String path, String... args) Build aImageServerfor the specified URI path and optional args.static ImageServer<BufferedImage>buildServer(URI uri, String... args) Build aImageServerfor the specified URI and optional args.getAllImageSupports(URI uri, String... args) Get allImageServerBuilder.UriImageSupportthat claim to be able to open the specified URI with optional args.static TypeAdapterFactorygetImageServerTypeAdapterFactory(boolean includeMetadata) Get a TypeAdapterFactory for ImageServers, optionally including metadata in the serialized form of the server.getImageSupport(URI uri, String... args) Get theImageServerBuilder.UriImageSupportthat is best able to open the specified image with optional args.getImageSupport(ImageServerBuilder<BufferedImage> builder, URI uri, String... args) Get theImageServerBuilder.UriImageSupportassociated with anImageServerBuilder, or null if the builder does not support the image.static TypeAdapterFactoryGet a TypeAdapterFactory to handle ServerBuilders.static ImageServer<BufferedImage>pyramidalize(ImageServer<BufferedImage> server, double... downsamples) Wrap an ImageServer to dynamically generate a pyramid.static ImageServer<BufferedImage>pyramidalizeTiled(ImageServer<BufferedImage> server, int tileWidth, int tileHeight, double... downsamples) Wrap an ImageServer to dynamically generate a pyramid, using specified tile sizes.
-
Constructor Details
-
ImageServers
public ImageServers()
-
-
Method Details
-
getServerBuilderFactory
Get a TypeAdapterFactory to handle ServerBuilders.- Returns:
-
pyramidalize
public static ImageServer<BufferedImage> pyramidalize(ImageServer<BufferedImage> server, double... downsamples) Wrap an ImageServer to dynamically generate a pyramid. This does not involve writing any new image, and may be rather processor and memory-intensive as high-resolution tiles must be accessed to fulfil low-resolution requests. However, tile caching means that after tiles have been accessed once perceived performance can be considerably improved.- Parameters:
server- the server to wrap (typically having only one resolution level)downsamples- optional array giving the downsamples of the new pyramid. If not provided,- Returns:
-
pyramidalizeTiled
public static ImageServer<BufferedImage> pyramidalizeTiled(ImageServer<BufferedImage> server, int tileWidth, int tileHeight, double... downsamples) Wrap an ImageServer to dynamically generate a pyramid, using specified tile sizes. This does not involve writing any new image, and may be rather processor and memory-intensive as high-resolution tiles must be accessed to fulfil low-resolution requests. However, tile caching means that after tiles have been accessed once perceived performance can be considerably improved.- Parameters:
server- the server to wrap (typically having only one resolution level)tileWidth- requested tile heighttileHeight- requested tile heightdownsamples- optional array giving the downsamples of the new pyramid. If not provided,- Returns:
-
buildServer
public static ImageServer<BufferedImage> buildServer(String path, String... args) throws IOException Build aImageServerfor the specified URI path and optional args.See
buildServer(URI, String...)for more information about how args are applied.- Parameters:
path- path for the image; it should be possible to convert this to a URIargs-- Returns:
- Throws:
IOException
-
buildServer
Build aImageServerfor the specified URI and optional args. This differs fromImageServerProvider.buildServer(String, Class, String...)in two main ways:- it always uses
BufferedImageas the server class - where possible, args that request a transformed server are applied
--classnameto request an image provider class--order RGB/BGRetc. to request reordering for RGB channels--rotate ROTATE_90/ROTATE_180/ROTATE_270to request rotation
- Parameters:
uri-args-- Returns:
- Throws:
IOException
- it always uses
-
getAllImageSupports
public static List<ImageServerBuilder.UriImageSupport<BufferedImage>> getAllImageSupports(URI uri, String... args) throws IOException Get allImageServerBuilder.UriImageSupportthat claim to be able to open the specified URI with optional args.See
buildServer(URI, String...)for more information about how args are applied.- Parameters:
uri-args-- Returns:
- a list or
ImageServerBuilder.UriImageSupport, ranked in descending order of support level. - Throws:
IOException
-
getImageSupport
public static ImageServerBuilder.UriImageSupport<BufferedImage> getImageSupport(URI uri, String... args) throws IOException Get theImageServerBuilder.UriImageSupportthat is best able to open the specified image with optional args.See
buildServer(URI, String...)for more information about how args are applied.- Parameters:
uri-args-- Returns:
- a list or
ImageServerBuilder.UriImageSupport, ranked in descending order of support level. - Throws:
IOException
-
getImageSupport
public static ImageServerBuilder.UriImageSupport<BufferedImage> getImageSupport(ImageServerBuilder<BufferedImage> builder, URI uri, String... args) throws IOException Get theImageServerBuilder.UriImageSupportassociated with anImageServerBuilder, or null if the builder does not support the image.See
buildServer(URI, String...)for more information about how args are applied.- Parameters:
builder-uri-args-- Returns:
- Throws:
IOException
-
getImageServerTypeAdapterFactory
Get a TypeAdapterFactory for ImageServers, optionally including metadata in the serialized form of the server.- Parameters:
includeMetadata-- Returns:
-