CADI.Server.LogicalTarget.JPEG2000
Class JP2LogicalTargetManager

java.lang.Object
  extended by CADI.Server.LogicalTarget.ServerLogicalTargetManager
      extended by CADI.Server.LogicalTarget.JPEG2000.JP2LogicalTargetManager

public class JP2LogicalTargetManager
extends ServerLogicalTargetManager

This class extends the ServerLogicalTargetManager class and it is used to manage the JPEG2000 logical targets.

There are implemented the following rate-distortion methods:
1- File-Order: this rate-distortion method deliveries the requested WOI in the same order they are saved in the codestream. 2- CPI: the requested WOI is delivery following a Coding Passes Interleaving strategy. 3- CoRD: the requested WOI is delivery following the Characterization of Rate Distortion (CoRD) algorithm. NOTICE: this algoritm is only working for gray-scale images.

Version:
1.0.3 2009/04/13
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  CoRDBasedDelivery cordBasedDelivery
          This object is used when the image data are sent using the Characterization of Rate Distortion (CoRD) algorithm.
private  CoRDDelivery cordDelivery
          This object is used when the image data are sent using the classic Characterization of Rate Distortion (CoRD) algorithm.
private  CPIBasedDelivery cpiBasedDelivery
          This object is used when the image data are sent using the Coding Passes Interleaving (CPI) algorithm.
private  CPIDelivery cpiDelivery
          This object is used when the image data are sent using the Coding Passes Interleaving (CPI) algorithm.
private  int deliveryProgressionOrder
          Definition in Worker.deliveryProgressionOrder.
private  FileOrderDelivery fileOrderDelivery
          This object is used when the image data are sent following the order of the codestream in the file.
private  JPCParameters jpcParameters
          Contains the parameters of a JPC codestream.
private  JP2LogicalTarget logicalTarget
          Is the logical target which is being delivery.
private  long maximumResponseLength
          Definition in DataLimitField.len
private  int rateDistortionMethod
          Definition in JP2LogicalTarget.rateDistortionMethod
private  int RDSubType
          Indicates a subtype of the rateDistortionMethod attribute.
private  ViewWindowField requestViewWindow
          Contains the requested Window Of Interest.
private  long responseLength
          It is a temporal attribute to accumulate the response length which is sending to the client.
private  JPCServerCache serverCache
          Is the server cache for the client session and target.
 
Fields inherited from class CADI.Server.LogicalTarget.ServerLogicalTargetManager
EORReasonCode, EORReasonMessage, jpipMessageHeaders, log, parentName, quality, responseViewWindow
 
Constructor Summary
JP2LogicalTargetManager()
          Constructor
 
Method Summary
private  void addMetadaBin0(HTTPResponseSender httpResponseSender, JPIPMessageEncoder jpipMessageEncoder)
          Adds the metadata bin 0 to the response.
private  void addTileHeader(HTTPResponseSender httpResponseSender, JPIPMessageEncoder jpipMessageEncoder)
          Adds the tile-header to the response.
 void deliveryData(HTTPResponseSender httpResponseSender)
          This method deliveries the data which belong to the request view window.
 void deliveryData(HTTPResponseSender httpResponseSender, JPIPMessageEncoder jpipMessageEncoder)
          This method deliveries the data which belong to the request view window.
private  void deliveryDataCoRD(HTTPResponseSender httpResponseSender, JPIPMessageEncoder jpipMessageEncoder)
          Delivery the image WOI following the Characterization of Rate Distortion (CoRD) algorithm
private  void deliveryDataCPI(HTTPResponseSender httpResponseSender, JPIPMessageEncoder jpipMessageEncoder)
          Delivery the image WOI following the Coding Passes Interleaving (CPI) strategy.
