Package qupath.lib.images.servers
Class ImageServerProvider
java.lang.Object
qupath.lib.images.servers.ImageServerProvider
Service provider for creating ImageServers from a given path - which may be a file path or URL.
 
This class is responsible for hunting through potential ImageServerBuilders, ranked by support level, to find the first that works.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> ImageServer<T> buildServer(String path, Class<T> cls, String... args) Attempt to createImageServer<T>from the specified path and arguments.static <T> Map<RegionRequest, T> Get the cache in use for image tiles of a specific type.static List<ImageServerBuilder<?>> Request all availableImageServerBuilders.static <T> List<ImageServerBuilder<T>> getInstalledImageServerBuilders(Class<T> imageClass) Request all availableImageServerBuilderssupporting a given image class.static <T> ImageServerBuilder.UriImageSupport<T> getPreferredUriImageSupport(Class<T> cls, String path, String... args) Get the preferredImageServerBuilder.UriImageSupportfor a specified image path.static URIlegacyPathToURI(String path) Method to help with converting legacy image paths to URIs.static <T> voidsetCache(Map<RegionRequest, T> cache, Class<T> cls) Set the cache to be used for image tiles of a specific type.static voidsetServiceLoader(ServiceLoader<ImageServerBuilder> newLoader) Replace the default service loader with another.
- 
Constructor Details- 
ImageServerProviderpublic ImageServerProvider()
 
- 
- 
Method Details- 
setCacheSet the cache to be used for image tiles of a specific type.- Type Parameters:
- T-
- Parameters:
- cache-
- cls-
 
- 
getCacheGet the cache in use for image tiles of a specific type.- Type Parameters:
- T-
- Parameters:
- cls-
- Returns:
 
- 
setServiceLoaderReplace the default service loader with another.This can be handy if the ServiceLoader should be using an alternative ClassLoader, e.g. to auto-discover ImageServerBuilders in alternative directories. - Parameters:
- newLoader-
 
- 
getInstalledImageServerBuildersRequest all availableImageServerBuilders.- Returns:
 
- 
getInstalledImageServerBuildersRequest all availableImageServerBuilderssupporting a given image class.- Type Parameters:
- T-
- Parameters:
- imageClass-
- Returns:
 
- 
legacyPathToURIMethod to help with converting legacy image paths to URIs. This is intended for compatibility with data files used in QuPath v0.1.2, where servers were represented using paths only (rather than JSON).- Parameters:
- path-
- Returns:
- a URI parsed from a path, if possible
- Throws:
- IOException
 
- 
getPreferredUriImageSupportpublic static <T> ImageServerBuilder.UriImageSupport<T> getPreferredUriImageSupport(Class<T> cls, String path, String... args) throws IOException Get the preferredImageServerBuilder.UriImageSupportfor a specified image path.- Type Parameters:
- T-
- Parameters:
- cls-
- path-
- args-
- Returns:
- Throws:
- IOException
 
- 
buildServerpublic static <T> ImageServer<T> buildServer(String path, Class<T> cls, String... args) throws IOException Attempt to createImageServer<T>from the specified path and arguments.In general, since v0.3 ImageServers.buildServer(URI, String...)is usually preferable to this method because it parses and applies known args (e.g. to reorder RGB channels or rotate the image). Here, all args apart from--classnameare passed to builders - which may or may not do anything with them.- Parameters:
- path- path to an image - typically a URI
- cls- desired generic type for the ImageServer, e.g. BufferedImage.class
- args- optional arguments, which may be used by some builders
- Returns:
- Throws:
- IOException
 
 
-