Class ImageWriterTools

java.lang.Object
qupath.lib.images.writers.ImageWriterTools

public class ImageWriterTools extends Object
Static methods to access ImageWriter objects and write images.
Author:
Pete Bankhead
  • Constructor Details

    • ImageWriterTools

      public ImageWriterTools()
  • Method Details

    • getCompatibleWriters

      public static <T> List<ImageWriter<T>> getCompatibleWriters(ImageServer<T> server, String ext)
      Get a list of compatible ImageWriters compatible with a specific server.
      Type Parameters:
      T -
      Parameters:
      server -
      ext -
      Returns:
      getCompatibleWriters(Class, String)
    • getCompatibleWriters

      public static <T> List<ImageWriter<T>> getCompatibleWriters(Class<T> imageClass, String ext)
      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 write
      request - region to write; if null, the default plane of the entire image will be written
      path - the file path; the extension will be used to identify an appropriate writer
      Returns:
      Throws:
      IOException
    • writeImage

      public static boolean writeImage(BufferedImage img, String path) throws IOException
      Write a 2D image using the default writer based on the file path.
      Parameters:
      img -
      path -
      Returns:
      Throws:
      IOException
    • writeImage

      public static boolean writeImage(ImageServer<BufferedImage> server, String path) throws IOException
      Write a (possibly multidimensional) image region using the default writer based on the file path.
      Parameters:
      server - the image to write
      path - the file path; the extension will be used to identify an appropriate writer
      Returns:
      Throws:
      IOException