Class DNGReader

All Implemented Interfaces:
Closeable, AutoCloseable, ICompressedTileReader, IFormatHandler, IFormatReader, IMetadataConfigurable, IPyramidHandler

public class DNGReader extends BaseTiffReader
DNGReader is the file format reader for Canon DNG (TIFF) files.
Author:
Melissa Linkert melissa at glencoesoftware.com
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
      Logger for this class.
    • CANON_TAG

      private static final int CANON_TAG
      See Also:
    • TIFF_EPS_STANDARD

      private static final int TIFF_EPS_STANDARD
      See Also:
    • COLOR_MAP

      private static final int COLOR_MAP
      See Also:
    • WHITE_BALANCE_RGB_COEFFS

      private static final int WHITE_BALANCE_RGB_COEFFS
      See Also:
    • original

      protected IFD original
      The original IFD.
    • whiteBalance

      private double[] whiteBalance
    • cfaPattern

      private Object cfaPattern
    • lastPlane

      private byte[] lastPlane
    • lastIndex

      private int lastIndex
  • Constructor Details

    • DNGReader

      public DNGReader()
      Constructs a new DNG reader.
  • Method Details

    • isThisType

      public boolean isThisType(loci.common.RandomAccessInputStream stream) throws IOException
      Description copied from interface: IFormatReader
      Checks if the given stream is a valid stream for this file format. The number of bytes read is format-dependent.
      Specified by:
      isThisType in interface IFormatReader
      Overrides:
      isThisType in class MinimalTiffReader
      Parameters:
      stream - A RandomAccessInputStream representing the file to check. The first byte in the stream is assumed to be the first byte in the file.
      Returns:
      true if the file represented by the stream can be read by this reader; false otherwise.
      Throws:
      IOException
    • openBytes

      public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException
      Description copied from interface: IFormatReader
      Obtains a sub-image of the specified image plane into a pre-allocated byte array.
      Specified by:
      openBytes in interface IFormatReader
      Overrides:
      openBytes in class MinimalTiffReader
      Parameters:
      no - the plane index within the current series.
      buf - a pre-allocated buffer.
      x - X coordinate of the upper-left corner of the sub-image
      y - Y coordinate of the upper-left corner of the sub-image
      w - width of the sub-image
      h - height of the sub-image
      Returns:
      the pre-allocated buffer buf for convenience.
      Throws:
      FormatException - if there was a problem parsing the metadata of the file.
      IOException - if there was a problem reading the file.
      See Also:
    • close

      public void close(boolean fileOnly) throws IOException
      Description copied from interface: IFormatReader
      Closes the currently open file. If the flag is set, this is all that happens; if unset, it is equivalent to calling Closeable.close().
      Specified by:
      close in interface IFormatReader
      Overrides:
      close in class MinimalTiffReader
      Throws:
      IOException
    • initStandardMetadata

      protected void initStandardMetadata() throws FormatException, IOException
      Description copied from class: BaseTiffReader
      Parses standard metadata. NOTE: Absolutely no calls to the metadata store should be made in this method or methods that override this method. Data will be overwritten if you do so.
      Overrides:
      initStandardMetadata in class BaseTiffReader
      Throws:
      FormatException
      IOException
    • initFile

      protected void initFile(String id) throws FormatException, IOException
      Description copied from class: SubResolutionFormatReader
      Initializes the given file (parsing header information, etc.). Most subclasses should override this method to perform initialization operations such as parsing metadata.
      Overrides:
      initFile in class BaseTiffReader
      Throws:
      FormatException - if a parsing error occurs processing the file.
      IOException - if an I/O error occurs processing the file
    • adjustForWhiteBalance

      private short adjustForWhiteBalance(short val, int index)