Class PatternDictionary

  • All Implemented Interfaces:
    Dictionary, SegmentData

    public class PatternDictionary
    extends java.lang.Object
    implements Dictionary
    This class represents the segment type "Pattern dictionary", 7.4.4.
    • Field Detail

      • dataHeaderOffset

        private long dataHeaderOffset
        Segment data structure (only necessary if MMR is used)
      • dataHeaderLength

        private long dataHeaderLength
      • dataOffset

        private long dataOffset
      • dataLength

        private long dataLength
      • gbAtX

        private short[] gbAtX
      • gbAtY

        private short[] gbAtY
      • isMMREncoded

        private boolean isMMREncoded
        Pattern dictionary flags, 7.4.4.1.1
      • hdTemplate

        private byte hdTemplate
      • hdpWidth

        private short hdpWidth
        Width of the patterns in the pattern dictionary, 7.4.4.1.2
      • hdpHeight

        private short hdpHeight
        Height of the patterns in the pattern dictionary, 7.4.4.1.3
      • patterns

        private java.util.ArrayList<Bitmap> patterns
        Decoded bitmaps, stored to be used by segments, that refer to it
      • grayMax

        private int grayMax
        Largest gray-scale value, 7.4.4.1.4 Value: one less than the number of patterns defined in this pattern dictionary
    • Constructor Detail

      • PatternDictionary

        public PatternDictionary()
    • Method Detail

      • readTemplate

        private void readTemplate()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • readIsMMREncoded

        private void readIsMMREncoded()
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • readPatternWidthAndHeight

        private void readPatternWidthAndHeight()
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • readGrayMax

        private void readGrayMax()
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • computeSegmentDataStructure

        private void computeSegmentDataStructure()
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • getDictionary

        public java.util.ArrayList<Bitmap> getDictionary()
                                                  throws java.io.IOException,
                                                         InvalidHeaderValueException
        This method decodes a pattern dictionary segment and returns an array of Bitmap s. Each of this Bitmaps is a pattern.
        The procedure is described in 6.7.5 (page 43).
        Specified by:
        getDictionary in interface Dictionary
        Returns:
        An array of Bitmaps as result of the decoding procedure.
        Throws:
        java.io.IOException - if an underlying IO operation fails
        InvalidHeaderValueException - if the segment header value is invalid
      • extractPatterns

        private void extractPatterns​(Bitmap collectiveBitmap)
      • setGbAtPixels

        private void setGbAtPixels()
      • init

        public void init​(SegmentHeader header,
                         SubInputStream sis)
                  throws InvalidHeaderValueException,
                         java.io.IOException
        Description copied from interface: SegmentData
        Parse the stream and read information of header.
        Specified by:
        init in interface SegmentData
        Parameters:
        header - - The segments' header (to make referred-to segments available in data part).
        sis - - Wrapped ImageInputStream into SubInputStream.
        Throws:
        InvalidHeaderValueException - if the segment header value is invalid
        java.io.IOException - if an underlying IO operation fails
      • isMMREncoded

        protected boolean isMMREncoded()
      • getHdTemplate

        protected byte getHdTemplate()
      • getHdpWidth

        protected short getHdpWidth()
      • getHdpHeight

        protected short getHdpHeight()
      • getGrayMax

        protected int getGrayMax()