Simone Giannecchini a écrit :
> How do you assemble them if you are not using the mosaic?

Step 1
------
Create the target BufferedImage (initially empty). This is the only image
created, and it is created with exactly the final size as specified in
ImageReadParam, nothing more.

Step 2
------
For each tile, invoke the following:

 * ImageReadParam.setSourceRegion(Rectangle)
   With only the part of the tile we want to read

 * ImageReadParam.setDestination(image)
   where 'image' is the BufferedImage created at step 1.

 * ImageReadParam.setDestinationOffset(Point)
   with the coordinate where to write the image.


Step 3
------
Invoke ImageReader.read(param) for each tile. You can verify that it returns
exactly the same BufferedImage than the one specified at step 2. No new
BufferedImage was created.



Aftermath
---------
Exactly *ONE* and only one image is created, only the final destination image
and nothing else. No temporary BufferedImage created for each tile. No copy
needed using JAI "Mosaic" operation. Actually no operation at all, neither JAI
or whatever - the pixels are exactly where they should be straight after
ImageRead.read(...) call, nothing more, nothing less.


References
----------
http://java.sun.com/javase/6/docs/api/javax/imageio/ImageReadParam.html#setDestination(java.awt.image.BufferedImage)
http://java.sun.com/javase/6/docs/api/javax/imageio/IIOParam.html#setDestinationOffset(java.awt.Point)



> Are you designin with in mind using deferred loading via JAI ImageRead
> or directly the ImageRead as you showed me for SeaGis?

This work is done at javax.imageio.ImageReader level, so JAI is not involved at
all at this level. The MosaicImageReader can be wrapped in a JAI "ImageRead"
operation like any other ImageReader operation, at user choice. If the
"ImageRead" operation requires only a Tile, it should be cascaded through
MosaicImageReader straight to the appropriate image to read.


        Martin

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to