|
|||||||||
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.JP2_Info
public class JP2_Info
JP2_Info provides a set of PVL Parameters that describe the contents of a JP2 file.
The JP2 file 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 file format is composed entirely of a contiguous sequence of boxes. Each box has a type and length. Boxes may be nested within other boxes.
JPEG2000_Info
,
JPEG2000_Codestream_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 | |
---|---|
JP2_Info()
Construct an empty JP2_Info Object. |
|
JP2_Info(File file)
Construct JP2_Info for a File. |
|
JP2_Info(File file,
boolean skip_tiles)
Construct JP2_Info for a File. |
|
JP2_Info(ImageInputStream image_input_stream)
Construct JP2_Info for an ImageInputStream. |
|
JP2_Info(ImageInputStream image_input_stream,
boolean skip_tiles)
Construct JP2_Info for an ImageInputStream. |
|
JP2_Info(String source)
Construct JP2_Info for a named source. |
|
JP2_Info(String source,
boolean skip_tiles)
Construct JP2_Info for a named source. |
Method Summary | |
---|---|
int[] |
Bits_per_Component()
Get the number of bits per pixel for each component in the image. |
static String |
Box_Name(int type_code)
Get the descriptive box name for a box type. |
static Parameter |
Box(byte[] data)
Assemble a Parameter Aggregate from a byte array of JP2 box data. |
static Parameter |
Box(byte[] data,
int offset,
int length)
Assemble a Parameter Aggregate describing a JP2 box from a byte array. |
int |
Codestream_Validity()
Get the JPEG2000_Codestream_Info.Codestream_Validity() value. |
long |
Horizontal_Image_Offset()
Get the JPEG2000_Codestream_Info.Horizontal_Image_Offset() value. |
long |
Horizontal_Tile_Offset()
Get the JPEG2000_Codestream_Info.Horizontal_Tile_Offset() value. |
long |
Image_Height()
Get the height of the image. |
long |
Image_Width()
Get the width of the image. |
static String |
int_to_String(int value)
Convert an int value to a String. |
boolean |
Is_Complete_JP2()
Test if the Source file contains a complete JP2 format. |
boolean |
Is_JP2()
Test if the Source is a file in JP2 format. |
int |
JP2_Validity()
Get the current JP2 validity flags. |
static void |
main(String[] arguments)
Report the JP2_Info found in a file. |
int[] |
Pixel_Height()
Get the JPEG2000_Codestream_Info.Pixel_Height() value. |
int[] |
Pixel_Width()
Get the JPEG2000_Codestream_Info.Pixel_Width() value. |
int |
Progression_Order()
Get the JPEG2000_Codestream_Info.Progression_Order() value. |
JP2_Info |
Read(boolean skip_tiles)
Read all available information from the Source file. |
long |
Reference_Grid_Height()
Get the JPEG2000_Codestream_Info.Reference_Grid_Height() value. |
long |
Reference_Grid_Width()
Get the JPEG2000_Codestream_Info.Reference_Grid_Width() value. |
long |
Tile_Height()
Get the JPEG2000_Codestream_Info.Tile_Height() value. |
long |
Tile_Width()
Get the JPEG2000_Codestream_Info.Tile_Width() value. |
int |
Total_Components()
Get the number of components (bands) in the image. |
int |
Total_Quality_Layers()
Get the JPEG2000_Codestream_Info.Total_Quality_Layers() value. |
int |
Total_Resolution_Levels()
Get the JPEG2000_Codestream_Info.Total_Resolution_Levels() value. |
int |
Total_Tiles()
Get the JPEG2000_Codestream_Info.Total_Tiles() value. |
int |
Transform()
Get the JPEG2000_Codestream_Info.Transform() value. |
static void |
Usage()
Print the command line usage syntax. |
long |
Vertical_Image_Offset()
Get the JPEG2000_Codestream_Info.Vertical_Image_Offset() value. |
long |
Vertical_Tile_Offset()
Get the JPEG2000_Codestream_Info.Vertical_Tile_Offset() value. |
boolean |
Zero_Length_Tile_Part()
Test if a zero
length tile-part 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 int SIGNATURE_TYPE
public static final int FILE_TYPE
public static final int HEADER_TYPE
public static final int IMAGE_HEADER_TYPE
public static final int BITS_PER_COMPONENT_TYPE
public static final int COLOUR_SPECIFICATION_TYPE
public static final int PALETTE_TYPE
public static final int COMPONENT_MAPPING_TYPE
public static final int CHANNEL_DEFINITION_TYPE
public static final int RESOLUTION_TYPE
public static final int CAPTURE_RESOLUTION_TYPE
public static final int DEFAULT_DISPLAY_RESOLUTION_TYPE
public static final int CONTIGUOUS_CODESTREAM_TYPE
public static final int INTELLECTUAL_PROPERTY_TYPE
public static final int XML_TYPE
public static final int UUID_TYPE
public static final int UUID_INFO_TYPE
public static final int UUID_LIST_TYPE
public static final int URL_TYPE
public static final int ASSOCIATION_TYPE
public static final int LABEL_TYPE
public static final int PLACEHOLDER_TYPE
public static final String SIGNATURE_NAME
public static final String FILE_NAME
public static final String HEADER_NAME
public static final String IMAGE_HEADER_NAME
public static final String BITS_PER_COMPONENT_NAME
public static final String COLOUR_SPECIFICATION_NAME
public static final String PALETTE_NAME
public static final String COMPONENT_MAPPING_NAME
public static final String CHANNEL_DEFINITION_NAME
public static final String RESOLUTION_NAME
public static final String CAPTURE_RESOLUTION_NAME
public static final String DEFAULT_DISPLAY_RESOLUTION_NAME
public static final String CONTIGUOUS_CODESTREAM_NAME
public static final String INTELLECTUAL_PROPERTY_NAME
public static final String XML_NAME
public static final String UUID_NAME
public static final String UUID_INFO_NAME
public static final String UUID_LIST_NAME
public static final String URL_NAME
public static final String ASSOCIATION_NAME
public static final String LABEL_NAME
public static final String PLACEHOLDER_NAME
public static final String NAME_PARAMETER
public static final String TYPE_PARAMETER
public static final String SIGNATURE_PARAMETER
public static final int SIGNATURE
public static final String BRAND_PARAMETER
public static final String MINOR_VERSION_PARAMETER
public static final String COMPATIBILITY_LIST_PARAMETER
public static final String JP2_COMPATIBLE
public static final String HEIGHT_PARAMETER
public static final String WIDTH_PARAMETER
public static final String COMPRESSION_TYPE_PARAMETER
public static final String COLORSPACE_UNKNOWN_PARAMETER
public static final String INTELLECTUAL_PROPERTY_PARAMETER
public static final String SPECIFICATION_METHOD_PARAMETER
public static final String PRECEDENCE_PARAMETER
public static final String COLOURSPACE_APPROXIMATION_PARAMETER
public static final String ENUMERATED_COLOURSPACE_PARAMETER
public static final int ENUMERATED_COLOURSPACE
public static final int RESTRICTED_ICC_PROFILE
public static final String ENTRIES_PARAMETER
public static final String COLUMNS_PARAMETER
public static final String VALUES_PARAMETER
public static final String MAP_PARAMETER
public static final int COMPONENT_INDEX
public static final int MAP_TYPE_INDEX
public static final int PALETTE_INDEX
public static final int DIRECT_USE
public static final int PALETTE_MAPPING
public static final int CHANNEL_INDEX
public static final int CHANNEL_TYPE_INDEX
public static final int CHANNEL_ASSOCIATION_INDEX
public static final int COLOUR_IMAGE_DATA
public static final int OPACITY
public static final int PREMULTIPLIED_OPACITY
public static final int IMAGE_ASSOCIATION
public static final int NO_ASSOCIATION
public static final String VERTICAL_NUMERATOR_PARAMETER
public static final String VERTICAL_DENOMINATOR_PARAMETER
public static final String VERTICAL_EXPONENT_PARAMETER
public static final String HORIZONTAL_NUMERATOR_PARAMETER
public static final String HORIZONTAL_DENOMINATOR_PARAMETER
public static final String HORIZONTAL_EXPONENT_PARAMETER
public static final String CODESTREAM_PARAMETER
public static final String UUID_PARAMETER
public static final int NUMBER_OF_UUID_VALUES
public static final String VERSION_PARAMETER
public static final String FLAGS_PARAMETER
public static final String URL_PARAMETER
public static final String TEXT_PARAMETER
public static final String ORIGINAL_BOX_PARAMETER
public static final String BIN_ID_PARAMETER
public static final String EQUIVALENT_BOX_PARAMETER
public static final String CODESTREAM_ID_PARAMETER
public static final String TOTAL_CODESTREAMS_PARAMETER
public static final String EXTENDED_BOX_LIST_PARAMETER
public static final int PLACEHOLDER_FLAGS_ORIGINAL_MASK
public static final int PLACEHOLDER_FLAGS_EQUIVALENT_MASK
public static final int PLACEHOLDER_FLAGS_CODESTREAM_MASK
public static final int PLACEHOLDER_FLAGS_MULTIPLE_CODESTREAM_MASK
protected int JP2_Validity
public static final int SIGNATURE_FOUND
public static final int FILE_TYPE_FOUND
public static final int JP2_HEADER_FOUND
public static final int IMAGE_HEADER_FOUND
public static final int COLOUR_SPECIFICATION_FOUND
public static final int CONTIGUOUS_CODESTREAM_FOUND
public static final int JP2_COMPLETE
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 JP2_Info(String source) throws IOException, UnknownHostException, IllegalArgumentException
The inclusion of tile segments in the Parameters is controlled by the
JPEG2000_Info.Skip_Tiles_Default
flag.
source
- The source from which to obtain the JP2_Info.
UnknownHostException
- If the source is a URL but the
hostname is specifies can not be resolved.
IllegalArgumentException
- If the source is a URL but does
not specify the http protocol or a source pahtname.
IOException
- If there was a problem reading the source.public JP2_Info(String source, boolean skip_tiles) throws IOException, UnknownHostException, IllegalArgumentException
source
- The source from which to obtain the JP2_Info.skip_tiles
- true if tile segments are not to be included
in the Parameters; false otherwise.
UnknownHostException
- If the source is a URL but the
hostname is specifies can not be resolved.
IllegalArgumentException
- If the source is a URL but does
not specify the http protocol or a source pathname.
IOException
- If there was a problem reading the source.public JP2_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 JP2_Info.
IOException
- If there was a problem reading the file.public JP2_Info(File file, boolean skip_tiles) throws IOException
file
- The File from which to obtain the JP2_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.public JP2_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 JP2_Info.
IOException
- If there was a problem reading the file.public JP2_Info(ImageInputStream image_input_stream, boolean skip_tiles) throws IOException
image_input_stream
- The ImageInputStream from which to obtain
the JP2_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.public JP2_Info()
Use one of the Source methods to assign a source file. Then use a Read method to obtain the JP2_Info Parameter set for the file.
JPEG2000_Info.Source(String)
,
Read(boolean)
Method Detail |
---|
public JP2_Info Read(boolean skip_tiles) throws IOException
If no Source file has been assigned, nothing is done.
The Source is read from the beginning. The Source stream will be repositioned back to its current position before the method returns.
Any information Parameters currently present are removed. Then the file is scanned for JP2 information boxes. Each box 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 JP2 box type composed of four characters (unprintable characters are represented by escape sequences). The Group always contains the following parameters:
data position inclusion
is
disabled.
The remaining Parameters in each Group depend on the box 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_Codestream_Info object.
N.B.: A JPEG2000_Info.WARNING_PARAMETER
will be placed at the end
of the Parameter set and further Source file scanning halted if the
previous JP2 box 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 Source file does not contain a
valid Signature box or the second box of the Source file is not a
valid File Type box.
skip_tiles
- true if tile segments are not to be included
in the Codestream Parameters; false otherwise.
IOException
- If there was a problem reading the Source file.JPEG2000_Codestream_Info
public boolean Is_JP2()
If the JP2 Validity
value has already been
determined by read
ing the Source file, then if
both the SIGNATURE_FOUND
and FILE_TYPE_FOUND
validity flags have been set the file is in JP2 format. Otherwise an
attempt is made to read the first two JP2 boxes from the beginning of
the file which will provide the minimally necessary validity flags.
In this case the Source is repositioned back to its previous position
after the attempt to read the boxes. If no Source as been assigned
then the return value is false.
public boolean Is_Complete_JP2()
The Source must be read
for this test to be valid.
JP2 Validity
value has
all the JP2_COMPLETE
flags set; false otherwise.public int JP2_Validity()
The bit flags in this value are updated as the Source file is
read
:
SIGNATURE_FOUND
FILE_TYPE_FOUND
JP2_HEADER_FOUND
IMAGE_HEADER_FOUND
COLOUR_SPECIFICATION_FOUND
CONTIGUOUS_CODESTREAM_FOUND
public int[] Bits_per_Component()
public int Codestream_Validity()
JPEG2000_Codestream_Info.Codestream_Validity()
value.
public int Total_Components()
If the value has not been obtained from the Image Header box the
value will be obtained from a JPEG2000 codestream
(Contiguous_Codestream, jp2c) box if available.
public long Image_Width()
The image width is the distance on the reference grid from the
horizontal
image offset
to the reference grid
width
. If the value has not been obtained from the Image Header box
the value will be obtained from a JPEG2000 codestream
(Contiguous_Codestream, jp2c) box if available.
N.B.: The image width is measured in terms of reference grid
columns. However, an individual image pixel may occupy more than one
reference grid column. The pixel width
may be
different for each image component.
public long Image_Height()
The image height is the distance on the reference grid from the
vertical
image offset
to the reference grid
height
. If the value has not been obtained from the Image Header
box the value will be obtained from a JPEG2000 codestream
(Contiguous_Codestream, jp2c) box if available.
N.B.: The image height is measured in terms of reference grid
rows. However, an individual image pixel may occupy more than one
reference grid row. The pixel height
may be
different for each image component.
public long Reference_Grid_Width()
JPEG2000_Codestream_Info.Reference_Grid_Width()
value.
public long Reference_Grid_Height()
JPEG2000_Codestream_Info.Reference_Grid_Height()
value.
public long Horizontal_Image_Offset()
JPEG2000_Codestream_Info.Horizontal_Image_Offset()
value.
public long Vertical_Image_Offset()
JPEG2000_Codestream_Info.Vertical_Image_Offset()
value.
public int[] Pixel_Width()
JPEG2000_Codestream_Info.Pixel_Width()
value.
public int[] Pixel_Height()
JPEG2000_Codestream_Info.Pixel_Height()
value.
public long Tile_Width()
JPEG2000_Codestream_Info.Tile_Width()
value.
public long Tile_Height()
JPEG2000_Codestream_Info.Tile_Height()
value.
public long Horizontal_Tile_Offset()
JPEG2000_Codestream_Info.Horizontal_Tile_Offset()
value.
public long Vertical_Tile_Offset()
JPEG2000_Codestream_Info.Vertical_Tile_Offset()
value.
public int Total_Tiles()
JPEG2000_Codestream_Info.Total_Tiles()
value.
public boolean Zero_Length_Tile_Part()
zero
length tile-part
was found in the codestream.
public int Total_Quality_Layers()
JPEG2000_Codestream_Info.Total_Quality_Layers()
value.
public int Progression_Order()
JPEG2000_Codestream_Info.Progression_Order()
value.
public int Total_Resolution_Levels()
JPEG2000_Codestream_Info.Total_Resolution_Levels()
value.
public int Transform()
JPEG2000_Codestream_Info.Transform()
value.
public static Parameter Box(byte[] data, int offset, int length)
A single JP2 box is parsed from the byte data. If the data contains
additional JP2 box contents they are ignored. Including data position
parameters is disabled as is illegal box organizaion
detection
.
data
- A byte array.offset
- The offset where the JP2 box is 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.
public static Parameter Box(byte[] data)
data
- A byte array.
Box(byte[], int, int)
public static String Box_Name(int type_code)
type_code
- The box type code value. This may be obtained
from the TYPE_PARAMETER
present in each box Parameter
Group.
NAME_PARAMETER
of each box Parameter Group.public static String int_to_String(int value)
Each byte, starting with the most significant byte, of the value is appended as a character to a String. Non-printable characters are expanded to escape sequences.
value
- The int value to be converted.
public static void main(String[] arguments)
arguments
- The arguments String array.Usage()
public static void Usage()
JP2_Info [-[No_]Tiles] [-Gui] [-Find <parameter>] [-Pattern <regex>] <source>
The contents of the specified file are scanned for JP2 file format boxes and 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 |