Package loci.formats.in
Class JPEG2000MetadataParser
java.lang.Object
loci.formats.in.JPEG2000MetadataParser
A parser for JPEG 2000 metadata.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longOffset to first contiguous codestream.private IntegerPixel type as specified in the JPEG 2000 codestream..private ShortNumber of channels the image as specified in the JPEG 2000 codestream.private IntegerWidth of the image as specified in the JPEG 2000 codestream.private IntegerHeight of the image as specified in the JPEG 2000 codestream.List of comments stored in the file.private IntegerPixel type as specified in the header.private ShortNumber of channels the image has as specified in the header.private IntegerWidth of the image as specified in the header.private IntegerHeight of the image as specified in the header.private loci.common.RandomAccessInputStreamStream that we're parsing metadata from.private booleanWhether or not the codestream is raw and not JP2 boxed.private static final org.slf4j.LoggerLogger for this class.private int[][]Color lookup table stored in the file.private longMaximum read offset within in the stream.private IntegerNumber of JPEG 2000 resolution levels the file has. -
Constructor Summary
ConstructorsConstructorDescriptionJPEG2000MetadataParser(loci.common.RandomAccessInputStream in) Constructs a new JPEG2000MetadataParser.JPEG2000MetadataParser(loci.common.RandomAccessInputStream in, long maximumReadOffset) Constructs a new JPEG2000MetadataParser. -
Method Summary
Modifier and TypeMethodDescriptionprivate intconvertPixelType(int type) longRetrieves the offset to the first contiguous codestream.Returns the pixel type as specified in the header.Returns the number of channels the image has as specified in the header.Returns the width of the image as specified in the header.Returns the height of the image as specified in the header.Retrieves the list of comments stored in the file.Returns the pixel type as specified in the header.Returns the number of channels the image has as specified in the header.Returns the width of the image as specified in the header.Returns the height of the image as specified in the header.int[][]Returns the color lookup table stored in the file, or null if a lookup table is not present.Returns the number of resolution levels the file JPEG 2000 data has.booleanWhether or not the codestream is raw and not JP2 boxed.private voidParses the JPEG 2000 JP2 metadata boxes.private voidparseContiguousCodestream(long length) Parses the JPEG 2000 codestream metadata.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGERLogger for this class. -
in
private loci.common.RandomAccessInputStream inStream that we're parsing metadata from. -
codestreamOffset
private long codestreamOffsetOffset to first contiguous codestream. -
maximumReadOffset
private long maximumReadOffsetMaximum read offset within in the stream. -
headerSizeX
Width of the image as specified in the header. -
headerSizeY
Height of the image as specified in the header. -
headerSizeC
Number of channels the image has as specified in the header. -
headerPixelType
Pixel type as specified in the header. -
codestreamSizeX
Width of the image as specified in the JPEG 2000 codestream. -
codestreamSizeY
Height of the image as specified in the JPEG 2000 codestream. -
codestreamSizeC
Number of channels the image as specified in the JPEG 2000 codestream. -
codestreamPixelType
Pixel type as specified in the JPEG 2000 codestream.. -
isRawCodestream
private boolean isRawCodestreamWhether or not the codestream is raw and not JP2 boxed. -
resolutionLevels
Number of JPEG 2000 resolution levels the file has. -
lut
private int[][] lutColor lookup table stored in the file. -
comments
List of comments stored in the file.
-
-
Constructor Details
-
JPEG2000MetadataParser
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
Retrieves the list of comments stored in the file. -
parseBoxes
Parses the JPEG 2000 JP2 metadata boxes.- Throws:
IOException- Thrown if there is an error reading from the file.
-
parseContiguousCodestream
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:
trueif the codestream is raw andfalseotherwise.
-
getResolutionLevels
Returns the number of resolution levels the file JPEG 2000 data has.- Returns:
- The number of resolution levels or
nullif the number cannot be parsed.
-
getHeaderSizeX
Returns the width of the image as specified in the header.- Returns:
- See above.
-
getHeaderSizeY
Returns the height of the image as specified in the header.- Returns:
- See above.
-
getHeaderSizeC
Returns the number of channels the image has as specified in the header.- Returns:
- See above.
-
getHeaderPixelType
Returns the pixel type as specified in the header.- Returns:
- See above.
-
getCodestreamSizeX
Returns the width of the image as specified in the header.- Returns:
- See above.
-
getCodestreamSizeY
Returns the height of the image as specified in the header.- Returns:
- See above.
-
getCodestreamSizeC
Returns the number of channels the image has as specified in the header.- Returns:
- See above.
-
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)
-