private  void deliveryDataFileOrder(HTTPResponseSender httpResponseSender, JPIPMessageEncoder jpipMessageEncoder)
          Delivery the image WOI following the order of the codestream in the file.
 void list(java.io.PrintStream out)
          Prints this JPCLogicalTargetManager out to the specified output stream.
 ServerLogicalTarget logicalTargetIndexing(BufferedDataInputStream in)
          Indexes a logical target file, i.e, reads the logical target structure and it is kept in memory be used later when a client request for a Window of Interest of the logical target.
 void processClientRequest(ServerLogicalTarget logicalTarget, ServerCache serverCache, ViewWindowField viewWindow, long len)
          This method processes the request WOI of the client.
private  void sendEndOfResponse(HTTPResponseSender httpResponseSender, JPIPMessageEncoder jpipMessageEncoder)
          This method is used to send the End of Response of a JPIP message.
 void setDeliveryProgressionOrder(int deliveryProgressionOrder)
          Sets the deliveryProgressionOrder attribute.
 void setRateDistortionMethod(int rateDistortionMethod, int subType)
          Sets the rate-distortion method which will be used to calculate the response to WOI requested by the client.
 java.lang.String toString()
           
 
Methods inherited from class CADI.Server.LogicalTarget.ServerLogicalTargetManager
getEORReasonCode, getEORReasonMessage, getJPIPMessageHeaders, getQuality, getResponseViewWindow, setLog, setParentName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logicalTarget

private JP2LogicalTarget logicalTarget
Is the logical target which is being delivery. This object contains information about the target geometry, file input stream, ...


rateDistortionMethod

private int rateDistortionMethod
Definition in JP2LogicalTarget.rateDistortionMethod


RDSubType

private int RDSubType
Indicates a subtype of the rateDistortionMethod attribute.

This parameter, when takes a value, it will depend of the rateDistortionMethod value.


deliveryProgressionOrder

private int deliveryProgressionOrder
Definition in Worker.deliveryProgressionOrder.


serverCache

private JPCServerCache serverCache
Is the server cache for the client session and target.


requestViewWindow

private ViewWindowField requestViewWindow
Contains the requested Window Of Interest.


maximumResponseLength

private long maximumResponseLength
Definition in DataLimitField.len


fileOrderDelivery

private FileOrderDelivery fileOrderDelivery
This object is used when the image data are sent following the order of the codestream in the file.


cpiDelivery

private CPIDelivery cpiDelivery
This object is used when the image data are sent using the Coding Passes Interleaving (CPI) algorithm.


cpiBasedDelivery

private CPIBasedDelivery cpiBasedDelivery
This object is used when the image data are sent using the Coding Passes Interleaving (CPI) algorithm.


cordDelivery

private CoRDDelivery cordDelivery
This object is used when the image data are sent using the classic Characterization of Rate Distortion (CoRD) algorithm.


cordBasedDelivery

private CoRDBasedDelivery cordBasedDelivery
This object is used when the image data are sent using the Characterization of Rate Distortion (CoRD) algorithm.


responseLength

private long responseLength
It is a temporal attribute to accumulate the response length which is sending to the client.


jpcParameters

private JPCParameters jpcParameters
Contains the parameters of a JPC codestream.

Constructor Detail

JP2LogicalTargetManager

public JP2LogicalTargetManager()
Constructor

Method Detail

setRateDistortionMethod

public void setRateDistortionMethod(int rateDistortionMethod,
                                    int subType)
Sets the rate-distortion method which will be used to calculate the response to WOI requested by the client.

Parameters:
rateDistortionMethod - definition in JP2LogicalTarget.rateDistortionMethod

setDeliveryProgressionOrder

public void setDeliveryProgressionOrder(int deliveryProgressionOrder)
Sets the deliveryProgressionOrder attribute.

Parameters:
deliveryProgressionOrder - definition in deliveryProgressionOrder.

logicalTargetIndexing

public ServerLogicalTarget logicalTargetIndexing(BufferedDataInputStream in)
                                          throws WarningException
Description copied from class: ServerLogicalTargetManager
Indexes a logical target file, i.e, reads the logical target structure and it is kept in memory be used later when a client request for a Window of Interest of the logical target. How the logical target structure is kept in memory, it is more easy and faster to find the precincts which belong to the requested WOI.

Specified by:
logicalTargetIndexing in class ServerLogicalTargetManager
Throws:
WarningException

