CADI.Server.LogicalTarget.JPEG2000
Class JP2LogicalTarget

java.lang.Object
  extended by CADI.Server.LogicalTarget.ServerLogicalTarget
      extended by CADI.Server.LogicalTarget.JPEG2000.JP2LogicalTarget

public class JP2LogicalTarget
extends ServerLogicalTarget

This class is used to save information about the indexing of the JPC image file.

Version:
1.1.0 2009/02/16
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  java.util.Hashtable<java.lang.Long,DataBinInfo> dataBins
          It is an array list with information about
private  int fileFormatType
           
private  int[][][][][][] imageStructure
          Definition in GenerateImageStructure.imageStructure
static int JP2
           
static int JPC
           
private  JPCParameters jpcParameters
          Contains the JPC image parameters.
static int JPK
           
static int JPX
           
private  long mainHeaderInitialPos
          Contains the main header position within the image file.
private  int mainHeaderLength
          Contains the main header length.
private  int MSBPlane
          The Most Significant Bit Plane of the whole image.
static int RATE_DISTORTION_METHOD_CoRD
           
static int RATE_DISTORTION_METHOD_CPI
           
static int RATE_DISTORTION_METHOD_FILE_ORDER
          Allowed values for the rateDistortionMethod attribute.
private  int rateDistortionMethod
          Indicates the rate-distortion method which is used to obtain the WOI for the client request.
 
Fields inherited from class CADI.Server.LogicalTarget.ServerLogicalTarget
in, logicalTargetType, target, tid, TID_DEFAULT_LENGTH
 
Constructor Summary
JP2LogicalTarget(int codestreamType, java.util.Hashtable<java.lang.Long,DataBinInfo> dataBins, JPCParameters jpcParameters, int rateDistortionMethod, int[][][][][][] imageStructure)
          Constructor.
JP2LogicalTarget(int codestreamType, java.util.Hashtable<java.lang.Long,DataBinInfo> dataBins, JPCParameters jpcParameters, long mainHeaderInitialPos, int mainHeaderLength)
          Constructor.
 
Method Summary
protected  void generateTid()
          It will generate a Target-ID for that logical target, i.e. a string that absolutely identifies the logical target.
 int getCodestreamType()
          Returns the fileFormatType attribute.
 int getDataBinLength(long inClassIdentifier)
          Returns the length of the data bin of which unique identifier is inClassIdentifier.
 long getFilePointerCodingPass(long inClassIdentifier, int subband, int yBlock, int xBlock, int codingPass)
           
 long[][][][] getFilePointersCodingPasses(long inClassIdentifier)
           
 int[][][][][][] getImageStructure()
           
 JPCParameters getJPCParameters()
          Returns the JPEG2000 parameters.
 int getLastCompleteLayer(long inClassIdentifier, long dataBinLength)
          Return the last complete layer that it can be whole recovered with dataBinLength bytes.
 int getLengthOfCodingPass(int z, int rLevel, int precinct, int subband, int yBlock, int xBlock, int codingPass)
           
 int getLengthOfCodingPass(long inClassIdentifier, int subband, int yBlock, int xBlock, int codingPass)
           
 int[][][][] getLengthsOfCodingPasses(int z, int rLevel, int precinct)
           
 int[][][][] getLengthsOfCodingPasses(long inClassIdentifier)
           
 long getMainHeaderInitialPos()
          Returns the file pointer to the JPEG2000 main header.
 int getMainHeaderLength()
          Returns the length of the JPEG2000 main header.
 int getMSBPlane()
          Returns the MSBPlane attribute.
 int getMSBPlane(int z, int rLevel, int precinct, int subband, int yBlock, int xBlock)
          Definition in getMSBPlane(long, int, int, int).
 int getMSBPlane(long inClassIdentifier, int subband, int yBlock, int xBlock)
          This methdo returns the Most Significat Bit Plane (MSBP) for each block belonging to a tile-component-resolutionlevel-precinct-subband.
 int getPacketLength(long inClassIdentifier, int layer)
          Returns the length of a packet.
 int getPacketOffset(long inClassIdentifier, int layer)
          Returns the file pointer offset of a packet.
 int getPacketOffsetWithDataBin(long inClassIdentifier, int layer)
          Returns the offset of a packet in the data bin.
 int getRateDistortionMethod()
          Returns the rate distoriton method which is being used.
 int[][][] getZeroBitPlanes(long inClassIdentifier)
          Returns the #zeroBitPlanes attribute.
 void list(java.io.PrintStream out)
          Prints the JPC logical target data out to the specified output stream.
private  void printData3(java.io.PrintStream out)
          Prints the JPC logical target data out to the specified output stream.
 java.lang.String toString()
           
 
