|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ImgData
This interface defines methods to access image attributes (width, height, number of components, etc.). The image can be tiled or not (i.e. if the image is not tiled then there is only 1 tile). It should be implemented by all classes that provide image data, such as image file readers, color transforms, wavelet transforms, etc. This interface, however, does not define methods to transfer image data (i.e. pixel data), that is defined by other interfaces, such as 'BlkImgDataSrc'.
The image itself is considered to lie on top of a canvas, and thus its top-left corner can be positioned at a coordinate other than (0,0). This canvas is partitioned into tiles (1 tile if there are no tiles). The origin for the partitioning into tiles might be different from the image origin. Since the tiles are a partition of the canvas, and not of the image itself, it is worth noting that some tiles (at the top, bottom, left or right) can partially lie outside of the image data. We call "active tile" the part of a tile that contains actual image data.
An image might be composed of several components (numbered from 0 to N-1), where each component can have a different resolution. We therefore define a reference grid, on which all components are layed down. Each component has an horizontal and a vertical subsampling factor, which determines the ratio of the grid's horizontal and vertical dimensions to the component's horizontal and vertical dimensions, respectively. Therefore if 'W' and 'H' are the width and height of the reference grid, 'Rx' and 'Ry' the horizontal and vertical subsampling factors, respectively, and 'ax' and 'ay' are the horizontal and vertical coordinates of the top-left corner of the reference grid with respect to the canvas origin, the width of the component is 'ceil((W+ax)/Rx)-ceil(ax/Rx)' and its height is 'ceil((H+ay)/Ry)-ceil(ay/Ry)'. Note that this formulae is not directly applicable to the tile sizes. In general, a coordinate in the reference grid is mapped to a component coordinate as 'x_c = ceil(x/Rx)' and 'y_c = ceil(y/Ry)', where '(x_c,y_c)' are the component coordinates, '(x,y)' the reference grid coordinates, both in the canvas system, and 'Rx' and 'Ry' the horizontal and vertical subsampling factors, respectively.
The reference grid dimensions are commonly referred to as "image" width and height, in contrast to component width and height. The 'getCompSubsX()' and 'getCompSubsY()' methods return the componet's subsampling factors.
The image origin '(ax,ay)' is returned by the 'getImgULX()' and 'getImgULY()' methods.
There is always one current tile. All data, coordinates and dimensions, always refer to the current active tile, unless otherwise specified. The current tile may be changed with the 'nextTile()' or 'setTile()' methods.
The coordinates (i.e. indexes) of the top-left tile are (0,0), for the other tiles the coordinates increase by one for each new tile (e.g., tile (1,2) is the second tile in the horizontal direction and the third tile in the vertical direction).
The coordinates of the top-left corner of each tile (and not of the active tile), with respect to the canvas component coordinates, is returned by the 'getTileOff()' method (these are component coordinates, not reference grid coordinates). For the top-left tile (i.e. tile (0,0)) this is the coordinates of the partitioning reference, in component coordinates. The coordinates of the top-left corner of the active tile, with respect to the tile, is returned by the 'getULX()' and 'getULY()' methods. All other coordinates, unless otherwise specified, are defined with respect to the active tile top-left corner (e.g., (0,0) is always the top-left corner of the current active tile) and are component coordinates (not reference grid coordinates).
As mentoned before the origin of tile partitioning might not be the image origin, nor the canvas one. The origin of the tile partition is a point with coordinates '(Px,Py)' in the canvas system, in the reference grid coordinates, where 'Px<=ax' and 'Py<=ay', where '(ax,ay)' is the image origin in tha canvas system, in the reference grid coordinates. The '(Px,Py)' point is the upper-left corner of the tile '(0,0)' in the canvas coordinate system, in the reference grid, which is not what the 'getTileOff()' method returns (this method returns the coordinates of the same point but in component coordinates).
Note that all other partitions (e.g., code-blocks) are done with respect a special origin, different from the above ones, which is not specified in the 'ImgData' interface.
BlkImgDataSrc
Method Summary | |
---|---|
int |
getCompHeight(int n)
Returns the height in pixels of the specified component in the current tile. |
int |
getCompImgHeight(int n)
Returns the height in pixels of the specified component in the overall image. |
int |
getCompImgWidth(int n)
Returns the width in pixels of the specified component in the overall image. |
int |
getCompSubsX(int n)
Returns the component subsampling factor in the horizontal direction, for the specified component. |
int |
getCompSubsY(int n)
Returns the component subsampling factor in the vertical direction, for the specified component. |
int |
getCompWidth(int n)
Returns the width in pixels of the specified component in the current tile. |
int |
getHeight()
Returns the overall height of the current tile in pixels. |
int |
getImgHeight()
Returns the overall height of the image in pixels. |
int |
getImgULX()
Returns the horizontal coordinate of the image origin, the top-left corner, in the canvas system, on the reference grid. |
int |
getImgULY()
Returns the vertical coordinate of the image origin, the top-left corner, in the canvas system, on the reference grid. |
int |
getImgWidth()
Returns the overall width of the image in pixels. |
int |
getNomRangeBits(int n)
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 |
getNumComps()
Returns the number of components in the image. |
int |
getNumTiles()
Returns the total number of tiles in the image. |
Coord |
getNumTiles(Coord co)
Returns the number of tiles in the horizontal and vertical directions. |
Coord |
getTile(Coord co)
Returns the indixes of the current tile. |
int |
getTileIdx()
Returns the index of the current tile, relative to a standard scan-line order. |
Coord |
getTileOff(Coord co,
int n)
Returns the horizontal and vertical offset of the upper-left corner of the current tile, in the specified component, relative to the canvas origin, in the component coordinates (not in the reference grid coordinates). |
int |
getULX(int n)
Returns the horizontal coordinate of the upper-left corner of the active tile, with respect to the canvas origin, in the component coordinates, for the specified component. |
int |
getULY(int n)
Returns the vertical coordinate of the upper-left corner of the active tile, with respect to the canvas origin, in the component coordinates, for the specified component. |
int |
getWidth()
Returns the overall width of the current tile in pixels. |
void |
nextTile()
Advances to the next tile, in standard scan-line order (by rows then columns). |
void |
setTile(int x,
int y)
Changes the current tile, given the new indices. |
Method Detail |
---|
int getWidth()
int getHeight()
int getImgWidth()
int getImgHeight()
int getNumComps()
int getCompSubsX(int n)
n
- The index of the component (between 0 and N-1)
ImgData
int getCompSubsY(int n)
n
- The index of the component (between 0 and N-1)
ImgData
int getCompWidth(int n)
n
- The index of the component, from 0 to N-1.
int getCompHeight(int n)
n
- The index of the component, from 0 to N-1.
int getCompImgWidth(int n)
n
- The index of the component, from 0 to N-1.
int getCompImgHeight(int n)
n
- The index of the component, from 0 to N-1.
int getNomRangeBits(int n)
n
- The index of the component.
void setTile(int x, int y)
x
- The horizontal index of the tile.y
- The vertical index of the new tile.void nextTile()
Coord getTile(Coord co)
co
- If not null this object is used to return the
information. If null a new one is created and returned.
int getTileIdx()
Coord getTileOff(Coord co, int n)
co
- If not null the object is used to return the values,
if null a new one is created and returned.n
- The index of the component (between 0 and N-1)
int getULX(int n)
n
- The index of the component (between 0 and N-1)
int getULY(int n)
n
- The index of the component (between 0 and N-1)
int getImgULX()
int getImgULY()
Coord getNumTiles(Coord co)
co
- If not null this object is used to return the
information. If null a new one is created and returned.
int getNumTiles()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |