ucar.jpeg.colorspace
Class ChannelDefinitionMapper

java.lang.Object
  extended by ucar.jpeg.jj2000.j2k.image.ImgDataAdapter
      extended by ucar.jpeg.colorspace.ColorSpaceMapper
          extended by ucar.jpeg.colorspace.ChannelDefinitionMapper
All Implemented Interfaces:
BlkImgDataSrc, ImgData

public class ChannelDefinitionMapper
extends ColorSpaceMapper

This class is responsible for the mapping between requested components and image channels.

Version:
1.0
Author:
Bruce A. Kern
See Also:
jj2000.j2k.colorspace.ColorSpace

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.jpeg.colorspace.ColorSpaceMapper
ColorSpaceMapper.ComputedComponents
 
Field Summary
 
Fields inherited from class ucar.jpeg.colorspace.ColorSpaceMapper
computed, csMap, dataFloat, dataInt, eol, fixedPtBitsArray, inFloat, inInt, maxValueArray, ncomps, OPT_PREFIX, pl, shiftValueArray, src, srcBlk, workDataFloat, workDataInt, workFloat, workInt
 
Fields inherited from class ucar.jpeg.jj2000.j2k.image.ImgDataAdapter
imgdatasrc, tIdx
 
Constructor Summary
protected ChannelDefinitionMapper(BlkImgDataSrc src, ColorSpace csMap)
          Ctor which creates an ICCProfile for the image and initializes all data objects (input, working, and output).
 
Method Summary
static BlkImgDataSrc createInstance(BlkImgDataSrc src, ColorSpace csMap)
          Factory method for creating instances of this class.
 DataBlk getCompData(DataBlk out, int c)
          Returns, in the blk argument, a block of image data containing the specifed rectangular area, in the specified component.
 int getCompImgHeight(int c)
          Returns the height in pixels of the specified component in the overall image.
 int getCompImgWidth(int c)
          Returns the width in pixels of the specified component in the overall image.
 int getCompSubsX(int c)
          Returns the component subsampling factor in the horizontal direction, for the specified component.
 int getCompSubsY(int c)
          Returns the component subsampling factor in the vertical direction, for the specified component.
 int getCompULX(int c)
          Returns the horizontal coordinate of the upper-left corner of the specified component in the current tile.
 int getCompULY(int c)
          Returns the vertical coordinate of the upper-left corner of the specified component in the current tile.
 int getFixedPoint(int c)
          Returns the number of bits, referred to as the "range bits", corresponding to the nominal range of the data in the specified component.
 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.
 int getNomRangeBits(int c)
          Returns the number of bits, referred to as the "range bits", corresponding to the nominal range of the image data in the specified component.
 int getTileCompHeight(int t, int c)
          Returns the height in pixels of the specified tile-component.
 int getTileCompWidth(int t, int c)
          Returns the width in pixels of the specified tile-component tile.
 String toString()
           
 
Methods inherited from class ucar.jpeg.colorspace.ColorSpaceMapper
copyGeometry, getParameterInfo, setInternalBuffer
 
Methods inherited from class ucar.jpeg.jj2000.j2k.image.ImgDataAdapter
getImgHeight, getImgULX, getImgULY, getImgWidth, getNomTileHeight, getNomTileWidth, getNumComps, getNumTiles, getNumTiles, getTile, 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 ucar.jpeg.jj2000.j2k.image.ImgData
getImgHeight, getImgULX, getImgULY, getImgWidth, getNomTileHeight, getNomTileWidth, getNumComps, getNumTiles, getNumTiles, getTile, getTileHeight, getTileIdx, getTilePartULX, getTilePartULY, getTileWidth, nextTile, setTile
 

Constructor Detail

ChannelDefinitionMapper

protected ChannelDefinitionMapper(BlkImgDataSrc src,
                                  ColorSpace csMap)
                           throws ColorSpaceException
Ctor which creates an ICCProfile for the image and initializes all data objects (input, working, and output).

Parameters:
src - -- Source of image data
csm - -- provides colorspace info
Throws:
ColorSpaceException
Method Detail

createInstance

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

Parameters:
src - -- source of image data
csMap - -- provides colorspace info
Returns:
ChannelDefinitionMapper instance
Throws:
ColorSpaceException

getCompData

