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
049package jj2000.j2k.wavelet.synthesis;
050import java.awt.Point;
051
052/**
053 * This interface defines methods to access image attributes (width, height,
054 * number of components, etc.) of multiresolution images, such as those
055 * resulting from an inverse wavelet transform. The image can be tiled or not
056 * (i.e. if the image is not tiled then there is only 1 tile). It should be
057 * implemented by all classes that provide multi-resolution image data, such
058 * as entropy decoders, dequantizers, etc. This interface, however, does not
059 * define methods to transfer image data (i.e. pixel data), that is defined by
060 * other interfaces, such as 'CBlkQuantDataSrcDec'.
061 *
062 * <p>This interface is very similar to the 'ImgData' one. It differs only by
063 * the fact that it handles multiple resolutions.</p>
064 *
065 * <p>Resolution levels are counted from 0 to L. Resolution level 0 is the
066 * lower resolution, while L is the maximum resolution level, or full
067 * resolution, which is returned by 'getMaxResLvl()'. Note that there are L+1
068 * resolution levels available.</p>
069 *
070 * <p>As in the 'ImgData' interface a multi-resolution image lies on top of a
071 * canvas. The canvas coordinates are mapped from the full resolution
072 * reference grid (i.e. resolution level 'L' reference grid) to a resolution
073 * level 'l' reference grid by '(x_l,y_l) =
074 * (ceil(x_l/2^(L-l)),ceil(y_l/2^(L-l)))', where '(x,y)' are the full
075 * resolution reference grid coordinates and '(x_l,y_l)' are the level 'l'
076 * reference grid coordinates.</p>
077 *
078 * <p>For details on the canvas system and its implications consult the
079 * 'ImgData' interface.</p>
080 *
081 * <p>Note that tile sizes may not be obtained by simply dividing the tile
082 * size in the reference grid by the subsampling factor.</p>
083 *
084 * @see jj2000.j2k.image.ImgData
085 *
086 * @see jj2000.j2k.quantization.dequantizer.CBlkQuantDataSrcDec
087 * */
088public interface MultiResImgData {
089
090    /**
091     * Returns the overall width of the current tile in pixels for the given
092     * resolution level. This is the tile's width without accounting for any
093     * component subsampling. The resolution level is indexed from the lowest
094     * number of resolution levels of all components of the current tile.
095     *
096     * @param rl The resolution level, from 0 to L.
097     *
098     * @return The total current tile's width in pixels.
099     * */
100    public int getTileWidth(int rl);
101
102    /**
103     * Returns the overall height of the current tile in pixels, for the given
104     * resolution level. This is the tile's height without accounting for any
105     * component subsampling. The resolution level is indexed from the lowest
106     * number of resolution levels of all components of the current tile.
107     *
108     * @param rl The resolution level, from 0 to L.
109     *
110     * @return The total current tile's height in pixels.
111     * */
112    public int getTileHeight(int rl);
113
114    /** Returns the nominal tiles width */
115    public int getNomTileWidth();
116
117    /** Returns the nominal tiles height */
118    public int getNomTileHeight();
119
120    /**
121     * Returns the overall width of the image in pixels, for the given
122     * resolution level. This is the image's width without accounting for any
123     * component subsampling or tiling. The resolution level is indexed from
124     * the lowest number of resolution levels of all components of the current
125     * tile.
126     *
127     * @param rl The resolution level, from 0 to L.
128     *
129     * @return The total image's width in pixels.
130     * */
131    public int getImgWidth(int rl);
132
133    /**
134     * Returns the overall height of the image in pixels, for the given
135     * resolution level. This is the image's height without accounting for any
136     * component subsampling or tiling. The resolution level is indexed from
137     * the lowest number of resolution levels of all components of the current
138     * tile.
139     *
140     * @param rl The resolution level, from 0 to L.
141     *
142     * @return The total image's height in pixels.
143     * */
144    public int getImgHeight(int rl);
145
146    /**
147     * Returns the number of components in the image.
148     *
149     * @return The number of components in the image.
150     * */
151    public int getNumComps();
152
153    /**
154     * Returns the component subsampling factor in the horizontal direction,
155     * for the specified component. This is, approximately, the ratio of
156     * dimensions between the reference grid and the component itself, see the
157     * 'ImgData' interface desription for details.
158     *
159     * @param c The index of the component (between 0 and N-1)
160     *
161     * @return The horizontal subsampling factor of component 'c'
162     *
163     * @see jj2000.j2k.image.ImgData
164     * */
165    public int getCompSubsX(int c);
166
167    /**
168     * Returns the component subsampling factor in the vertical direction, for
169     * the specified component. This is, approximately, the ratio of
170     * dimensions between the reference grid and the component itself, see the
171     * 'ImgData' interface desription for details.
172     *
173     * @param c The index of the component (between 0 and N-1)
174     *
175     * @return The vertical subsampling factor of component 'c'
176     *
177     * @see jj2000.j2k.image.ImgData
178     * */
179    public int getCompSubsY(int c);
180
181    /**
182     * Returns the width in pixels of the specified tile-component for the
183     * given resolution level.
184     *
185     * @param t Tile index
186     *
187     * @param c The index of the component, from 0 to N-1.
188     *
189     * @param rl The resolution level, from 0 to L.
190     *
191     * @return The width in pixels of component <tt>c</tt> in tile <tt>t</tt>
192     * for resolution <tt>rl</tt>.
193     * */
194    public int getTileCompWidth(int t,int c,int rl);
195
196    /**
197     * Returns the height in pixels of the specified tile-component for the
198     * given resolution level.
199     *
200     * @param t The tile index.
201     * 
202     * @param c The index of the component, from 0 to N-1.
203     *
204     * @param rl The resolution level, from 0 to L.
205     *
206     * @return The height in pixels of component <tt>c</tt> in tile
207     * <tt>t</tt>.
208     * */
209    public int getTileCompHeight(int t,int c,int rl);
210
211    /**
212     * Returns the width in pixels of the specified component in the overall
213     * image, for the given resolution level.
214     *
215     * @param c The index of the component, from 0 to N-1.
216     *
217     * @param rl The resolution level, from 0 to L.
218     *
219     * @return The width in pixels of component <tt>c</tt> in the overall
220     * image.
221     * */
222    public int getCompImgWidth(int c,int rl);
223
224    /**
225     * Returns the height in pixels of the specified component in the overall
226     * image, for the given resolution level.
227     *
228     * @param c The index of the component, from 0 to N-1.
229     *
230     * @param rl The resolution level, from 0 to L.
231     *
232     * @return The height in pixels of component <tt>n</tt> in the overall
233     * image.
234     * */
235    public int getCompImgHeight(int n, int rl);
236
237    /**
238     * Changes the current tile, given the new indexes. An
239     * IllegalArgumentException is thrown if the indexes do not correspond to
240     * a valid tile.
241     *
242     * @param x The horizontal indexes the tile.
243     *
244     * @param y The vertical indexes of the new tile.
245     * */
246    public void setTile(int x,int y);
247
248    /**
249     * Advances to the next tile, in standard scan-line order (by rows then
250     * columns). An NoNextElementException is thrown if the current tile is
251     * the last one (i.e. there is no next tile).
252     * */
253    public void nextTile();
254
255    /**
256     * Returns the indexes of the current tile. These are the horizontal and
257     * vertical indexes of the current tile.
258     *
259     * @param co If not null this object is used to return the information. If
260     * null a new one is created and returned.
261     *
262     * @return The current tile's indexes (vertical and horizontal indexes).
263     * */
264    public Point getTile(Point co);
265
266    /**
267     * Returns the index of the current tile, relative to a standard scan-line
268     * order.
269     *
270     * @return The current tile's index (starts at 0).
271     * */
272    public int getTileIdx();
273
274    /**
275     * Returns the horizontal coordinate of the upper-left corner of the
276     * specified resolution in the given component of the current tile.
277     *
278     * @param c The component index.
279     *
280     * @param rl The resolution level index.
281     * */
282    public int getResULX(int c,int rl);
283
284    /**
285     * Returns the vertical coordinate of the upper-left corner of the
286     * specified resolution in the given component of the current tile.
287     *
288     * @param c The component index.
289     *
290     * @param rl The resolution level index.
291     * */
292    public int getResULY(int c,int rl);
293
294    /**
295     * Returns the horizontal coordinate of the image origin, the top-left
296     * corner, in the canvas system, on the reference grid at the specified
297     * resolution level.  The resolution level is indexed from the lowest
298     * number of resolution levels of all components of the current tile.
299     *
300     * @param rl The resolution level, from 0 to L.
301     *
302     * @return The horizontal coordinate of the image origin in the canvas
303     * system, on the reference grid.
304     * */
305    public int getImgULX(int rl);
306
307    /**
308     * Returns the vertical coordinate of the image origin, the top-left
309     * corner, in the canvas system, on the reference grid at the specified
310     * resolution level.  The resolution level is indexed from the lowest
311     * number of resolution levels of all components of the current tile.
312     *
313     * @param rl The resolution level, from 0 to L.
314     *
315     * @return The vertical coordinate of the image origin in the canvas
316     * system, on the reference grid.
317     * */
318    public int getImgULY(int rl);
319
320    /** Returns the horizontal tile partition offset in the reference grid */
321    public int getTilePartULX();
322
323    /** Returns the vertical tile partition offset in the reference grid */
324    public int getTilePartULY();
325
326    /**
327     * Returns the number of tiles in the horizontal and vertical directions.
328     *
329     * @param co If not null this object is used to return the information. If
330     * null a new one is created and returned.
331     *
332     * @return The number of tiles in the horizontal (Point.x) and vertical
333     * (Point.y) directions.
334     * */
335    public Point getNumTiles(Point co);
336
337    /**
338     * Returns the total number of tiles in the image.
339     *
340     * @return The total number of tiles in the image.
341     * */
342    public int getNumTiles();
343
344    /** 
345     * Returns the specified synthesis subband tree 
346     * 
347     * @param t Tile index.
348     *
349     * @param c Component index.
350     * */
351    public SubbandSyn getSynSubbandTree(int t,int c);
352}