processClientRequest

public void processClientRequest(ServerLogicalTarget logicalTarget,
                                 ServerCache serverCache,
                                 ViewWindowField viewWindow,
                                 long len)
Description copied from class: ServerLogicalTargetManager
This method processes the request WOI of the client. It must calculate the response View Window and the quality parameter of the response. Therefore, the Worker can delivery the HTTP response header to the client.

This function must be implemented for each logical target supported.

Specified by:
processClientRequest in class ServerLogicalTargetManager

deliveryData

public void deliveryData(HTTPResponseSender httpResponseSender)
                  throws java.io.IOException,
                         ErrorException
Description copied from class: ServerLogicalTargetManager
This method deliveries the data which belong to the request view window.

Specified by:
deliveryData in class ServerLogicalTargetManager
Throws:
java.io.IOException
ErrorException

deliveryData

public void deliveryData(HTTPResponseSender httpResponseSender,
                         JPIPMessageEncoder jpipMessageEncoder)
                  throws java.io.IOException,
                         ErrorException
Description copied from class: ServerLogicalTargetManager
This method deliveries the data which belong to the request view window.

Specified by:
deliveryData in class ServerLogicalTargetManager
Throws:
java.io.IOException
ErrorException

toString

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

list

public void list(java.io.PrintStream out)
Prints this JPCLogicalTargetManager out to the specified output stream. This method is useful for debugging.

Parameters:
out - an output stream.

deliveryDataFileOrder

private void deliveryDataFileOrder(HTTPResponseSender httpResponseSender,
                                   JPIPMessageEncoder jpipMessageEncoder)
                            throws java.io.IOException,
                                   ErrorException
Delivery the image WOI following the order of the codestream in the file.

Parameters:
httpResponseSender - is an object which will be used to send the the messages to the client.
jpipMessageEncoder - is an object used to build the JPIP messages.
Throws:
java.io.IOException - if an I/O error has ocurred.
ErrorException - if an error in the WOI processing has ocurred.

deliveryDataCPI

private void deliveryDataCPI(HTTPResponseSender httpResponseSender,
                             JPIPMessageEncoder jpipMessageEncoder)
                      throws java.io.IOException,
                             ErrorException
Delivery the image WOI following the Coding Passes Interleaving (CPI) strategy.

Parameters:
httpResponseSender - is an object which will be used to send the the messages to the client.
jpipMessageEncoder - is an object used to build the JPIP messages.
Throws:
java.io.IOException - if an I/O error has ocurred.
ErrorException - if an error in the WOI processing has ocurred.

deliveryDataCoRD

private void deliveryDataCoRD(HTTPResponseSender httpResponseSender,
                              JPIPMessageEncoder jpipMessageEncoder)
                       throws java.io.IOException,
                              ErrorException
Delivery the image WOI following the Characterization of Rate Distortion (CoRD) algorithm

Parameters:
httpResponseSender - is an object which will be used to send the the messages to the client.
jpipMessageEncoder - is an object used to build the JPIP messages.
Throws:
java.io.IOException - if an I/O error has ocurred.
ErrorException - if an error in the WOI processing has ocurred.

addMetadaBin0

private void addMetadaBin0(HTTPResponseSender httpResponseSender,
                           JPIPMessageEncoder jpipMessageEncoder)
                    throws java.io.IOException
Adds the metadata bin 0 to the response.

It is a temporal method while metadata are not supported.

Throws:
java.io.IOException

addTileHeader

private void addTileHeader(HTTPResponseSender httpResponseSender,
                           JPIPMessageEncoder jpipMessageEncoder)
                    throws java.io.IOException
Adds the tile-header to the response.

It is a temporal method while tiles are not supported.

Throws:
java.io.IOException

sendEndOfResponse

private void sendEndOfResponse(HTTPResponseSender httpResponseSender,
                               JPIPMessageEncoder jpipMessageEncoder)
                        throws java.io.IOException
This method is used to send the End of Response of a JPIP message.

Parameters:
httpResponseSender -
jpipMessageEncoder -
Throws:
java.io.IOException


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)