Class BioFormatsImageServer
java.lang.Object
qupath.lib.images.servers.AbstractImageServer<BufferedImage>
qupath.lib.images.servers.AbstractTileableImageServer
qupath.lib.images.servers.bioformats.BioFormatsImageServer
- All Implemented Interfaces:
AutoCloseable
,ImageServer<BufferedImage>
,PathObjectReader
QuPath ImageServer that uses the Bio-Formats library to read image data.
See http://www.openmicroscopy.org/site/products/bio-formats
See also https://docs.openmicroscopy.org/bio-formats/6.5.1/developers/matlab-dev.html#improving-reading-performance
-
Constructor Summary
ConstructorsConstructorDescriptionBioFormatsImageServer
(URI uri, String... args) Create an ImageServer using the Bio-Formats library. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
createID()
Create a unique ID for the server, which can be returned as the default value ofAbstractImageServer.getPath()
.protected ImageServerBuilder.ServerBuilder
<BufferedImage> Returns a builder capable of creating a server like this one.Retrieve a string representation of the metadata OME-XML.getAssociatedImage
(String name) Get the image for a given associated image name.Get a list of 'associated images', e.g.getFile()
Get the underlying file.Get the format String, as returned by Bio-FormatsIFormatReader.getFormat()
.Get the MetadataStore, as used by Bio-Formats.Get the original metadata read during creation of the server.int
Get the series index, as used by Bio-Formats.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.Read a collection of objects from the source.readTile
(TileRequest tileRequest) Read a single image tile.void
setMetadata
(ImageServerMetadata metadata) Set the metadata to use, e.g.Methods inherited from class qupath.lib.images.servers.AbstractTileableImageServer
allowSmoothInterpolation, createDefaultRGBImage, getDefaultColorModel, getEmptyTile, getEmptyTile, getTile, readRegion
Methods inherited from class qupath.lib.images.servers.AbstractImageServer
getBuilder, getCache, getCachedTile, getChannel, getDefaultThumbnail, getDownsampleForResolution, getHeight, getImageClass, getMetadata, getPath, getPixelType, getPreferredDownsamples, getThumbnailDownsampleFactor, getTileRequestManager, getWidth, isEmptyRegion, isRGB, nChannels, nResolutions, nTimepoints, nZSlices, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface qupath.lib.images.servers.ImageServer
getPixelCalibration, readBufferedImage, readRegion, readRegion
-
Constructor Details
-
BioFormatsImageServer
public BioFormatsImageServer(URI uri, String... args) throws FormatException, IOException, loci.common.services.DependencyException, loci.common.services.ServiceException, URISyntaxException Create an ImageServer using the Bio-Formats library.This requires an absolute URI, where an integer fragment can be used to define the series number.
- Parameters:
uri
- for the image that should be opened; this might include a sub-image as a query or fragment.args
- optional arguments- Throws:
FormatException
IOException
loci.common.services.DependencyException
loci.common.services.ServiceException
URISyntaxException
-
-
Method Details
-
getFormat
Get the format String, as returned by Bio-FormatsIFormatReader.getFormat()
.- 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()
.- Specified by:
getURIs
in interfaceImageServer<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:
-
setMetadata
Description copied from interface:ImageServer
Set the metadata to use, e.g. to change the pixel size in microns.- Specified by:
setMetadata
in interfaceImageServer<BufferedImage>
- Overrides:
setMetadata
in classAbstractImageServer<BufferedImage>
- Parameters:
metadata
-
-
createServerBuilder
Returns a builder capable of creating a server like this one.- Specified by:
createServerBuilder
in classAbstractImageServer<BufferedImage>
- Returns:
-
getSeries
public int getSeries()Get the series index, as used by Bio-Formats.- Returns:
-
readTile
Description copied from class:AbstractTileableImageServer
Read a single image tile.- Specified by:
readTile
in classAbstractTileableImageServer
- Parameters:
tileRequest
-- Returns:
- Throws:
IOException
-
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:
-
close
- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classAbstractImageServer<BufferedImage>
- Throws:
Exception
-
getMetadataStore
Get the MetadataStore, as used by Bio-Formats. This can be used to query metadata values not otherwise accessible.- Returns:
-
dumpMetadata
Retrieve a string representation of the metadata OME-XML.- Returns:
-
getAssociatedImageList
Description copied from interface:ImageServer
Get a list of 'associated images', e.g. thumbnails or slide overview images.Each associated image is simply a T that does not warrant (or require) a full ImageServer, and most likely would never be analyzed.
- Specified by:
getAssociatedImageList
in interfaceImageServer<BufferedImage>
- Overrides:
getAssociatedImageList
in classAbstractImageServer<BufferedImage>
- Returns:
- See Also:
-
getAssociatedImage
Description copied from interface:ImageServer
Get the image for a given associated image name.- Specified by:
getAssociatedImage
in interfaceImageServer<BufferedImage>
- Overrides:
getAssociatedImage
in classAbstractImageServer<BufferedImage>
- Parameters:
name
-- Returns:
- See Also:
-
getFile
Get the underlying file.- 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:
-
readPathObjects
Description copied from interface:PathObjectReader
Read a collection of objects from the source.- Specified by:
readPathObjects
in interfacePathObjectReader
- Returns:
- a collection of objects, or empty list if no objects are available.
-