Methods inherited from class CADI.Server.LogicalTarget.ServerLogicalTarget
generateTid, getInputDataSource, getLogicalTargetType, getTarget, getTID, setInputDataSource, setLogicalTargetType, setTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fileFormatType

private int fileFormatType

JPC

public static final int JPC
See Also:
Constant Field Values

JP2

public static final int JP2
See Also:
Constant Field Values

JPK

public static final int JPK
See Also:
Constant Field Values

JPX

public static final int JPX
See Also:
Constant Field Values

jpcParameters

private JPCParameters jpcParameters
Contains the JPC image parameters.

See Also:
JPCParameters

rateDistortionMethod

private int rateDistortionMethod
Indicates the rate-distortion method which is used to obtain the WOI for the client request.


RATE_DISTORTION_METHOD_FILE_ORDER

public static final int RATE_DISTORTION_METHOD_FILE_ORDER
Allowed values for the rateDistortionMethod attribute.

See Also:
Constant Field Values

RATE_DISTORTION_METHOD_CPI

public static final int RATE_DISTORTION_METHOD_CPI
See Also:
Constant Field Values

RATE_DISTORTION_METHOD_CoRD

public static final int RATE_DISTORTION_METHOD_CoRD
See Also:
Constant Field Values

mainHeaderInitialPos

private long mainHeaderInitialPos
Contains the main header position within the image file.


mainHeaderLength

private int mainHeaderLength
Contains the main header length.


dataBins

private java.util.Hashtable<java.lang.Long,DataBinInfo> dataBins
It is an array list with information about


imageStructure

private int[][][][][][] imageStructure
Definition in GenerateImageStructure.imageStructure


MSBPlane

private int MSBPlane
The Most Significant Bit Plane of the whole image.

The least significant bit plane is the 0 and the content of this variable indicates the most significant one.

This attribute is only used whenn the RATE_DISTORTION_METHOD_CPI or RATE_DISTORTION_METHOD_CORD rate-distortion methods are used.

Constructor Detail

JP2LogicalTarget

public JP2LogicalTarget(int codestreamType,
                        java.util.Hashtable<java.lang.Long,DataBinInfo> dataBins,
                        JPCParameters jpcParameters,
                        long mainHeaderInitialPos,
                        int mainHeaderLength)
Constructor.

Parameters:
codestreamType - definition in fileFormatType.
dataBins - definition in dataBins.
jpcParameters - definition in jpcParameters.
mainHeaderInitialPos - definition in mainHeaderInitialPos.
mainHeaderLength - definition in mainHeaderLength.

JP2LogicalTarget

public JP2LogicalTarget(int codestreamType,
                        java.util.Hashtable<java.lang.Long,DataBinInfo> dataBins,
                        JPCParameters jpcParameters,
                        int rateDistortionMethod,
                        int[][][][][][] imageStructure)
Constructor.

This constructor must be used when the rate-distortion method is either RATE_DISTORTION_METHOD_CPI or RATE_DISTORTION_METHOD_CoRD.

Parameters:
codestreamType - definition in fileFormatType.
dataBins - definition in dataBins.
rateDistortionMethod - definition in rateDistortionMethod.
jpcParameters - definition in jpcParameters.
Method Detail

getCodestreamType

public int getCodestreamType()
Returns the fileFormatType attribute.

Returns:
the fileFormatType attribute.

getJPCParameters

public JPCParameters getJPCParameters()
Returns the JPEG2000 parameters.

See Also:
jpcParameters

getRateDistortionMethod

public int getRateDistortionMethod()
Returns the rate distoriton method which is being used.

Returns:
the rate rateDistortionMethod.

getMainHeaderInitialPos

public long getMainHeaderInitialPos()
Returns the file pointer to the JPEG2000 main header.

See Also:
mainHeaderInitialPos

getMainHeaderLength

public int getMainHeaderLength()
Returns the length of the JPEG2000 main header.

See Also:
mainHeaderLength

getPacketOffset

public int getPacketOffset(long inClassIdentifier,
                           int layer)
Returns the file pointer offset of a packet.

Parameters:
inClassIdentifier - definition in JPIPMessageHeader.inClassIdentifier.
layer - the number of layer.
Returns:
the offset of the packet.

getPacketOffsetWithDataBin

public int getPacketOffsetWithDataBin(long inClassIdentifier,
                                      int layer)
Returns the offset of a packet in the data bin. Packet is identified by means of its unique identifier inClassIdentifier and its number of layer.

Parameters:
inClassIdentifier - definition in JPIPMessageHeader.inClassIdentifier.
layer - the layer which offset is requested
Returns:
the offset of the packet in the data bin.

getPacketLength

public int getPacketLength(long inClassIdentifier,
                           int layer)
