001: /*
002: * $RCSfile: ImgData.java,v $
003: * $Revision: 1.1 $
004: * $Date: 2005/02/11 05:02:12 $
005: * $State: Exp $
006: *
007: * Interface: ImgData
008: *
009: * Description: The interface for classes that provide image
010: * 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.image;
050:
051: import java.awt.Point;
052:
053: /**
054: * This interface defines methods to access image attributes (width, height,
055: * number of components, etc.). The image can be tiled or not (i.e. if the
056: * image is not tiled then there is only 1 tile). It should be implemented by
057: * all classes that provide image data, such as image file readers, color
058: * transforms, wavelet transforms, 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 'BlkImgDataSrc'.
061: *
062: * @see BlkImgDataSrc
063: * */
064: public interface ImgData {
065: /**
066: * Returns the overall width of the current tile in pixels. This is the
067: * tile's width without accounting for any component subsampling. This is
068: * also referred as the reference grid width in the current tile.
069: *
070: * @return The total current tile's width in pixels.
071: * */
072: public int getTileWidth();
073:
074: /**
075: * Returns the overall height of the current tile in pixels. This is the
076: * tile's height without accounting for any component subsampling. This is
077: * also referred as the reference grid height in the current tile.
078: *
079: * @return The total current tile's height in pixels.
080: * */
081: public int getTileHeight();
082:
083: /** Returns the nominal tiles width */
084: public int getNomTileWidth();
085:
086: /** Returns the nominal tiles height */
087: public int getNomTileHeight();
088:
089: /**
090: * Returns the overall width of the image in pixels. This is the image's
091: * width without accounting for any component subsampling or tiling.
092: *
093: * @return The total image's width in pixels.
094: * */
095: public int getImgWidth();
096:
097: /**
098: * Returns the overall height of the image in pixels. This is the image's
099: * height without accounting for any component subsampling or tiling.
100: *
101: * @return The total image's height in pixels.
102: * */
103: public int getImgHeight();
104:
105: /**
106: * Returns the number of components in the image.
107: *
108: * @return The number of components in the image.
109: * */
110: public int getNumComps();
111:
112: /**
113: * Returns the component subsampling factor in the horizontal direction,
114: * for the specified component. This is, approximately, the ratio of
115: * dimensions between the reference grid and the component itself, see the
116: * 'ImgData' interface desription for details.
117: *
118: * @param c The index of the component (between 0 and N-1)
119: *
120: * @return The horizontal subsampling factor of component 'c'
121: *
122: * @see ImgData
123: * */
124: public int getCompSubsX(int c);
125:
126: /**
127: * Returns the component subsampling factor in the vertical direction, for
128: * the specified component. This is, approximately, the ratio of
129: * dimensions between the reference grid and the component itself, see the
130: * 'ImgData' interface desription for details.
131: *
132: * @param c The index of the component (between 0 and N-1)
133: *
134: * @return The vertical subsampling factor of component 'c'
135: *
136: * @see ImgData
137: * */
138: public int getCompSubsY(int c);
139:
140: /**
141: * Returns the width in pixels of the specified tile-component
142: *
143: * @param t Tile index
144: *
145: * @param c The index of the component, from 0 to N-1.
146: *
147: * @return The width in pixels of component <tt>c</tt> in tile<tt>t</tt>.
148: * */
149: public int getTileCompWidth(int t, int c);
150:
151: /**
152: * Returns the height in pixels of the specified tile-component.
153: *
154: * @param t The tile index.
155: *
156: * @param c The index of the component, from 0 to N-1.
157: *
158: * @return The height in pixels of component <tt>c</tt> in tile
159: * <tt>t</tt>.
160: * */
161: public int getTileCompHeight(int t, int c);
162:
163: /**
164: * Returns the width in pixels of the specified component in the overall
165: * image.
166: *
167: * @param c The index of the component, from 0 to N-1.
168: *
169: * @return The width in pixels of component <tt>c</tt> in the overall
170: * image.
171: * */
172: public int getCompImgWidth(int c);
173:
174: /**
175: * Returns the height in pixels of the specified component in the overall
176: * image.
177: *
178: * @param c The index of the component, from 0 to N-1.
179: *
180: * @return The height in pixels of component <tt>n</tt> in the overall
181: * image.
182: * */
183: public int getCompImgHeight(int c);
184:
185: /**
186: * Returns the number of bits, referred to as the "range bits",
187: * corresponding to the nominal range of the image data in the specified
188: * component. If this number is <i>n</b> then for unsigned data the
189: * nominal range is between 0 and 2^b-1, and for signed data it is between
190: * -2^(b-1) and 2^(b-1)-1. In the case of transformed data which is not in
191: * the image domain (e.g., wavelet coefficients), this method returns the
192: * "range bits" of the image data that generated the coefficients.
193: *
194: * @param c The index of the component.
195: *
196: * @return The number of bits corresponding to the nominal range of the
197: * image data (in the image domain).
198: * */
199: public int getNomRangeBits(int c);
200:
201: /**
202: * Changes the current tile, given the new indices. An
203: * IllegalArgumentException is thrown if the coordinates do not correspond
204: * to a valid tile.
205: *
206: * @param x The horizontal index of the tile.
207: *
208: * @param y The vertical index of the new tile.
209: * */
210: public void setTile(int x, int y);
211:
212: /**
213: * Advances to the next tile, in standard scan-line order (by rows then
214: * columns). An NoNextElementException is thrown if the current tile is
215: * the last one (i.e. there is no next tile).
216: * */
217: public void nextTile();
218:
219: /**
220: * Returns the indixes of the current tile. These are the horizontal and
221: * vertical indexes of the current tile.
222: *
223: * @param co If not null this object is used to return the information. If
224: * null a new one is created and returned.
225: *
226: * @return The current tile's indices (vertical and horizontal indexes).
227: * */
228: public Point getTile(Point co);
229:
230: /**
231: * Returns the index of the current tile, relative to a standard scan-line
232: * order.
233: *
234: * @return The current tile's index (starts at 0).
235: * */
236: public int getTileIdx();
237:
238: /** Returns the horizontal tile partition offset in the reference grid */
239: public int getTilePartULX();
240:
241: /** Returns the vertical tile partition offset in the reference grid */
242: public int getTilePartULY();
243:
244: /**
245: * Returns the horizontal coordinate of the upper-left corner of the
246: * specified component in the current tile.
247: *
248: * @param c The index of the component.
249: * */
250: public int getCompULX(int c);
251:
252: /**
253: * Returns the vertical coordinate of the upper-left corner of the
254: * specified component in the current tile.
255: *
256: * @param c The index of the component.
257: * */
258: public int getCompULY(int c);
259:
260: /**
261: * Returns the horizontal coordinate of the image origin, the top-left
262: * corner, in the canvas system, on the reference grid.
263: *
264: * @return The horizontal coordinate of the image origin in the canvas
265: * system, on the reference grid.
266: * */
267: public int getImgULX();
268:
269: /**
270: * Returns the vertical coordinate of the image origin, the top-left
271: * corner, in the canvas system, on the reference grid.
272: *
273: * @return The vertical coordinate of the image origin in the canvas
274: * system, on the reference grid.
275: * */
276: public int getImgULY();
277:
278: /**
279: * Returns the number of tiles in the horizontal and vertical directions.
280: *
281: * @param co If not null this object is used to return the information. If
282: * null a new one is created and returned.
283: *
284: * @return The number of tiles in the horizontal (Point.x) and vertical
285: * (Point.y) directions.
286: * */
287: public Point getNumTiles(Point co);
288:
289: /**
290: * Returns the total number of tiles in the image.
291: *
292: * @return The total number of tiles in the image.
293: * */
294: public int getNumTiles();
295:
296: }
|