Package qupath.lib.images.writers
Class ImageWriterTools
java.lang.Object
qupath.lib.images.writers.ImageWriterTools
Static methods to access
ImageWriter
objects and write images.- Author:
- Pete Bankhead
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List
<ImageWriter<T>> getCompatibleWriters
(Class<T> imageClass, String ext) Get a list of compatible ImageWriters for a specific image class.static <T> List
<ImageWriter<T>> getCompatibleWriters
(ImageServer<T> server, String ext) Get a list of compatible ImageWriters compatible with a specific server.static boolean
writeImage
(BufferedImage img, String path) Write a 2D image using the default writer based on the file path.static boolean
writeImage
(ImageServer<BufferedImage> server, String path) Write a (possibly multidimensional) image region using the default writer based on the file path.static boolean
writeImageRegion
(ImageServer<BufferedImage> server, RegionRequest request, String path) Write a 2D image region using the default writer based on the file path.
-
Constructor Details
-
ImageWriterTools
public ImageWriterTools()
-
-
Method Details
-
getCompatibleWriters
Get a list of compatible ImageWriters compatible with a specific server.- Type Parameters:
T
-- Parameters:
server
-ext
-- Returns:
getCompatibleWriters(Class, String)
-
getCompatibleWriters
Get a list of compatible ImageWriters for a specific image class.The returned list is sorted, with the 'preferred' server coming first. This decision is made based upon whether the writer supports pixel calibration information and
- Type Parameters:
T
-- Parameters:
imageClass
- the image class (e.g. BufferedImage.class)ext
- the desired output file extension (e.g. ".jpg", ".tif").- Returns:
getCompatibleWriters(ImageServer, String)
-
writeImageRegion
public static boolean writeImageRegion(ImageServer<BufferedImage> server, RegionRequest request, String path) throws IOException Write a 2D image region using the default writer based on the file path.- Parameters:
server
- the image to writerequest
- region to write; if null, the default plane of the entire image will be writtenpath
- the file path; the extension will be used to identify an appropriate writer- Returns:
- Throws:
IOException
-
writeImage
Write a 2D image using the default writer based on the file path.- Parameters:
img
-path
-- Returns:
- Throws:
IOException
-
writeImage
Write a (possibly multidimensional) image region using the default writer based on the file path.- Parameters:
server
- the image to writepath
- the file path; the extension will be used to identify an appropriate writer- Returns:
- Throws:
IOException
-