Class JPEG2000MetadataParser

java.lang.Object
loci.formats.in.JPEG2000MetadataParser

public class JPEG2000MetadataParser extends Object
A parser for JPEG 2000 metadata.
  • Field Details

    • LOGGER

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

      private loci.common.RandomAccessInputStream in
      Stream that we're parsing metadata from.
    • codestreamOffset

      private long codestreamOffset
      Offset to first contiguous codestream.
    • maximumReadOffset

      private long maximumReadOffset
      Maximum read offset within in the stream.
    • headerSizeX

      private Integer headerSizeX
      Width of the image as specified in the header.
    • headerSizeY

      private Integer headerSizeY
      Height of the image as specified in the header.
    • headerSizeC

      private Short headerSizeC
      Number of channels the image has as specified in the header.
    • headerPixelType

      private Integer headerPixelType
      Pixel type as specified in the header.
    • codestreamSizeX

      private Integer codestreamSizeX
      Width of the image as specified in the JPEG 2000 codestream.
    • codestreamSizeY

      private Integer codestreamSizeY
      Height of the image as specified in the JPEG 2000 codestream.
    • codestreamSizeC

      private Short codestreamSizeC
      Number of channels the image as specified in the JPEG 2000 codestream.
    • codestreamPixelType

      private Integer codestreamPixelType
      Pixel type as specified in the JPEG 2000 codestream..
    • isRawCodestream

      private boolean isRawCodestream
      Whether or not the codestream is raw and not JP2 boxed.
    • resolutionLevels

      private Integer resolutionLevels
      Number of JPEG 2000 resolution levels the file has.
    • lut

      private int[][] lut
      Color lookup table stored in the file.
    • comments

      private ArrayList<String> comments
      List of comments stored in the file.
  • Constructor Details

    • JPEG2000MetadataParser

      public JPEG2000MetadataParser(loci.common.RandomAccessInputStream in) throws IOException
      Constructs a new JPEG2000MetadataParser.
      Parameters:
      in - Stream to parse JPEG 2000 metadata from.
      Throws:
      IOException - Thrown if there is an error reading from the file.
    • JPEG2000MetadataParser

      public JPEG2000MetadataParser(loci.common.RandomAccessInputStream in, long maximumReadOffset) throws IOException
      Constructs a new JPEG2000MetadataParser.
      Parameters:
      in - Stream to parse JPEG 2000 metadata from.
      maximumReadOffset - Maximum read offset within the stream when parsing.
      Throws:
      IOException - Thrown if there is an error reading from the file.
  • Method Details

    • getCodestreamOffset

      public long getCodestreamOffset()
      Retrieves the offset to the first contiguous codestream.
    • getComments

      public ArrayList<String> getComments()
      Retrieves the list of comments stored in the file.
    • parseBoxes

      private void parseBoxes() throws IOException
      Parses the JPEG 2000 JP2 metadata boxes.
      Throws:
      IOException - Thrown if there is an error reading from the file.
    • parseContiguousCodestream

      private void parseContiguousCodestream(long length) throws IOException
      Parses the JPEG 2000 codestream metadata.
      Parameters:
      length - Total length of the codestream block.
      Throws:
      IOException - Thrown if there is an error reading from the file.
    • isRawCodestream

      public boolean isRawCodestream()
      Whether or not the codestream is raw and not JP2 boxed.
      Returns:
      true if the codestream is raw and false otherwise.
    • getResolutionLevels

      public Integer getResolutionLevels()
      Returns the number of resolution levels the file JPEG 2000 data has.
      Returns:
      The number of resolution levels or null if the number cannot be parsed.
    • getHeaderSizeX

      public Integer getHeaderSizeX()
      Returns the width of the image as specified in the header.
      Returns:
      See above.
    • getHeaderSizeY

      public Integer getHeaderSizeY()
      Returns the height of the image as specified in the header.
      Returns:
      See above.
    • getHeaderSizeC

      public Short getHeaderSizeC()
      Returns the number of channels the image has as specified in the header.
      Returns:
      See above.
    • getHeaderPixelType

      public Integer getHeaderPixelType()
      Returns the pixel type as specified in the header.
      Returns:
      See above.
    • getCodestreamSizeX

      public Integer getCodestreamSizeX()
      Returns the width of the image as specified in the header.
      Returns:
      See above.
    • getCodestreamSizeY

      public Integer getCodestreamSizeY()
      Returns the height of the image as specified in the header.
      Returns:
      See above.
    • getCodestreamSizeC

      public Short getCodestreamSizeC()
      Returns the number of channels the image has as specified in the header.
      Returns:
      See above.
    • getCodestreamPixelType

      public Integer getCodestreamPixelType()
      Returns the pixel type as specified in the header.
      Returns:
      See above.
    • getLookupTable

      public int[][] getLookupTable()
      Returns the color lookup table stored in the file, or null if a lookup table is not present.
      Returns:
      See above.
    • convertPixelType

      private int convertPixelType(int type)