001: /*
002: * $RCSfile: MultiResImgData.java,v $
003: * $Revision: 1.1 $
004: * $Date: 2005/02/11 05:02:33 $
005: * $State: Exp $
006: *
007: * Class: MultiResImgData
008: *
009: * Description: The interface for classes that provide
010: * multi-resolution image data.
011: *
012: *
013: *
014: * COPYRIGHT:
015: *
016: * This software module was originally developed by Raphaël Grosbois and
017: * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel
018: * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David
019: * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research
020: * Centre France S.A) in the course of development of the JPEG2000
021: * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This
022: * software module is an implementation of a part of the JPEG 2000
023: * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio
024: * Systems AB and Canon Research Centre France S.A (collectively JJ2000
025: * Partners) agree not to assert against ISO/IEC and users of the JPEG
026: * 2000 Standard (Users) any of their rights under the copyright, not
027: * including other intellectual property rights, for this software module
028: * with respect to the usage by ISO/IEC and Users of this software module
029: * or modifications thereof for use in hardware or software products
030: * claiming conformance to the JPEG 2000 Standard. Those intending to use
031: * this software module in hardware or software products are advised that
032: * their use may infringe existing patents. The original developers of
033: * this software module, JJ2000 Partners and ISO/IEC assume no liability
034: * for use of this software module or modifications thereof. No license
035: * or right to this software module is granted for non JPEG 2000 Standard
036: * conforming products. JJ2000 Partners have full right to use this
037: * software module for his/her own purpose, assign or donate this
038: * software module to any third party and to inhibit third parties from
039: * using this software module for non JPEG 2000 Standard conforming
040: * products. This copyright notice must be included in all copies or
041: * derivative works of this software module.
042: *
043: * Copyright (c) 1999/2000 JJ2000 Partners.
044: *
045: *
046: *
047: */
048:
049: package jj2000.j2k.wavelet.synthesis;
050:
051: import java.awt.Point;
052: import jj2000.j2k.image.*;
053:
054: /**
055: * This interface defines methods to access image attributes (width, height,
056: * number of components, etc.) of multiresolution images, such as those
057: * resulting from an inverse wavelet transform. The image can be tiled or not
058: * (i.e. if the image is not tiled then there is only 1 tile). It should be
059: * implemented by all classes that provide multi-resolution image data, such
060: * as entropy decoders, dequantizers, etc. This interface, however, does not
061: * define methods to transfer image data (i.e. pixel data), that is defined by
062: * other interfaces, such as 'CBlkQuantDataSrcDec'.
063: *
064: * <p>This interface is very similar to the 'ImgData' one. It differs only by
065: * the fact that it handles multiple resolutions.</p>
066: *
067: * <p>Resolution levels are counted from 0 to L. Resolution level 0 is the
068: * lower resolution, while L is the maximum resolution level, or full
069: * resolution, which is returned by 'getMaxResLvl()'. Note that there are L+1
070: * resolution levels available.</p>
071: *
072: * <p>As in the 'ImgData' interface a multi-resolution image lies on top of a
073: * canvas. The canvas coordinates are mapped from the full resolution
074: * reference grid (i.e. resolution level 'L' reference grid) to a resolution
075: * level 'l' reference grid by '(x_l,y_l) =
076: * (ceil(x_l/2^(L-l)),ceil(y_l/2^(L-l)))', where '(x,y)' are the full
077: * resolution reference grid coordinates and '(x_l,y_l)' are the level 'l'
078: * reference grid coordinates.</p>
079: *
080: * <p>For details on the canvas system and its implications consult the
081: * 'ImgData' interface.</p>
082: *
083: * <p>Note that tile sizes may not be obtained by simply dividing the tile
084: * size in the reference grid by the subsampling factor.</p>
085: *
086: * @see jj2000.j2k.image.ImgData
087: *
088: * @see jj2000.j2k.quantization.dequantizer.CBlkQuantDataSrcDec
089: * */
090: public interface MultiResImgData {
091:
092: /**
093: * Returns the overall width of the current tile in pixels for the given
094: * resolution level. This is the tile's width without accounting for any
095: * component subsampling. The resolution level is indexed from the lowest
096: * number of resolution levels of all components of the current tile.
097: *
098: * @param rl The resolution level, from 0 to L.
099: *
100: * @return The total current tile's width in pixels.
101: * */
102: public int getTileWidth(int rl);
103:
104: /**
105: * Returns the overall height of the current tile in pixels, for the given
106: * resolution level. This is the tile's height without accounting for any
107: * component subsampling. The resolution level is indexed from the lowest
108: * number of resolution levels of all components of the current tile.
109: *
110: * @param rl The resolution level, from 0 to L.
111: *
112: * @return The total current tile's height in pixels.
113: * */
114: public int getTileHeight(int rl);
115:
116: /** Returns the nominal tiles width */
117: public int getNomTileWidth();
118:
119: /** Returns the nominal tiles height */
120: public int getNomTileHeight();
121:
122: /**
123: * Returns the overall width of the image in pixels, for the given
124: * resolution level. This is the image's width without accounting for any
125: * component subsampling or tiling. The resolution level is indexed from
126: * the lowest number of resolution levels of all components of the current
127: * tile.
128: *
129: * @param rl The resolution level, from 0 to L.
130: *
131: * @return The total image's width in pixels.
132: * */
133: public int getImgWidth(int rl);
134:
135: /**
136: * Returns the overall height of the image in pixels, for the given
137: * resolution level. This is the image's height without accounting for any
138: * component subsampling or tiling. The resolution level is indexed from
139: * the lowest number of resolution levels of all components of the current
140: * tile.
141: *
142: * @param rl The resolution level, from 0 to L.
143: *
144: * @return The total image's height in pixels.
145: * */
146: public int getImgHeight(int rl);
147:
148: /**
149: * Returns the number of components in the image.
150: *
151: * @return The number of components in the image.
152: * */
153: public int getNumComps();
154:
155: /**
156: * Returns the component subsampling factor in the horizontal direction,
157: * for the specified component. This is, approximately, the ratio of
158: * dimensions between the reference grid and the component itself, see the
159: * 'ImgData' interface desription for details.
160: *
161: * @param c The index of the component (between 0 and N-1)
162: *
163: * @return The horizontal subsampling factor of component 'c'
164: *
165: * @see jj2000.j2k.image.ImgData
166: * */
167: public int getCompSubsX(int c);
168:
169: /**
170: * Returns the component subsampling factor in the vertical direction, for
171: * the specified component. This is, approximately, the ratio of
172: * dimensions between the reference grid and the component itself, see the
173: * 'ImgData' interface desription for details.
174: *
175: * @param c The index of the component (between 0 and N-1)
176: *
177: * @return The vertical subsampling factor of component 'c'
178: *
179: * @see jj2000.j2k.image.ImgData
180: * */
181: public int getCompSubsY(int c);
182:
183: /**
184: * Returns the width in pixels of the specified tile-component for the
185: * given resolution level.
186: *
187: * @param t Tile index
188: *
189: * @param c The index of the component, from 0 to N-1.
190: *
191: * @param rl The resolution level, from 0 to L.
192: *
193: * @return The width in pixels of component <tt>c</tt> in tile <tt>t</tt>
194: * for resolution <tt>rl</tt>.
195: * */
196: public int getTileCompWidth(int t, int c, int rl);
197:
198: /**
199: * Returns the height in pixels of the specified tile-component for the
200: * given resolution level.
201: *
202: * @param t The tile index.
203: *
204: * @param c The index of the component, from 0 to N-1.
205: *
206: * @param rl The resolution level, from 0 to L.
207: *
208: * @return The height in pixels of component <tt>c</tt> in tile
209: * <tt>t</tt>.
210: * */
211: public int getTileCompHeight(int t, int c, int rl);
212:
213: /**
214: * Returns the width in pixels of the specified component in the overall
215: * image, for the given resolution level.
216: *
217: * @param c The index of the component, from 0 to N-1.
218: *
219: * @param rl The resolution level, from 0 to L.
220: *
221: * @return The width in pixels of component <tt>c</tt> in the overall
222: * image.
223: * */
224: public int getCompImgWidth(int c, int rl);
225:
226: /**
227: * Returns the height in pixels of the specified component in the overall
228: * image, for the given resolution level.
229: *
230: * @param c The index of the component, from 0 to N-1.
231: *
232: * @param rl The resolution level, from 0 to L.
233: *
234: * @return The height in pixels of component <tt>n</tt> in the overall
235: * image.
236: * */
237: public int getCompImgHeight(int n, int rl);
238:
239: /**
240: * Changes the current tile, given the new indexes. An
241: * IllegalArgumentException is thrown if the indexes do not correspond to
242: * a valid tile.
243: *
244: * @param x The horizontal indexes the tile.
245: *
246: * @param y The vertical indexes of the new tile.
247: * */
248: public void setTile(int x, int y);
249:
250: /**
251: * Advances to the next tile, in standard scan-line order (by rows then
252: * columns). An NoNextElementException is thrown if the current tile is
253: * the last one (i.e. there is no next tile).
254: * */
255: public void nextTile();
256:
257: /**
258: * Returns the indexes of the current tile. These are the horizontal and
259: * vertical indexes of the current tile.
260: *
261: * @param co If not null this object is used to return the information. If
262: * null a new one is created and returned.
263: *
264: * @return The current tile's indexes (vertical and horizontal indexes).
265: * */
266: public Point getTile(Point co);
267:
268: /**
269: * Returns the index of the current tile, relative to a standard scan-line
270: * order.
271: *
272: * @return The current tile's index (starts at 0).
273: * */
274: public int getTileIdx();
275:
276: /**
277: * Returns the horizontal coordinate of the upper-left corner of the
278: * specified resolution in the given component of the current tile.
279: *
280: * @param c The component index.
281: *
282: * @param rl The resolution level index.
283: * */
284: public int getResULX(int c, int rl);
285:
286: /**
287: * Returns the vertical coordinate of the upper-left corner of the
288: * specified resolution in the given component of the current tile.
289: *
290: * @param c The component index.
291: *
292: * @param rl The resolution level index.
293: * */
294: public int getResULY(int c, int rl);
295:
296: /**
297: * Returns the horizontal coordinate of the image origin, the top-left
298: * corner, in the canvas system, on the reference grid at the specified
299: * resolution level. The resolution level is indexed from the lowest
300: * number of resolution levels of all components of the current tile.
301: *
302: * @param rl The resolution level, from 0 to L.
303: *
304: * @return The horizontal coordinate of the image origin in the canvas
305: * system, on the reference grid.
306: * */
307: public int getImgULX(int rl);
308:
309: /**
310: * Returns the vertical coordinate of the image origin, the top-left
311: * corner, in the canvas system, on the reference grid at the specified
312: * resolution level. The resolution level is indexed from the lowest
313: * number of resolution levels of all components of the current tile.
314: *
315: * @param rl The resolution level, from 0 to L.
316: *
317: * @return The vertical coordinate of the image origin in the canvas
318: * system, on the reference grid.
319: * */
320: public int getImgULY(int rl);
321:
322: /** Returns the horizontal tile partition offset in the reference grid */
323: public int getTilePartULX();
324:
325: /** Returns the vertical tile partition offset in the reference grid */
326: public int getTilePartULY();
327:
328: /**
329: * Returns the number of tiles in the horizontal and vertical directions.
330: *
331: * @param co If not null this object is used to return the information. If
332: * null a new one is created and returned.
333: *
334: * @return The number of tiles in the horizontal (Point.x) and vertical
335: * (Point.y) directions.
336: * */
337: public Point getNumTiles(Point co);
338:
339: /**
340: * Returns the total number of tiles in the image.
341: *
342: * @return The total number of tiles in the image.
343: * */
344: public int getNumTiles();
345:
346: /**
347: * Returns the specified synthesis subband tree
348: *
349: * @param t Tile index.
350: *
351: * @param c Component index.
352: * */
353: public SubbandSyn getSynSubbandTree(int t, int c);
354: }
|