public DataBlk getCompData(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 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:
blk - Its coordinates and dimensions specify the area to return. If it contains a non-null data array, then it must have the correct dimensions. If it contains a null data array a new one is created. The fields in this object are modified to return the data.
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(ucar.jpeg.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 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.

This method, in general, is less efficient than the 'getInternCompData()' method since, in general, it copies the data. However if the array of returned data is to be modified by the caller then this method is preferable.

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 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:
blk - Its coordinates and dimensions specify the area to return, relative to the current tile. If it contains a non-null data array, then it must be large enough. If it contains a null data array a new one is created. Some fields in this object are modified to return the data.
c - The index of the component from which to get the data.
Returns:
The requested DataBlk
See Also:
getCompData(ucar.jpeg.jj2000.j2k.image.DataBlk, int)

getFixedPoint

public int getFixedPoint(int c)
Returns the number of bits, referred to as the "range bits", corresponding to the nominal range of the data in the specified component. If this number is b then for unsigned data the nominal range is between 0 and 2^b-1, and for signed data it is between -2^(b-1) and 2^(b-1)-1. For floating point data this value is not applicable.

Specified by:
getFixedPoint in interface BlkImgDataSrc
Overrides:
getFixedPoint in class ColorSpaceMapper
Parameters:
c - The index of the component.
Returns:
The number of bits corresponding to the nominal range of the data. Fro floating-point data this value is not applicable and the return value is undefined.

getNomRangeBits

public int getNomRangeBits(int c)
Description copied from class: ImgDataAdapter
Returns the number of bits, referred to as the "range bits", corresponding to the nominal range of the image data in the specified component. If this number is n then for unsigned data the nominal range is between 0 and 2^b-1, and for signed data it is between -2^(b-1) and 2^(b-1)-1. In the case of transformed data which is not in the image domain (e.g., wavelet coefficients), this method returns the "range bits" of the image data that generated the coefficients.

This default implementation returns the value of the source.

Specified by:
getNomRangeBits in interface ImgData
Overrides:
getNomRangeBits in class ImgDataAdapter
Parameters:
c - The index of the component.
Returns:
The number of bits corresponding to the nominal range of the image data (in the image domain).

getCompImgHeight

public int getCompImgHeight(int c)
Description copied from class: ImgDataAdapter
Returns the height in pixels of the specified component in the overall image.

This default implementation returns the value of the source.

Specified by:
getCompImgHeight in interface ImgData
Overrides:
getCompImgHeight in class ImgDataAdapter
Parameters:
c - The index of the component, from 0 to N-1.
Returns:
The height in pixels of component c in the overall image.

getCompImgWidth

public int getCompImgWidth(int c)
Description copied from class: ImgDataAdapter
Returns the width in pixels of the specified component in the overall image.

This default implementation returns the value of the source.

Specified by:
getCompImgWidth in interface ImgData
Overrides:
getCompImgWidth in class ImgDataAdapter
Parameters:
c - The index of the component, from 0 to N-1.
Returns:
The width in pixels of component c in the overall image.

getCompSubsX

public int getCompSubsX(int c)
Description copied from class: ImgDataAdapter
Returns the component subsampling factor in the horizontal direction, for the specified component. This is, approximately, the ratio of dimensions between the reference grid and the component itself, see the 'ImgData' interface desription for details.

This default implementation returns the value of the source.

Specified by:
getCompSubsX in interface ImgData
Overrides:
getCompSubsX in class ImgDataAdapter
Parameters:
c - The index of the component (between 0 and N-1)
Returns:
The horizontal subsampling factor of component 'c'
See Also:
ImgData

getCompSubsY

public int getCompSubsY(int c)
Description copied from class: ImgDataAdapter
Returns the component subsampling factor in the vertical direction, for the specified component. This is, approximately, the ratio of dimensions between the reference grid and the component itself, see the 'ImgData' interface desription for details.

This default implementation returns the value of the source.

Specified by:
getCompSubsY in interface ImgData
Overrides:
getCompSubsY in class ImgDataAdapter
Parameters:
c - The index of the component (between 0 and N-1)
Returns:
The vertical subsampling factor of component 'c'
See Also:
ImgData

getCompULX

public int getCompULX(int c)
Description copied from class: ImgDataAdapter
Returns the horizontal coordinate of the upper-left corner of the specified component in the current tile.

This default implementation returns the value of the source.

Specified by:
getCompULX in interface ImgData
Overrides:
getCompULX in class ImgDataAdapter
Parameters:
c - The component index.

getCompULY

public int getCompULY(int c)
Description copied from class: ImgDataAdapter
Returns the vertical coordinate of the upper-left corner of the specified component in the current tile.

This default implementation returns the value of the source.

Specified by:
getCompULY in interface ImgData
Overrides:
getCompULY in class ImgDataAdapter
Parameters:
c - The component index.

getTileCompHeight

public int getTileCompHeight(int t,
                             int c)
Description copied from class: ImgDataAdapter
Returns the height in pixels of the specified tile-component.

This default implementation returns the value of the source.

Specified by:
getTileCompHeight in interface ImgData
Overrides:
getTileCompHeight in class ImgDataAdapter
Parameters:
t - The tile index.
c - The index of the component, from 0 to N-1.
Returns:
The height in pixels of component c in tile t.

getTileCompWidth

public int getTileCompWidth(int t,
                            int c)
Description copied from class: ImgDataAdapter
Returns the width in pixels of the specified tile-component tile.

This default implementation returns the value of the source.

Specified by:
getTileCompWidth in interface ImgData
Overrides:
getTileCompWidth in class ImgDataAdapter
Parameters:
t - Tile index
c - The index of the component, from 0 to N-1.
Returns:
The width in pixels of component c in tilet.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.