Returns the length of a packet.

Parameters:
inClassIdentifier - definition in JPIPMessageHeader.inClassIdentifier.
layer - the number of the layer.
Returns:
the length of the packet.

getDataBinLength

public int getDataBinLength(long inClassIdentifier)
Returns the length of the data bin of which unique identifier is inClassIdentifier.

Parameters:
inClassIdentifier - definition in JPIPMessageHeader.inClassIdentifier.
Returns:
the length of the data bin.

getLastCompleteLayer

public int getLastCompleteLayer(long inClassIdentifier,
                                long dataBinLength)
Return the last complete layer that it can be whole recovered with dataBinLength bytes.

Parameters:
inClassIdentifier - definition in JPIPMessageHeader.inClassIdentifier.
dataBinLength - is the lenth of the data bin.
Returns:
the last complete layer.

getImageStructure

public int[][][][][][] getImageStructure()

getFilePointersCodingPasses

public long[][][][] getFilePointersCodingPasses(long inClassIdentifier)
Parameters:
inClassIdentifier -
Returns:

getFilePointerCodingPass

public long getFilePointerCodingPass(long inClassIdentifier,
                                     int subband,
                                     int yBlock,
                                     int xBlock,
                                     int codingPass)
Parameters:
inClassIdentifier -
subband -
yBlock -
xBlock -
codingPass -
Returns:

getLengthsOfCodingPasses

public int[][][][] getLengthsOfCodingPasses(long inClassIdentifier)
Parameters:
inClassIdentifier -
Returns:

getLengthOfCodingPass

public int getLengthOfCodingPass(long inClassIdentifier,
                                 int subband,
                                 int yBlock,
                                 int xBlock,
                                 int codingPass)
Parameters:
inClassIdentifier -
subband -
yBlock -
xBlock -
codingPass -
Returns:

getLengthOfCodingPass

public int getLengthOfCodingPass(int z,
                                 int rLevel,
                                 int precinct,
                                 int subband,
                                 int yBlock,
                                 int xBlock,
                                 int codingPass)
Parameters:
z -
rLevel -
precinct -
subband -
yBlock -
xBlock -
codingPass -
Returns:

getLengthsOfCodingPasses

public int[][][][] getLengthsOfCodingPasses(int z,
                                            int rLevel,
                                            int precinct)
Parameters:
z -
rLevel -
precinct -
Returns:

getZeroBitPlanes

public int[][][] getZeroBitPlanes(long inClassIdentifier)
Returns the #zeroBitPlanes attribute.

Returns:
the #zeroBitPlanes attribute.

getMSBPlane

public int getMSBPlane()
Returns the MSBPlane attribute.

Returns:
the MSBPlane attribute.

getMSBPlane

public int getMSBPlane(long inClassIdentifier,
                       int subband,
                       int yBlock,
                       int xBlock)
This methdo returns the Most Significat Bit Plane (MSBP) for each block belonging to a tile-component-resolutionlevel-precinct-subband.

Parameters:
inClassIdentifier -
subband - 0 - HL, 1 - LH, 2 - HH (if resolutionLevel == 0 --> 0 - LL)
yBlock - block row in the subband
xBlock - block column in the subband
Returns:
the value of the Most Significant Bit Planes (MSBP).

getMSBPlane

public int getMSBPlane(int z,
                       int rLevel,
                       int precinct,
                       int subband,
                       int yBlock,
                       int xBlock)
Definition in getMSBPlane(long, int, int, int).

Parameters:
z -
rLevel -
precinct -
subband - 0 - HL, 1 - LH, 2 - HH (if resolutionLevel == 0 --> 0 - LL)
yBlock - block row in the subband
xBlock - block column in the subband
Returns:
the value of the Most Significant Bit Planes (MSBP).

toString

public java.lang.String toString()
Overrides:
toString in class ServerLogicalTarget

list

public void list(java.io.PrintStream out)
Prints the JPC logical target data out to the specified output stream. This method is useful for debugging.

Overrides:
list in class ServerLogicalTarget
Parameters:
out - an output stream.

generateTid

protected void generateTid()
Description copied from class: ServerLogicalTarget
It will generate a Target-ID for that logical target, i.e. a string that absolutely identifies the logical target. The "Target-ID" shall not exceed 255 character in length.

This a generic function, but it is recommended classes that inherits from this one should implement their own methods.

NOTICE: This method must be called from the constructor of the class.

Overrides:
generateTid in class ServerLogicalTarget
See Also:
ServerLogicalTarget.tid

printData3

private void printData3(java.io.PrintStream out)
Prints the JPC logical target data out to the specified output stream. This method is useful for debugging.

Parameters:
out - an output stream.


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)