icc
Class ICCProfiler

java.lang.Object
  |
  +--jj2000.j2k.image.ImgDataAdapter
        |
        +--colorspace.ColorSpaceMapper
              |
              +--icc.ICCProfiler
All Implemented Interfaces:
BlkImgDataSrc, ImgData

public class ICCProfiler
extends ColorSpaceMapper

This class provides ICC Profiling API for the jj2000.j2k imaging chain by implementing the BlkImgDataSrc interface, in particular the getCompData and getInternCompData methods.

See Also:
jj2000.j2k.icc.ICCProfile

Nested Class Summary
 
Nested classes inherited from class colorspace.ColorSpaceMapper
ColorSpaceMapper.ComputedComponents
 
Field Summary
private static int BLUE
           
protected static java.lang.String eol
          Platform dependant end of line String.
private static int GRAY
           
private static int GREEN
           
(package private)  ICCProfile icc
           
private  RestrictedICCProfile iccp
          The image's ICC profile.
static char OPT_PREFIX
          The prefix for ICC Profiler options
private static int RED
           
(package private)  RestrictedICCProfile ricc
           
private  DataBlkFloat[] tempFloat
           
private  DataBlkInt[] tempInt
           
private  java.lang.Object xform
           
 
Fields inherited from class colorspace.ColorSpaceMapper
computed, csMap, dataFloat, dataInt, fixedPtBitsArray, inFloat, inInt, maxValueArray, ncomps, pl, shiftValueArray, src, srcBlk, workDataFloat, workDataInt, workFloat, workInt
 
Fields inherited from class jj2000.j2k.image.ImgDataAdapter
imgdatasrc, tIdx
 
Constructor Summary
protected ICCProfiler(BlkImgDataSrc src, ColorSpace csMap)
          Ctor which creates an ICCProfile for the image and initializes all data objects (input, working, output).
 
Method Summary
static BlkImgDataSrc createInstance(BlkImgDataSrc src, ColorSpace csMap)
          Factory method for creating instances of this class.
 DataBlk getCompData(DataBlk outblk, int c)
          Returns, in the blk argument, a block of image data containing the specifed rectangular area, in the specified component.
private  RestrictedICCProfile getICCProfile(ColorSpace csm)
          Get the ICCProfile information JP2 ColorSpace
 DataBlk getInternCompData(DataBlk out, int c)
          Returns, in the blk argument, a block of image data containing the specifed rectangular area, in the specified component.
private  void initialize()
          General utility used by ctors
 java.lang.String toString()
          Return a suitable String representation of the class instance.
 
Methods inherited from class colorspace.ColorSpaceMapper
copyGeometry, getFixedPoint, getParameterInfo, setInternalBuffer
 
Methods inherited from class jj2000.j2k.image.ImgDataAdapter
getCompImgHeight, getCompImgWidth, getCompSubsX, getCompSubsY, getCompULX, getCompULY, getImgHeight, getImgULX, getImgULY, getImgWidth, getNomRangeBits, getNomTileHeight, getNomTileWidth, getNumComps, getNumTiles, getNumTiles, getTile, getTileCompHeight, getTileCompWidth, getTileHeight, getTileIdx, getTilePartULX, getTilePartULY, getTileWidth, nextTile, setTile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jj2000.j2k.image.ImgData
getCompImgHeight, getCompImgWidth, getCompSubsX, getCompSubsY, getCompULX, getCompULY, getImgHeight, getImgULX, getImgULY, getImgWidth, getNomRangeBits, getNomTileHeight, getNomTileWidth, getNumComps, getNumTiles, getNumTiles, getTile, getTileCompHeight, getTileCompWidth, getTileHeight, getTileIdx, getTilePartULX, getTilePartULY, getTileWidth, nextTile, setTile
 

Field Detail

OPT_PREFIX

public static final char OPT_PREFIX
The prefix for ICC Profiler options

See Also:
Constant Field Values

eol

protected static final java.lang.String eol
Platform dependant end of line String.


GRAY

private static final int GRAY
See Also:
Constant Field Values

RED

private static final int RED
See Also:
Constant Field Values

GREEN

private static final int GREEN
See Also:
Constant Field Values

BLUE

private static final int BLUE
See Also:
Constant Field Values

ricc

RestrictedICCProfile ricc

icc

ICCProfile icc

tempInt

private DataBlkInt[] tempInt

tempFloat

private DataBlkFloat[] tempFloat

xform

private java.lang.Object xform

iccp

