|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.tree.DefaultMutableTreeNode PIRL.PVL.Parameter PIRL.Image_Tools.JPEG2000_Info PIRL.Image_Tools.JPEG2000_Codestream_Info
public class JPEG2000_Codestream_Info
JPEG2000_Codestream_Info provides a set of PVL Parameters that describe the contents of a JPEG2000 codestream.
The JPEG2000 codestream format is defined in Part 1 of the JPEG2000 International Standard (ISO/IEC 15444-1:2004(E); "Information technology - JPEG 2000 image coding system: Core coding system"). This format is composed entirely of a contiguous sequence of codestream segment. Each segment is prefaced with a marker that identifies the segement. The marker is followed by length. Boxes may be nested within other boxes.
JP2_Info
,
JPEG2000_Info
,
Serialized FormFields inherited from class PIRL.PVL.Parameter |
---|
AGGREGATE, ASSIGNMENT, BEGIN_GROUP, BEGIN_OBJECT, END, END_AGGREGATE, END_GROUP, END_OBJECT, END_PVL, GROUP, HIGHEST_BIT, LOWEST_BIT, MASK, OBJECT, TOKEN |
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode |
---|
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject |
Constructor Summary | |
---|---|
JPEG2000_Codestream_Info()
Construct a an empty JPEG2000_Codestream_Info Object. |
|
JPEG2000_Codestream_Info(File file)
Construct a JPEG2000_Codestream_Info for a File. |
|
JPEG2000_Codestream_Info(File file,
boolean skip_tiles)
Construct a JPEG2000_Codestream_Info for a File. |
|
JPEG2000_Codestream_Info(ImageInputStream image_input_stream)
Construct a JPEG2000_Codestream_Info for an ImageInputStream. |
|
JPEG2000_Codestream_Info(ImageInputStream image_input_stream,
boolean skip_tiles)
Construct a JPEG2000_Codestream_Info for an ImageInputStream. |
|
JPEG2000_Codestream_Info(ImageInputStream image_input_stream,
long end_position,
boolean skip_tiles)
Construct a JPEG2000_Codestream_Info for an ImageInputStream and Reads the stream up to an end position. |
|
JPEG2000_Codestream_Info(String filename)
Construct a JPEG2000_Codestream_Info for a named file. |
|
JPEG2000_Codestream_Info(String filename,
boolean skip_tiles)
Construct a JPEG2000_Codestream_Info for a named file. |
Method Summary | |
---|---|
int |
Codestream_Validity()
Get the codestream validity flags. |
long |
Horizontal_Image_Offset()
Get the horizontal offset of the image on the reference grid. |
long |
Horizontal_Tile_Offset()
Get the horizontal offset of the tiles on the reference grid. |
long |
Image_Height()
Get the height of the image. |
long |
Image_Width()
Get the width of the image. |
boolean |
Is_Complete_Codestream()
Test if the Source file contains a complete codestream. |
static void |
main(String[] arguments)
Report the JPEG2000 codestream segments found in a raw codestream file. |
static String |
Marker_Name(int marker)
|
int[] |
Pixel_Height()
Get the height of a component's pixel. |
int[] |
Pixel_Width()
Get the width of a component's pixel. |
int |
Progression_Order()
Get the codestream default progression order. |
JPEG2000_Codestream_Info |
Read()
Read JPEG2000 codestream information from the Source file. |
JPEG2000_Codestream_Info |
Read(long end_position,
boolean skip_tiles)
Read JPEG2000 codestream information from the Source file. |
long |
Reference_Grid_Height()
Get the height of the image components reference grid. |
long |
Reference_Grid_Width()
Get the width of the image components reference grid. |
static Parameter |
Segments(byte[] data)
Assemble a Parameter Aggregate describing a sequence of codestream segments from a byte array. |
static Parameter |
Segments(byte[] data,
boolean skip_tiles)
Assemble a Parameter Aggregate describing a sequence of codestream segments from a byte array. |
static Parameter |
Segments(byte[] data,
int offset,
int length)
Assemble a Parameter Aggregate describing a sequence of codestream segments from a byte array. |
static Parameter |
Segments(byte[] data,
int offset,
int length,
boolean skip_tiles)
Assemble a Parameter Aggregate describing a sequence of codestream segments from a byte array. |
long |
Tile_Height()
Get the tile height. |
long |
Tile_Width()
Get the tile width. |
int |
Total_Components()
Get the total number of components identified in the codestream. |
int |
Total_Quality_Layers()
Get the total number of quality layers in the codestream. |
int |
Total_Resolution_Levels()
Get the total number of resolution levels. |
int |
Total_Tiles()
Get the total tiles expected to be found in the codestream. |
int |
Transform()
Get the form of the codestream transformation. |
static void |
Usage()
Print the command line usage syntax. |
long |
Vertical_Image_Offset()
Get the vertical offset of the image on the reference grid. |
long |
Vertical_Tile_Offset()
Get the vertical offset of the tiles on the reference grid. |
boolean |
Zero_Length_Tile_Part()
Test if a final tile-part of zero (unknown) length was found in the codestream. |
Methods inherited from class PIRL.Image_Tools.JPEG2000_Info |
---|
Data_Offset_Parameters, Data_Position_Parameters, int_Array, int_Array, int_Array, Read_byte, Read_int, Read_long, Read_short, Read_String, Read_Unsigned_byte, Read_Unsigned_int, Read_Unsigned_short, Read_Value, Skip_Tiles, Skip_Tiles, Source, Source, Source, Source, Stream_Position, Stream_Position, Throw_Illegal_State, Throw_Illegal_State, Use_Data_Position, Use_Data_Position, Value_Bits_Parameter, Value_Bits_Parameter |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ID
public static final String CODESTREAM
public static final int RESERVED_DELIMITER_MARKER_MIN
public static final int RESERVED_DELIMITER_MARKER_MAX
public static final int SOC_MARKER
public static final int SOT_MARKER
public static final int SOD_MARKER
public static final int EOC_MARKER
public static final int SIZ_MARKER
public static final int COD_MARKER
public static final int COC_MARKER
public static final int RGN_MARKER
public static final int QCD_MARKER
public static final int QCC_MARKER
public static final int POC_MARKER
public static final int TLM_MARKER
public static final int PLM_MARKER
public static final int PLT_MARKER
public static final int PPM_MARKER
public static final int PPT_MARKER
public static final int SOP_MARKER
public static final int EPH_MARKER
public static final int CRG_MARKER
public static final int COM_MARKER
public static final String SOC_NAME
public static final String SOT_NAME
public static final String SOD_NAME
public static final String EOC_NAME
public static final String SIZ_NAME
public static final String COD_NAME
public static final String COC_NAME
public static final String RGN_NAME
public static final String QCD_NAME
public static final String QCC_NAME
public static final String POC_NAME
public static final String TLM_NAME
public static final String PLM_NAME
public static final String PLT_NAME
public static final String PPM_NAME
public static final String PPT_NAME
public static final String SOP_NAME
public static final String EPH_NAME
public static final String CRG_NAME
public static final String COM_NAME
public static final String MARKER_PARAMETER
public static final String TILE_INDEX_PARAMETER
public static final String TILE_PART_LENGTH_PARAMETER
public static final String TILE_PART_INDEX_PARAMETER
public static final String TOTAL_TILE_PARTS_PARAMETER
public static final String CAPABILITY_PARAMETER
public static final String REFERENCE_GRID_WIDTH_PARAMETER
public static final String REFERENCE_GRID_HEIGHT_PARAMETER
public static final String HORIZONTAL_IMAGE_OFFSET_PARAMETER
public static final String VERTICAL_IMAGE_OFFSET_PARAMETER
public static final String TILE_WIDTH_PARAMETER
public static final String TILE_HEIGHT_PARAMETER
public static final String HORIZONTAL_TILE_OFFSET_PARAMETER
public static final String VERTICAL_TILE_OFFSET_PARAMETER
public static final String HORIZONTAL_SAMPLE_SPACING_PARAMETER
public static final String VERTICAL_SAMPLE_SPACING_PARAMETER
public static final String CODING_STYLE_PARAMETER
public static final String PROGRESSION_ORDER_PARAMETER
public static final String TOTAL_QUALITY_LAYERS_PARAMETER
public static final String MULTIPLE_COMPONENT_TRANSFORM_PARAMETER
public static final String TOTAL_RESOLUTION_LEVELS_PARAMETER
public static final String CODE_BLOCK_WIDTH_PARAMETER
public static final String CODE_BLOCK_HEIGHT_PARAMETER
public static final String CODE_BLOCK_STYLE_PARAMETER
public static final String TRANSFORM_PARAMETER
public static final String PRECINCT_SIZE_PARAMETER
public static final int ENTROPY_CODER_FLAG
public static final int SOP_FLAG
public static final int EPH_FLAG
public static final int LRCP_PROGRESSION_ORDER
public static final int RLCP_PROGRESSION_ORDER
public static final int RPCL_PROGRESSION_ORDER
public static final int PCRL_PROGRESSION_ORDER
public static final int CPRL_PROGRESSION_ORDER
public static final String[] PROGRESSION_ORDERS
public static final int SELECTIVE_ARITHMETIC_BYPASS_FLAG
public static final int RESET_CONTEXT_PROBABILITIES
public static final int TERMINATION_FLAG
public static final int VERTICALLY_CAUSAL_CONTEXT_FLAG
public static final int PREDICTABLE_TERMINATION_FLAG
public static final int SEGMENTATION_SYMBOLS_FLAG
public static final int TRANSFORM_IRREVERSIBLE
public static final int TRANSFORM_REVERSIBLE
public static final String COMPONENT_INDEX_PARAMETER
public static final String ROI_STYLE_PARAMETER
public static final String IMPLICIT_SHIFT_PARAMETER
public static final String QUANTIZATION_STYLE_PARAMETER
public static final String TOTAL_GUARD_BITS_PARAMETER
public static final String STEP_SIZE_PARAMETER
public static final int NO_QUANTIZATION
public static final int QUANTIZATION_SCALAR_DERIVED
public static final int QUANTIZATION_SCALAR_EXPOUNDED
public static final String LEVEL_INDEX_PARAMETER
public static final String LAYER_INDEX_PARAMETER
public static final String INDEX_PARAMETER
public static final String TILE_INDEX_SIZE_PARAMETER
public static final String TILE_PART_LENGTH_SIZE_PARAMETER
public static final String PACKET_LENGTH_PARAMETER
public static final String CONTINUATION_PARAMETER
public static final String HORIZONTAL_COMPONENT_OFFSET_PARAMETER
public static final String VERTICAL_COMPONENT_OFFSET_PARAMETER
public static final String DATA_TYPE_PARAMETER
public static final String BINARY_DATA_PARAMETER
public static final String TEXT_DATA_PARAMETER
public static final int DATA_TYPE_BINARY
public static final int DATA_TYPE_TEXT
public static final int SOC_FOUND
Codestream validity
bit mask
for the SOC segment found flag.
public static final int SIZ_FOUND
Codestream validity
bit mask
for the SIZ segment found flag.
public static final int COD_FOUND
Codestream validity
bit mask
for the COD segment found flag.
public static final int QCD_FOUND
Codestream validity
bit mask
for the QCD segment found flag.
public static final int EOC_FOUND
Codestream validity
bit mask
for the EOC segment found flag.
public static final int CODESTREAM_COMPLETE
Codestream validity
value
indicating that a complete codestream with all required segments
were found.
N.B.: The final EOC delimiter is not included as a
required segment as it is usually not searched for.
public static boolean EOC_Search
If true and the End of Codestream (EOC
) is not
found because the last tile-part segment has a zero length value, the
remaining codestream data will be searched for the EOC marker. If
false this search - which can be very time cosuming for a very large
codestream segment - will not be done and the codestream validity value
will not have the
EOC_FOUND
flag set.
By default the EOC search is disabled.
public static final int SUCCESS
public static final int SYNTAX_ERROR
public static final int IO_EXCEPTION
public static final int NO_INFO
public static final int PVL_ERROR
Constructor Detail |
---|
public JPEG2000_Codestream_Info(String filename) throws IOException
The inclusion of tile segments in the Parameters is controlled by the
JPEG2000_Info.Skip_Tiles_Default
flag.
filename
- The filename from which to obtain the
JPEG2000_Codestream_Info.
IOException
- If there was a problem reading the file.Read(long, boolean)
public JPEG2000_Codestream_Info(String filename, boolean skip_tiles) throws IOException
filename
- The filename from which to obtain the
JPEG2000_Codestream_Info.skip_tiles
- true if tile segments are not to be included
in the Parameters; false otherwise.
IOException
- If there was a problem reading the file.Read(long, boolean)
public JPEG2000_Codestream_Info(File file) throws IOException
The inclusion of tile segments in the Parameters is controlled by the
JPEG2000_Info.Skip_Tiles_Default
flag.
file
- The File from which to obtain the
JPEG2000_Codestream_Info.
IOException
- If there was a problem reading the file.Read(long, boolean)
public JPEG2000_Codestream_Info(File file, boolean skip_tiles) throws IOException
file
- The File from which to obtain the
JPEG2000_Codestream_Info.skip_tiles
- true if tile segments are not to be included
in the Parameters; false otherwise.
IOException
- If there was a problem reading the file.Read(long, boolean)
public JPEG2000_Codestream_Info(ImageInputStream image_input_stream) throws IOException
The inclusion of tile segments in the Parameters is controlled by the
JPEG2000_Info.Skip_Tiles_Default
flag.
image_input_stream
- The ImageInputStream from which to obtain
the JPEG2000_Codestream_Info.
IOException
- If there was a problem reading the file.Read(long, boolean)
public JPEG2000_Codestream_Info(ImageInputStream image_input_stream, boolean skip_tiles) throws IOException
image_input_stream
- The ImageInputStream from which to obtain
the JPEG2000_Codestream_Info.skip_tiles
- true if tile segments are not to be included
in the Parameters; false otherwise.
IOException
- If there was a problem reading the file.Read(long, boolean)
public JPEG2000_Codestream_Info(ImageInputStream image_input_stream, long end_position, boolean skip_tiles) throws IOException
image_input_stream
- The ImageInputStream containing a JPEG2000
codestream. The stream is presumed to be positioned at the beginning
of the codestream.end_position
- The byte position (exclusive) in the stream where
the codestream ends.skip_tiles
- true if tile segments are not to be included
in the Parameters; false otherwise.
IOException
- If a problem is encountered while reading the stream.Read(long, boolean)
public JPEG2000_Codestream_Info()
Use one of the Source methods to assign a source file. Then use a Read method to obtain the information parameters.
JPEG2000_Info.Source(String)
,
Read(long, boolean)
Method Detail |
---|
public JPEG2000_Codestream_Info Read(long end_position, boolean skip_tiles) throws IOException
If no Source file has been assigned, nothing is done.
The Source is read from its current position up to, but not including, the end position. If the end position is 0 the file is read until an End_of_Codestream segment is found, no more recognized segments are found, or the end of file. If an unrecognized marker is encountered the stream is repositioned back to the location where the marker was read.
Any information Parameters currently present are removed. Then the file is scanned for JPEG2000 codestream marker segments. Each segment found is used to define the contents of a Parameter Group added to the base JPEG2000_Info Aggregate. The name of each Parameter Group is the name associated with the marker. The Group always contains the following parameters:
data position inclusion
is
disabled.
The remaining Parameters in each Group depend on the segment type.
When JP2 information boxes are nested, the corresponding Parameter Groups are also nested. JPEG2000 codestream (Contiguous_Codestream, jp2c) boxes contain a Codestream Parameter Group that is defined by a JPEG2000_Info object.
N.B.: Unless illegal state detection
is disabled, a JPEG2000_Info.WARNING_PARAMETER
will be placed at the end of the Parameter set and further Source
file scanning halted if the previous segment is invalid. The Value of
the warning Parameter will be a String describing the problem.
Possible sources of warning parameters are: The beginning of the
codestream does not contain a valid Start_of_Codestream segment or
the second segment is not a valid Size segment.
end_position
- The location in the Source stream before which
reading is to stop. If 0 reading stops at the first unrecognized
segment marker or the end of file.skip_tiles
- true if tile segments are not to be included
in the Parameters; false otherwise.
IOException
- If there was a problem reading the Source file.JPEG2000_Info
public JPEG2000_Codestream_Info Read() throws IOException
IOException
- If there was a problem reading the Source.Read(long, boolean)
public boolean Is_Complete_Codestream()
The Source must be read
for this test to be valid.
Codestream
Validity
value has all the CODESTREAM_COMPLETE
flags
set; false otherwise.public int Codestream_Validity()
SIZ_FOUND
,
COD_FOUND
,
QCD_FOUND
,
EOC_FOUND
,
CODESTREAM_COMPLETE
public int Total_Components()
This value corresponds to the value of the JPEG2000_Info.TOTAL_COMPONENTS_PARAMETER
.
public long Image_Width()
The image width .
public long Image_Height()
This value corresponds to the value of the REFERENCE_GRID_HEIGHT_PARAMETER
.
public long Reference_Grid_Width()
This value corresponds to the value of the REFERENCE_GRID_WIDTH_PARAMETER
.
public long Reference_Grid_Height()
This value corresponds to the value of the REFERENCE_GRID_HEIGHT_PARAMETER
.
public long Horizontal_Image_Offset()
The horizontal offset to the upper left corner of the image area
will always be positive (to the right relative to the reference grid
origin at the upper left corner of the reference grid). This value
corresponds to the value of the HORIZONTAL_IMAGE_OFFSET_PARAMETER
.
public long Vertical_Image_Offset()
The vertical offset to the upper left corner of the image area will
always be positive (downwards relative to the reference grid origin
at the upper left corner of the reference grid). This value
corresponds to the value of the VERTICAL_IMAGE_OFFSET_PARAMETER
.
public int[] Pixel_Width()
The width of a pixel is measured in reference grid units. Each
component of the image may have a differenct pixel width. This
value array corresponds to the array of the HORIZONTAL_SAMPLE_SPACING_PARAMETER
.
public int[] Pixel_Height()
The height of a pixel is measured in reference grid units. Each
component of the image may have a differenct pixel height. This
value array corresponds to the array of the VERTICAL_SAMPLE_SPACING_PARAMETER
.
public long Tile_Width()
This value corresponds to the value of the TILE_WIDTH_PARAMETER
.
public long Tile_Height()
This value corresponds to the value of the TILE_HEIGHT_PARAMETER
.
public long Horizontal_Tile_Offset()
The horizontal offset to the upper left corner of the upper left
tile will always be positive (to the right relative to the reference
grid origin at the upper left corner of the reference grid) and no
greather than the horizontal image
offset
. This value corresponds to the value of the HORIZONTAL_IMAGE_OFFSET_PARAMETER
.
public long Vertical_Tile_Offset()
The vertical offset to the upper left corner of the upper left tile
will always be positive (downwards relative to the reference grid
origin at the upper left corner of the reference grid) and no
greather than the vertical image
offset
. This value corresponds to the value of the VERTICAL_IMAGE_OFFSET_PARAMETER
.
public int Total_Tiles()
public boolean Zero_Length_Tile_Part()
If a tile-part of zero length is found in the codestream it must be
the last tile-part before the EOC marker. If EOC_Search
has
been set the tile-part will be searched for the final EOC delimiter
segment.
public int Total_Quality_Layers()
This value corresponds to the value of the TOTAL_QUALITY_LAYERS_PARAMETER
.
public int Progression_Order()
Use the PROGRESSION_ORDERS
String array to obtain a
description of the progression order code.
This value corresponds to the value of the PROGRESSION_ORDER_PARAMETER
.
LRCP_PROGRESSION_ORDER
, RLCP_PROGRESSION_ORDER
, RPCL_PROGRESSION_ORDER
,
PCRL_PROGRESSION_ORDER
, or CPRL_PROGRESSION_ORDER
. This will be -1 if the value is not
yet known.public int Total_Resolution_Levels()
The value is obtained from the first coding style default (COD)
segment encountered in the codestream. This is expected to be from
the image and tile size (SIZ) segment. But if a tile header is
independently parsed and it contains a COD segment then that will be
used. N.B.: The value is never obtained from a coding style
component (COC) segment. This value corresponds to the value of
the TOTAL_RESOLUTION_LEVELS_PARAMETER
.
The total number of resolution levels is one more than the maximum decomposition level.
public int Transform()
The value is obtained from the first coding style default (COD)
segment encountered in the codestream. This is expected to be from
the image and tile size (SIZ) segment. But if a tile header is
independently parsed and it contains a COD segment then that will
be used. N.B.: The value is never obtained from a coding
style component (COC) segment. This value corresponds to the value
of the TRANSFORM_PARAMETER
.
TRANSFORM_IRREVERSIBLE
(0) for the 9-7 irreversible filter; it
will be TRANSFORM_REVERSIBLE
(1) for the 5-3 reversible
filter. This will be -1 if the value is not yet known.public static Parameter Segments(byte[] data, int offset, int length, boolean skip_tiles)
A sequence of codestream segments is parsed from the byte data. All
segments found are parsed. Including data position
parameters is disabled as is illegal codestream segment
organizaion detection
.
data
- A byte array.offset
- The offset where the codestream segments are expected
to start.length
- The maximum amount of byte data to be read. However,
if the data array ends before length bytes after the starting
offset, then only the available bytes will be read.skip_tiles
- true if tile segments are not to be included
in the Parameters; false otherwise.
public static Parameter Segments(byte[] data, int offset, int length)
The JPEG2000_Info.Skip_Tiles_Default
flag determines if tile segments
will be skipped.
data
- A byte array.offset
- The offset where the codestream segments are expected
to start.length
- The maximum amount of byte data to be read. However,
if the data array ends before length bytes after the starting
offset, then only the available bytes will be read.
Segments(byte[], int, int, boolean)
public static Parameter Segments(byte[] data, boolean skip_tiles)
data
- A byte array.skip_tiles
- true if tile segments are not to be included
in the Parameters; false otherwise.
Segments(byte[], int, int, boolean)
public static Parameter Segments(byte[] data)
The JPEG2000_Info.Skip_Tiles_Default
flag determines if tile segments
will be skipped.
data
- A byte array.
Segments(byte[], int, int, boolean)
public static String Marker_Name(int marker) throws IOException
IOException
public static void main(String[] arguments)
arguments
- The arguments String array.Usage()
public static void Usage()
JPEG2000_Codestream_Info [-[No_]Tiles] [-Gui] [-Find <parameter>] [-Pattern <regex>] <source>
The contents of the specified file are scanned for raw (not contained within a JP2 file) JPEG2000 codestream segments. The information found is reported in the form of PVL parameters containing all the data element values.
Tiles segment parameters are to be included (or not). The default is not to include tile segment parameters.
The information PVL is provided in a GUI viewer. The default is to provide a terminal listing.
The named parameter is listed. This option may be repeated to obtain a listing of all parameters specified.
The parameters with names that match the regular expression are listed. This option may also be repeated.
N.B.This method always results in a System.exit with a status of 1.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |