Skip to main content

How To Stop Tiling for Custom Operator ?

5 replies [Last post]
adwayish
Offline
Joined: 2008-10-18
Points: 0

Hi ,
I've created a custom statical operator . i dont know why the operator is forced to follow the Tiling mechanism ( execute the same operator for each tile ) .How can i stop this and make the operator call the function on the whole image ?

or how can make the image has one tile rather than several tiles ? i think that will solve the problem .

I'm new to JAI i dont know if i missed something . Is there something in the API to turn off/on tiling ?

Message was edited by: adwayish

Message was edited by: adwayish

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
adwayish
Offline
Joined: 2008-10-18
Points: 0

guys any hint ..?

i really need to find a solution for this problem . am i forced to design any operator to work with multiple tiles ? in this case i'll face concurrency issues which i prefer to avoid ..

Bob Deen

You can always put a "format" operator before your op to force it to a
single tile.

There is a way for an op to say "I need the entire input in order to
compute any results". The statistical operators have to work this way.
That way, even if the user asks for just a tile, you'll have access to
the entire input so you can calculate your stats correctly. Which at
least makes your operator correct, if not efficient. If the user is
careful to do a format first, it should be reasonably efficient too.
Look at cobbling of sources, perhaps, and the source area required to
compute a destination tile.

Note though that rendering hints are just that... hints. I don't think
there's any requirement for an operator to honor them... meaning you
could ignore the requested tile sizes and return the entire image every
time, if you wanted. Combine that with cobbling the entire image, and
you might get what you want.

I don't recall the details for any of this offhand, but know that it
should be possible. That might give you some hints as to where to look.

Good luck...

-Bob

jai-interest@javadesktop.org wrote:
> guys any hint ..?
>
> i really need to find a solution for this problem . am i forced to design any operator to work with multiple tiles ? in this case i'll face concurrency issues which i prefer to avoid ..
> [Message sent by forum member 'adwayish' (adwayish)]
>
> http://forums.java.net/jive/thread.jspa?messageID=351346
>
> ---------------------------------------------------------------------
> 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

Anonymous

Hi,
perhaps you could try following:

PlanarImage pi;
int width = pi.getWidth();
int height = pi.getHeight();

ImageLayout layout = new ImageLayout();
layout.setTileWidth(width);
layout.setTileHeight(height);

RenderingHints rh = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);

ParameterBlock pb = new ParameterBlock();
pb.addSource(pi);
pb.add(yourParamterValue);
PlanarImage piOut = JAI.create("YourOperator", pb, rh);

-Helmut

adwayish
Offline
Joined: 2008-10-18
Points: 0

Hello Helmut ,
am glad you brought this up , ive been investigating how to change a PlanarImage Layout cause i knew that ImageLayout is holding the Tile related properties but i couldnt change it since PlanarImage is read only. I've also tried TiledImage . anyway my guess it has something to do with "fileload" operation (which i use to load the image ) something inside this operation create the layout and set the tiles . am not sure though if i load the image with different way( e.g ImageIO.read() ) this will be different or not .

ive tried what you propose but it didnt work form me . will you test it and tell me if does for you ? thanks for your help appreciated .

If anyone has more informations about this or my understanding was wrong please enlightened me .

Message was edited by: adwayish

Anonymous

Hello adwayish,

you are right, my initial suggestion does not work, so I included a "Format" operation and fortunately this worked:

PlanarImage pi;
int width = pi.getWidth();
int height = pi.getHeight();

ImageLayout layout = new ImageLayout();
layout.setTileWidth(width);
layout.setTileHeight(height);

RenderingHints rh = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);

ParameterBlock pb = new ParameterBlock();
pb.addSource(pi);
pi = JAI.create("Format", pb, rh);

pb.removeSources();
pb.addSource(pi);
pb.add(yourParamterValue);
PlanarImage piOut = JAI.create("YourOperator", pb, null);