private RestrictedICCProfile iccp
The image's ICC profile.

Constructor Detail

ICCProfiler

protected ICCProfiler(BlkImgDataSrc src,
                      ColorSpace csMap)
               throws ColorSpaceException,
                      java.io.IOException,
                      ICCProfileException,
                      java.lang.IllegalArgumentException
Ctor which creates an ICCProfile for the image and initializes all data objects (input, working, output).

Parameters:
src - -- Source of image data
Throws:
java.io.IOException
ICCProfileException
java.lang.IllegalArgumentException
ColorSpaceException
Method Detail

createInstance

public static BlkImgDataSrc createInstance(BlkImgDataSrc src,
                                           ColorSpace csMap)
                                    throws java.io.IOException,
                                           ICCProfileException,
                                           ColorSpaceException
Factory method for creating instances of this class.

Parameters:
src - -- source of image data
csMap - -- provides colorspace info
Returns:
ICCProfiler instance
Throws:
java.io.IOException - profile access exception
ICCProfileException - profile content exception
ColorSpaceException

initialize

private void initialize()
General utility used by ctors


getICCProfile

private RestrictedICCProfile getICCProfile(ColorSpace csm)
                                    throws ColorSpaceException,
                                           ICCProfileException,
                                           java.lang.IllegalArgumentException
Get the ICCProfile information JP2 ColorSpace

Parameters:
csm - provides all necessary info about the colorspace
Returns:
ICCMatrixBasedInputProfile for 3 component input and ICCMonochromeInputProfile for a 1 component source. Returns null if exceptions were encountered.
Throws:
ColorSpaceException
ICCProfileException
java.lang.IllegalArgumentException

getCompData

public DataBlk getCompData(DataBlk outblk,
                           int c)
Returns, in the blk argument, a block of image data containing the specifed rectangular area, in the specified component. The data is returned, as a copy of the internal data, therefore the returned data can be modified "in place".

The rectangular area to return is specified by the 'ulx', 'uly', 'w' and 'h' members of the 'blk' argument, relative to the current tile. These members are not modified by this method. The 'offset' of the returned data is 0, and the 'scanw' is the same as the block's width. See the 'DataBlk' class.

If the data array in 'blk' is 'null', then a new one is created. If the data array is not 'null' then it is reused, and it must be large enough to contain the block's data. Otherwise an 'ArrayStoreException' or an 'IndexOutOfBoundsException' is thrown by the Java system.

The returned data has its 'progressive' attribute set to that of the input data.

Specified by:
getCompData in interface BlkImgDataSrc
Overrides:
getCompData in class ColorSpaceMapper
Parameters:
c - The index of the component from which to get the data. Only 0 and 3 are valid.
Returns:
The requested DataBlk
See Also:
getInternCompData(jj2000.j2k.image.DataBlk, int)

getInternCompData

public DataBlk getInternCompData(DataBlk out,
                                 int c)
Returns, in the blk argument, a block of image data containing the specifed rectangular area, in the specified component. The data is returned, as a reference to the internal data, if any, instead of as a copy, therefore the returned data should not be modified.

The rectangular area to return is specified by the 'ulx', 'uly', 'w' and 'h' members of the 'blk' argument, relative to the current tile. These members are not modified by this method. The 'offset' and 'scanw' of the returned data can be arbitrary. See the 'DataBlk' class.

This method, in general, is more efficient than the 'getCompData()' method since it may not copy the data. However if the array of returned data is to be modified by the caller then the other method is probably preferable.

If possible, the data in the returned 'DataBlk' should be the internal data itself, instead of a copy, in order to increase the data transfer efficiency. However, this depends on the particular implementation (it may be more convenient to just return a copy of the data). This is the reason why the returned data should not be modified.

If the data array in blk is null, then a new one is created if necessary. The implementation of this interface may choose to return the same array or a new one, depending on what is more efficient. Therefore, the data array in blk prior to the method call should not be considered to contain the returned data, a new array may have been created. Instead, get the array from blk after the method has returned.

The returned data may have its 'progressive' attribute set. In this case the returned data is only an approximation of the "final" data.

Specified by:
getInternCompData in interface BlkImgDataSrc
Overrides:
getInternCompData in class ColorSpaceMapper
Parameters:
c - The index of the component from which to get the data.
Returns:
The requested DataBlk
See Also:
getCompData(jj2000.j2k.image.DataBlk, int)

toString

public java.lang.String toString()
Return a suitable String representation of the class instance.

Overrides:
toString in class java.lang.Object