Package qupath.lib.images.writers.ome
Class OMEPyramidWriter
java.lang.Object
qupath.lib.images.writers.ome.OMEPyramidWriter
Write OME-TIFF files based on QuPath ImageServers.
The files may optionally be pyramidal TIFFs. Some key metadata is set (e.g. channel names/colors, pixel size), and an effort is made to support multidimensional images - but this has not been extensively checked.
Currently the magnification is not written, nor is the full OME XML metadata, and images written using this class should not be assumed to contain all the necessary information, correctly or at all (i.e. always keep your original data files!).
Note this requires Bio-Formats v6.0.0 or later.
- Author:
- Pete Bankhead
modified by @phaub , 04'2021 (JPEG support for nChannels > 1, sanity check)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder class to define parameters when exporting an image region as OME-TIFF, possibly as an image pyramid.static enum
Enum representing different ways in which channels may be written to a file.static enum
Preferred compression type when using Bio-Formats.static class
Class representing a single series to write to an OME-TIFF. -
Method Summary
Modifier and TypeMethodDescriptionstatic OMEPyramidWriter
Create a writer capable of writing an image with a collection of series.static OMEPyramidWriter
createWriter
(OMEPyramidWriter.OMEPyramidSeries... series) Create a writer capable of writing an image with one or more series.void
writeImage
(String path) Write an image consisting of one or more series to the specified path.static void
writeImage
(ImageServer<BufferedImage> server, String path) Static helper method to write an image using Bio-Formats.static void
writeImage
(ImageServer<BufferedImage> server, String path, OMEPyramidWriter.CompressionType compression) Static helper method to write an image using Bio-Formats with the specified compression.static void
writeImage
(ImageServer<BufferedImage> server, String path, OMEPyramidWriter.CompressionType compression, ImageRegion region) Static helper method to write an image region using Bio-Formats with the specified compression.static void
writeImage
(ImageServer<BufferedImage> server, String path, OMEPyramidWriter.CompressionType compression, ImageRegion region, boolean allZ, boolean allT) Static helper method to write an image using Bio-Formats for a defined region with the specified compression, optionally including all z-slices or timepoints.
-
Method Details
-
writeImage
Write an image consisting of one or more series to the specified path.- Parameters:
path
-- Throws:
FormatException
IOException
- See Also:
-
createWriter
Create a writer capable of writing an image with one or more series.- Parameters:
series
-- Returns:
-
createWriter
Create a writer capable of writing an image with a collection of series.- Parameters:
series
-- Returns:
-
writeImage
public static void writeImage(ImageServer<BufferedImage> server, String path) throws FormatException, IOException Static helper method to write an image using Bio-Formats. This is primarily intended for saving whole slide images as pyramidal OME-TIFF, but other formats are supported.- Parameters:
server
-path
-- Throws:
FormatException
IOException
-
writeImage
public static void writeImage(ImageServer<BufferedImage> server, String path, OMEPyramidWriter.CompressionType compression) throws FormatException, IOException Static helper method to write an image using Bio-Formats with the specified compression. This is primarily intended for saving whole slide images as pyramidal OME-TIFF, but other formats are supported.- Parameters:
server
-path
-compression
-- Throws:
FormatException
IOException
-
writeImage
public static void writeImage(ImageServer<BufferedImage> server, String path, OMEPyramidWriter.CompressionType compression, ImageRegion region) throws FormatException, IOException Static helper method to write an image region using Bio-Formats with the specified compression. If region is null, the entire image will be written. If region is not null, it defines the bounding box of the exported pixels in addition to the z-slice and timepoint.- Parameters:
server
- image to writepath
- path to output filecompression
- image compression method; may be null to use the default compressionregion
- the region to export. If this is a RegionRequest that defines a downsample other than the default for the server, this downsample will be used.- Throws:
FormatException
IOException
-
writeImage
public static void writeImage(ImageServer<BufferedImage> server, String path, OMEPyramidWriter.CompressionType compression, ImageRegion region, boolean allZ, boolean allT) throws FormatException, IOException Static helper method to write an image using Bio-Formats for a defined region with the specified compression, optionally including all z-slices or timepoints. This is intended primarily to write (possibly pyramidal) OME-TIFF images; other formats may support fewer image types and dimensions.- Parameters:
server
- image to writepath
- path to output filecompression
- image compression method; may be null to use the default compressionregion
- the region to export. If this is a RegionRequest that defines a downsample other than the default for the server, this downsample will be used.allZ
- if true, export all z-slices otherwise export slice defined by region (ignored if image is not a z-stack)allT
- if true, export all timepoints otherwise export timepoint defined by region (ignored if image is not a timeseries)- Throws:
FormatException
IOException
-