Class OMETiffWriter

All Implemented Interfaces:
Closeable, AutoCloseable, ICompressedTileWriter, IFormatHandler, IFormatWriter, IMetadataConfigurable, IPyramidHandler
Direct Known Subclasses:
PyramidOMETiffWriter

public class OMETiffWriter extends TiffWriter
OMETiffWriter is the file format writer for OME-TIFF files.
  • Field Details

  • Constructor Details

    • OMETiffWriter

      public OMETiffWriter()
  • Method Details

    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class TiffWriter
      Throws:
      IOException
    • saveCompressedBytes

      public void saveCompressedBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException
      Description copied from interface: ICompressedTileWriter
      Save a compressed tile to the current output file. The compression type of the tile should match the compression type set in the writer.
      Specified by:
      saveCompressedBytes in interface ICompressedTileWriter
      Overrides:
      saveCompressedBytes in class TiffWriter
      Parameters:
      no - plane index
      buf - compressed tile bytes
      x - pixel X coordinate of the upper-left corner of the tile
      y - pixel Y coordinate of the upper-left corner of the tile
      w - width in pixels of the compressed tile
      h - height in pixels of the compressed tile
      Throws:
      FormatException
      IOException
    • saveBytes

      public void saveBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException
      Description copied from interface: IFormatWriter
      Saves the given image tile to the current series in the current file.
      Specified by:
      saveBytes in interface IFormatWriter
      Overrides:
      saveBytes in class TiffWriter
      Parameters:
      no - the plane index within the series.
      buf - the byte array that represents the image tile.
      x - the X coordinate of the upper-left corner of the image tile.
      y - the Y coordinate of the upper-left corner of the image tile.
      w - the width (in pixels) of the image tile.
      h - the height (in pixels) of the image tile.
      Throws:
      FormatException - if one of the parameters is invalid.
      IOException - if there was a problem writing to the file.
      See Also:
    • saveBytes

      public void saveBytes(int no, byte[] buf, IFD ifd, int x, int y, int w, int h) throws FormatException, IOException
      Description copied from class: TiffWriter
      Saves the given image to the specified series in the current file. The IFD hashtable allows specification of TIFF parameters such as bit depth, compression and units. Use one IFD instance per plane.
      Overrides:
      saveBytes in class TiffWriter
      Throws:
      FormatException
      IOException
      See Also:
    • setId

      public void setId(String id) throws FormatException, IOException
      Description copied from class: FormatWriter
      Initializes a writer from the input file name. Initializes a RandomAccessOutputStream for the output file and initializes the metadata for all the series using FormatWriter.setSeries(int).
      Specified by:
      setId in interface IFormatHandler
      Overrides:
      setId in class TiffWriter
      Parameters:
      id - a String specifying the path to the file
      Throws:
      FormatException
      IOException
    • getCompanion

      public String getCompanion()
      Get the value of the COMPANION_KEY option.
      Returns:
      path to the companion file, or null if a companion file is not used
    • preserveCreator

      public boolean preserveCreator()
      Get the value of the CREATOR_KEY option. This toggles whether or not the OME Creator attribute will be overwritten with the current Bio-Formats version. For input data that does not have a Creator attribute defined, this makes no difference. By default, returns false, i.e. the Creator will be overwritten if it exists.
      Returns:
      true if the Creator attribute should be preserved (if it exists)
    • getUUID

      private String getUUID(String filename)
      Gets the UUID corresponding to the given filename.
    • setupServiceAndMetadata

      private void setupServiceAndMetadata() throws loci.common.services.DependencyException, loci.common.services.ServiceException
      Throws:
      loci.common.services.DependencyException
      loci.common.services.ServiceException
    • insertWarningComment

      private String insertWarningComment(String xml)
    • getOMEXML

      private String getOMEXML(String file) throws FormatException, IOException
      Throws:
      FormatException
      IOException
    • getBinaryOnlyOMEXML

      private String getBinaryOnlyOMEXML(String file, String companion, String companionUUID) throws FormatException, IOException, loci.common.services.DependencyException, loci.common.services.ServiceException
      Throws:
      FormatException
      IOException
      loci.common.services.DependencyException
      loci.common.services.ServiceException
    • setCreator

      private void setCreator(ome.xml.meta.OMEXMLMetadataRoot root)
      Set the Creator attribute on the given OME-XML root object. If the Creator was not previously set, it will be set to the current Bio-Formats version. If the Creator has been set already, the CREATOR_KEY option (via preserveCreator()) is used to determine whether to overwrite the existing value with the Bio-Formats version.
      Parameters:
      root - OME-XML root object
    • saveComment

      private void saveComment(String file, String xml) throws IOException
      Throws:
      IOException
    • populateTiffData

      private void populateTiffData(OMEXMLMetadata omeMeta, int[] zct, int ifd, int series, int plane)
    • populateImage

      private void populateImage(OMEXMLMetadata omeMeta, int series)
    • planeCount

      private int planeCount()