Creating tiled image from multiple tiff sources in JAI  
Author Message
Michael David Pedersen





PostPosted: 2004-7-22 5:10:00 Top

java-programmer, Creating tiled image from multiple tiff sources in JAI Hi all,

My situation is as follows. I have a number of tiff files containing
adjacent tiles which I would like to combine into one image. Currently I
achieve this goal in the following manner using the Java Advanced Imaging
library:

1) Create a target TiledImage with attributes appropriate to hold all tiles.
2) Load each tiff file into a separate PlanarImage.
3) Get the Rasters of each of these PlanarImages and translate coordinates
according to the rectangle they must occupy in the target TiledImage
4) Invoke TiledImage.setData(Raster) with the translated raster for each
tile

This works ok, but it does not seem to take advantage of the JAI's
pull-model; image data is loaded into memory immediately, probably as a
consequence of the call to getRaster(). However I wish to defer the loading
of image data into memory until it is needed, because only a subset of all
tiles are two be displayed at any one time.

I hence believe I need something along the lines of the NullOpImage class.
Unfortunately, the constructor for this class only takes a single source,
while I need to be able to pass a source for each tiff tile. One solution is
to subclass NullOpImage (or its superclass, PointOpImage) and take care of
things myself. Is this the way to go about it, or is there a better and
easier solution?

Any suggestions will be greatly appreciated.
Regards,
Michael.


 
ak





PostPosted: 2004-7-22 5:39:00 Top

java-programmer >> Creating tiled image from multiple tiff sources in JAI > My situation is as follows. I have a number of tiff files containing
> adjacent tiles which I would like to combine into one image. Currently I
> achieve this goal in the following manner using the Java Advanced Imaging
> library:
>
> 1) Create a target TiledImage with attributes appropriate to hold all
tiles.
> 2) Load each tiff file into a separate PlanarImage.
> 3) Get the Rasters of each of these PlanarImages and translate coordinates
> according to the rectangle they must occupy in the target TiledImage
> 4) Invoke TiledImage.setData(Raster) with the translated raster for each
> tile

I think this is a wrong way, there is a special OP for such things.
Search JAI-INTEREST ARCHIVES
(http://archives.java.sun.com/cgi-bin/wa?A0=JAI-INTEREST&D=0&I=-3)
for Mosaic.

--
Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader


 
Michael David Pedersen





PostPosted: 2004-7-23 6:00:00 Top

java-programmer >> Creating tiled image from multiple tiff sources in JAI Hi Andrei,

> I think this is a wrong way, there is a special OP for such things.
> Search JAI-INTEREST ARCHIVES
> (http://archives.java.sun.com/cgi-bin/wa?A0=JAI-INTEREST&D=0&I=-3)
> for Mosaic.

Thank you, that is exactly what I was looking for. I couldn't find mention
of the Mosaic class in the "Programming in Java Advanced Imaging" guide, but
apparently it is a relatively new addition.

Regards,
Michael.