CADI.Common.LogicalTarget.JPEG2000.File
Class ReadJPXFile

java.lang.Object
  extended by CADI.Common.LogicalTarget.JPEG2000.File.ReadJPXFile
All Implemented Interfaces:
JPXBoxIdentifiers

public class ReadJPXFile
extends java.lang.Object
implements JPXBoxIdentifiers

Read a JPX file format (ISO/IEC 15444-2 annex M)

Version:
1.0 2008/10/06
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  boolean bppVariation
          Boolean indicating if there are components with different bit depths from others
private  int CTType
          Definition in CADI.Common.LogicalTarget.JPEG2000.Parameters.CODParameters#CTType
private  BufferedDataInputStream in
          Is an object with the input stream where the main header is read from.
private  JPCParameters jpcParameters
          Is an object where the main header are saved.
private  boolean[] LSSignedComponents
          Definition in SIZParameters.signed
private  long mainHeaderInitialPos
          Is the file pointer to the first byte of the main header.
private  int mainHeaderLength
          Is the length of the main header.
private  int[] QComponentsBits
          Definition in SIZParameters.precision
(package private)  boolean readerRequirementsTypeFound
           
private  int xSize
          Definition in SIZParameters.xSize
private  int ySize
          Definition in SIZParameters.ySize
private  int zSize
          Definition in SIZParameters.zSize
 
Fields inherited from interface CADI.Common.LogicalTarget.JPEG2000.File.JPXBoxIdentifiers
BITS_PER_COMPONENT_BOX_TYPE, CAPTURE_RESOLUTION_BOX_TYPE, CHANNEL_DEFINITION_BOX_TYPE, CODESTREAM_HEADER_BOX_TYPE, CODESTREAM_REGISTRATION_BOX_TYPE, COLOR_GROUP_BOX_TYPE, COLOR_SPECIFICATION_BOX_TYPE, COMPONENT_MAPPING_BOX_TYPE, COMPOSITION_LAYER_HEADER_BOX_TYPE, CONTIGUOUS_CODESTREAM_BOX_TYPE, DEFAULT_DISPLAY_RESOLUTION_BOX_TYPE, FILE_TYPE_BOX_BRAND_JP2, FILE_TYPE_BOX_BRAND_JPX, FILE_TYPE_BOX_TYPE, IMAGE_HEADER_BOX_TYPE, JP2_HEADER_BOX_TYPE, LABEL_BOX_TYPE, OPACITY_BOX_TYPE, PALETTE_BOX_TYPE, READER_REQUIREMENTS_BOX_TYPE, RESOLUTION_BOX_TYPE, SIGNATURE_BOX_CONTENT, SIGNATURE_BOX_LENGTH, SIGNATURE_BOX_TYPE
 
Constructor Summary
ReadJPXFile(BufferedDataInputStream in)
          Constructor.
 
Method Summary
 JPCParameters getJPCParameters()
          Returns the jpcParameters attribute.
 long getMainHeaderInitialPos()
          Returns the mainHeaderInitialPos attribute.
 int getMainHeaderLength()
          Returns the mainHeaderLength attribute.
private  void readAssociationBox(long length)
           
private  void readBinaryFilterBox(long length)
           
private  void readBitsPerComponentBox(long length)
          Reads the Bits Per Component Box and retrieves the parameters contained.
private  void readChannelDefinitionBox(long length)
          Reads the Channel Definition Box and retrives the parameters contained.
private  void readCodestreamHeaderBox(long length)
           
private  void readColourSpecificationBox(long length)
          Reads the Colour Specification Box and retrieves the parameters contained.
private  void readComponentMappingBox(long length)
          Reads the Component Mapping Box and retrieves the parameters contained.
private  void readCompositionBox(long length)
           
private  void readCompositionLayerHeaderBox(long length)
           
private  void readContiguousCodestreamBox(long length)
           
private  void readCrossReferenceBox(long length)
           
private  void readDataReferenceBox(long length)
           
private  void readDesiredReproductionsBox(long length)
           
private  void readDigitalSignatureBox(long length)
           
private  void readFragmentTableBox(long length)
           
private  void readFreeBox(long length)
           
private  boolean readImageHeaderBox()
          Reads the Image Header Box and retrieves the parameters contained.
private  void readIntellectualPropertyRightsBox(long length)
           
private  void readLabelBox(long length)
          Reads the Label Box and retrieves the parameters contained.
private  void readMediaDataBox(long length)
           
private  void readMPEG7BinayrBox(long length)
           
private  void readPaletteBox(long length)
          Reads the Palette Box and retrives the parameters contained.
private  void readRequirementsBox(long length)
           
private  void readResolutionSuperBox(long length)
          Read the resolution box.
private  void readROIDescriptionBox(long length)
           
private  void readUUIDBox(long length)
           
private  void readUUIDInfoBox(long length)
           
private  void readXMLBox(long length)
           
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

private BufferedDataInputStream in
Is an object with the input stream where the main header is read from.


jpcParameters

private JPCParameters jpcParameters
Is an object where the main header are saved.


readerRequirementsTypeFound

boolean readerRequirementsTypeFound

bppVariation

private boolean bppVariation
Boolean indicating if there are components with different bit depths from others


zSize

private int zSize
Definition in SIZParameters.zSize


ySize

private int ySize
Definition in SIZParameters.ySize


xSize

private int xSize
Definition in SIZParameters.xSize


LSSignedComponents

private boolean[] LSSignedComponents
Definition in SIZParameters.signed


CTType

private int CTType
Definition in CADI.Common.LogicalTarget.JPEG2000.Parameters.CODParameters#CTType


QComponentsBits

private int[] QComponentsBits
Definition in SIZParameters.precision


mainHeaderInitialPos

private long mainHeaderInitialPos
Is the file pointer to the first byte of the main header.


mainHeaderLength

private int mainHeaderLength
Is the length of the main header.

Constructor Detail

ReadJPXFile

public ReadJPXFile(BufferedDataInputStream in)
Constructor.

Parameters:
in - input stream where data will be read from.
Method Detail

run

public void run()
         throws ErrorException,
                java.io.EOFException,
                java.io.IOException
Throws:
ErrorException
java.io.EOFException
java.io.IOException

getJPCParameters

public JPCParameters getJPCParameters()
Returns the jpcParameters attribute.

Returns:
the jpcParameters attribute.

getMainHeaderInitialPos

public long getMainHeaderInitialPos()
Returns the mainHeaderInitialPos attribute.

Returns:
the mainHeaderInitialPos attribute.

getMainHeaderLength

public int getMainHeaderLength()
Returns the mainHeaderLength attribute.

Returns:
the mainHeaderLength attribute.

readRequirementsBox

private void readRequirementsBox(long length)
                          throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readCodestreamHeaderBox

private void readCodestreamHeaderBox(long length)
                              throws java.io.IOException,
                                     ErrorException
Parameters:
length -
Throws:
java.io.IOException
ErrorException

readCompositionLayerHeaderBox

private void readCompositionLayerHeaderBox(long length)
                                    throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readDataReferenceBox

private void readDataReferenceBox(long length)
                           throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readFragmentTableBox

private void readFragmentTableBox(long length)
                           throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readContiguousCodestreamBox

private void readContiguousCodestreamBox(long length)
                                  throws java.io.IOException,
                                         ErrorException
Parameters:
length -
Throws:
java.io.IOException
ErrorException

readMediaDataBox

private void readMediaDataBox(long length)
                       throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readCompositionBox

private void readCompositionBox(long length)
                         throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readDesiredReproductionsBox

private void readDesiredReproductionsBox(long length)
                                  throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readROIDescriptionBox

private void readROIDescriptionBox(long length)
                            throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readCrossReferenceBox

private void readCrossReferenceBox(long length)
                            throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readAssociationBox

private void readAssociationBox(long length)
                         throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readBinaryFilterBox

private void readBinaryFilterBox(long length)
                          throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readDigitalSignatureBox

private void readDigitalSignatureBox(long length)
                              throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readMPEG7BinayrBox

private void readMPEG7BinayrBox(long length)
                         throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readFreeBox

private void readFreeBox(long length)
                  throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readXMLBox

private void readXMLBox(long length)
                 throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readUUIDBox

private void readUUIDBox(long length)
                  throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readIntellectualPropertyRightsBox

private void readIntellectualPropertyRightsBox(long length)
                                        throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readUUIDInfoBox

private void readUUIDInfoBox(long length)
                      throws java.io.IOException
Parameters:
length -
Throws:
java.io.IOException

readImageHeaderBox

private boolean readImageHeaderBox()
                            throws ErrorException,
                                   java.io.EOFException,
                                   java.io.IOException
Reads the Image Header Box and retrieves the parameters contained.

Returns:
bppVariation - definition in bppVariation
Throws:
ErrorException - when the header information is ambiguous or incorrect
java.io.EOFException
java.io.IOException

readLabelBox

private void readLabelBox(long length)
                   throws ErrorException,
                          java.io.EOFException,
                          java.io.IOException
Reads the Label Box and retrieves the parameters contained.

Throws:
ErrorException - when the header information is ambiguous or incorrect
java.io.EOFException
java.io.IOException

readBitsPerComponentBox

private void readBitsPerComponentBox(long length)
                              throws ErrorException,
                                     java.io.EOFException,
                                     java.io.IOException
Reads the Bits Per Component Box and retrieves the parameters contained.

Throws:
ErrorException - when the header information is ambiguous or incorrect
java.io.EOFException
java.io.IOException

readColourSpecificationBox

private void readColourSpecificationBox(long length)
                                 throws ErrorException,
                                        java.io.EOFException,
                                        java.io.IOException
Reads the Colour Specification Box and retrieves the parameters contained.

Parameters:
length - the length of the box content
Throws:
ErrorException - when the header information is ambiguous or incorrect
java.io.EOFException
java.io.IOException

readPaletteBox

private void readPaletteBox(long length)
                     throws ErrorException,
                            java.io.IOException
Reads the Palette Box and retrives the parameters contained. NOTICE: This method is not finished.

Parameters:
length - the length of the box.
Throws:
java.io.IOException
ErrorException

readComponentMappingBox

private void readComponentMappingBox(long length)
                              throws ErrorException,
                                     java.io.IOException
Reads the Component Mapping Box and retrieves the parameters contained.

Parameters:
length - lenth of the box content.
Throws:
java.io.IOException
ErrorException

readChannelDefinitionBox

private void readChannelDefinitionBox(long length)
                               throws ErrorException,
                                      java.io.IOException
Reads the Channel Definition Box and retrives the parameters contained.

Parameters:
length - length of the box content.
Throws:
ErrorException
java.io.IOException

readResolutionSuperBox

private void readResolutionSuperBox(long length)
                             throws ErrorException,
                                    java.io.IOException
Read the resolution box. NOTICE: This method only read the values but they are not saved.

Parameters:
length -
Throws:
java.io.IOException
ErrorException


CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Group on Interactive Coding of Images (GICI) (contact)