Skip to main content

[JAI] Problem placing pictures within a mosaic

2 replies [Last post]
Anonymous

Hello

I'm trying to use JAI to create a mosaic consisting of four TIF images
each of which is 5000 by 5000. The code I have written so far is as
follows ..

RenderedOp mosaic=null;
ParameterBlock pbMosaic=new ParameterBlock();
pbMosaic.add(MosaicDescriptor.MOSAIC_TYPE_OVERLAY);
RenderedOp in=null;
// Get 4 tiles and add them to the Mosaic
in=returnRenderedOp(path,"northwest.tif");
pbMosaic.addSource(in);
in=returnRenderedOp(path,"northeast.tif");
pbMosaic.addSource(in);
in=returnRenderedOp(path,"southwest.tif");
pbMosaic.addSource(in);
in=returnRenderedOp(path,"southeast.tif");
pbMosaic.addSource(in);
// Setup the ImageLayout
ImageLayout imageLayout=new ImageLayout(0,0,10000,10000);
imageLayout.setTileWidth(5000);
imageLayout.setTileHeight(5000);
imageLayout.setColorModel(in.getColorModel());
imageLayout.setSampleModel(in.getSampleModel());
mosaic=JAI.create("mosaic",pbMosaic,new
RenderingHints(JAI.KEY_IMAGE_LAYOUT,imageLayout));

The problem is that all 4 images are being positioned in the same
place in the top left hand corner of the mosaic so the other three
quarters of it remain empty. It looks like I need some way of telling
the program how to position each TIF within the mosaic. I thought this
would be done with ImageLayout but reading the documentation I'm
unable to see how. Can anyone help me ?

Thanks for your time

Ian

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Simone Giannecchini

you need to use translate to position them correctly on the final frame.

Simone.
-------------------------------------------------------
Ing. Simone Giannecchini
GeoSolutions S.A.S.
Founder - Software Engineer
Via Carignoni 51
55041 Camaiore (LU)
Italy

phone: +39 0584983027
fax: +39 0584983027
mob: +39 333 8128928

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.linkedin.com/in/simonegiannecchini
http://twitter.com/simogeo

-------------------------------------------------------

On Sat, May 8, 2010 at 12:57 PM, Ian Wraith wrote:
> Hello
>
> I'm trying to use JAI to create a mosaic consisting of four TIF images
> each of which is 5000 by 5000. The code I have written so far is as
> follows ..
>
>    RenderedOp mosaic=null;
>    ParameterBlock pbMosaic=new ParameterBlock();
>    pbMosaic.add(MosaicDescriptor.MOSAIC_TYPE_OVERLAY);
>    RenderedOp in=null;
>    // Get 4 tiles and add them to the Mosaic
>    in=returnRenderedOp(path,"northwest.tif");
>    pbMosaic.addSource(in);
>    in=returnRenderedOp(path,"northeast.tif");
>    pbMosaic.addSource(in);
>    in=returnRenderedOp(path,"southwest.tif");
>    pbMosaic.addSource(in);
>    in=returnRenderedOp(path,"southeast.tif");
>    pbMosaic.addSource(in);
>    // Setup the ImageLayout
>    ImageLayout imageLayout=new ImageLayout(0,0,10000,10000);
>    imageLayout.setTileWidth(5000);
>    imageLayout.setTileHeight(5000);
>    imageLayout.setColorModel(in.getColorModel());
>    imageLayout.setSampleModel(in.getSampleModel());
>    mosaic=JAI.create("mosaic",pbMosaic,new
> RenderingHints(JAI.KEY_IMAGE_LAYOUT,imageLayout));
>
> The problem is that all 4 images are being positioned in the same
> place in the top left hand corner of the mosaic so the other three
> quarters of it remain empty. It looks like I need some way of telling
> the program how to position each TIF within the mosaic. I thought this
> would be done with ImageLayout but reading the documentation I'm
> unable to see how. Can anyone help me ?
>
> Thanks for your time
>
> Ian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

Ian Wraith

Hello Simone & all

On 9 May 2010 18:15, Simone Giannecchini
wrote:
> you need to use translate to position them correctly on the final frame.

Thank you very much for your help I now have all the pictures
appearing in the correct places.

Thanks again.

Ian

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net