|
View:
New views
10 Messages
—
Rating Filter:
Alert me
|
|
|
working with custom tilecacheHi folks,
I've been working on a custom tile cache class that swaps tiles between memory and disk storage. At the risk of displaying my ignorance, how do I force JAI operations to use my custom cache ? I have a little test program that creates an image using the "constant" operation and I am trying to have it use my custom cache... DiskBasedTileCache cache = new DiskBasedTileCache(cacheParams); ImageLayout layout = new ImageLayout(); layout.setTileWidth(TILE_WIDTH); layout.setTileHeight(TILE_WIDTH); Map<RenderingHints.Key, Object> imgParams = new HashMap<RenderingHints.Key, Object>(); imgParams.put(JAI.KEY_IMAGE_LAYOUT, layout); imgParams.put(JAI.KEY_TILE_CACHE, cache); RenderingHints hints = new RenderingHints(imgParams); ParameterBlockJAI pb = new ParameterBlockJAI("constant"); pb.setParameter("width", (float)IMAGE_WIDTH); pb.setParameter("height", (float)IMAGE_HEIGHT); pb.setParameter("bandValues", new Double[]{0d, 1d, 2d}); RenderedOp op = JAI.create("constant", pb, hints); // force computation Raster tile = op.getTile(1, 1); The image is produced correctly but my cache is not used. I must be missing something obvious and I'd be very grateful for any tips. cheers Michael P.S. This new cache, if it ever works, will be available as part of the jai-tools project: http://code.google.com/p/jai-tools/ [Message sent by forum member 'cafeanimal' (cafeanimal)] http://forums.java.net/jive/thread.jspa?messageID=354565 --------------------------------------------------------------------- To unsubscribe, e-mail: interest-unsubscribe@... For additional commands, e-mail: interest-help@... |
|
|
Re: working with custom tilecacheThe tile cache saves the *inputs* to an operation, not the outputs.
"constant" has no inputs, so the cache does not get used. If you put another op in the chain after "constant", it should get used. You can also set the global tile cache (used for all ops) via the JAI object, but I don't recall the specific call offhand. -Bob jai-interest@... wrote: > Hi folks, > > I've been working on a custom tile cache class that swaps tiles between memory and disk storage. > > At the risk of displaying my ignorance, how do I force JAI operations to use my custom cache ? > > I have a little test program that creates an image using the "constant" operation and I am trying to have it use my custom cache... > > DiskBasedTileCache cache = new DiskBasedTileCache(cacheParams); > > ImageLayout layout = new ImageLayout(); > layout.setTileWidth(TILE_WIDTH); > layout.setTileHeight(TILE_WIDTH); > > Map<RenderingHints.Key, Object> imgParams = new HashMap<RenderingHints.Key, Object>(); > imgParams.put(JAI.KEY_IMAGE_LAYOUT, layout); > imgParams.put(JAI.KEY_TILE_CACHE, cache); > > RenderingHints hints = new RenderingHints(imgParams); > > ParameterBlockJAI pb = new ParameterBlockJAI("constant"); > pb.setParameter("width", (float)IMAGE_WIDTH); > pb.setParameter("height", (float)IMAGE_HEIGHT); > pb.setParameter("bandValues", new Double[]{0d, 1d, 2d}); > > RenderedOp op = JAI.create("constant", pb, hints); > > // force computation > Raster tile = op.getTile(1, 1); > > The image is produced correctly but my cache is not used. I must be missing something obvious and I'd be very grateful for any tips. > > cheers > Michael > > P.S. This new cache, if it ever works, will be available as part of the jai-tools project: http://code.google.com/p/jai-tools/ > [Message sent by forum member 'cafeanimal' (cafeanimal)] > > http://forums.java.net/jive/thread.jspa?messageID=354565 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: interest-unsubscribe@... > For additional commands, e-mail: interest-help@... > --------------------------------------------------------------------- To unsubscribe, e-mail: interest-unsubscribe@... For additional commands, e-mail: interest-help@... |
|
|
Re: working with custom tilecacheOh I see - thanks very much Bob !
<slaps forehead> I have a use case where I am converting vector data to raster. Data are written to the output image by drawing into it with Graphics2D methods. In such a case is there any commonly used approach to handle a very large output image as tiles ? The only thing that occurs to me straight off is to sub-class TiledImage. cheers Michael [Message sent by forum member 'cafeanimal' (cafeanimal)] http://forums.java.net/jive/thread.jspa?messageID=354815 --------------------------------------------------------------------- To unsubscribe, e-mail: interest-unsubscribe@... For additional commands, e-mail: interest-help@... |
|
|
Re: working with custom tilecachetrying to work out how to flag correct reply - don't see any buttons or links on replies with either safari or firefox
[Message sent by forum member 'cafeanimal' (cafeanimal)] http://forums.java.net/jive/thread.jspa?messageID=354817 --------------------------------------------------------------------- To unsubscribe, e-mail: interest-unsubscribe@... For additional commands, e-mail: interest-help@... |
|
|
Re: working with custom tilecacheOh I see - thanks very much Bob !
<slaps forehead> I have a use case where I am converting vector data to raster. Data are written to the output image by drawing into it with Graphics2D methods. In such a case is there any commonly used approach to handle a very large output image as tiles ? The only thing that occurs to me straight off is to sub-class TiledImage. cheers Michael [Message sent by forum member 'cafeanimal' (cafeanimal)] http://forums.java.net/jive/thread.jspa?messageID=354819 --------------------------------------------------------------------- To unsubscribe, e-mail: interest-unsubscribe@... For additional commands, e-mail: interest-help@... |
|
|
Re: working with custom tilecacheCiao Michael,
please, read below.... ------------------------------------------------------- Ing. Simone Giannecchini GeoSolutions S.A.S. Owner - 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://simboss.blogspot.com/ http://www.linkedin.com/in/simonegiannecchini ------------------------------------------------------- On Thu, Jul 9, 2009 at 6:45 AM, <jai-interest@...> wrote: > Oh I see - thanks very much Bob ! > > <slaps forehead> > > I have a use case where I am converting vector data to raster. Data are written to the output image by drawing into it with Graphics2D methods. In such a case is there any commonly used approach to handle a very large output image as tiles ? > > The only thing that occurs to me straight off is to sub-class TiledImage. That's the same thing I would do. TiledImage and TiledImageGraphics should give what you need. Specifically, if you wrap you tilecache as a WritableRenderedImage using TiledImage as a guideline you should be able to adapt quite easily a TiledImageGraphics (its a JAI class) which would allow you to perform Java2D operations on very large images, not bound memory bound. Ciao, Simone. > > cheers > Michael > [Message sent by forum member 'cafeanimal' (cafeanimal)] > > http://forums.java.net/jive/thread.jspa?messageID=354815 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: interest-unsubscribe@... > For additional commands, e-mail: interest-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: interest-unsubscribe@... For additional commands, e-mail: interest-help@... |
|
|
Re: working with custom tilecache> Specifically, if you wrap you tilecache as
> a WritableRenderedImage using TiledImage as a > guideline you should be > able to adapt quite easily a TiledImageGraphics (its > a JAI class) > which would allow you to perform Java2D operations on > very large > images, not bound memory bound. > Excellent - thanks very much Simone ! Also, based on Bob's advice (above) I added another node to the chain in my demo program (see first post) so that I now have: "constant" operation -> op1 -> "multiplyconst" operation -> op2 My custom cache is now being used (hurray) and the tiles have the data for the final OpImage in the chain, op2. From Bob's post I'd got the idea that outputs weren't cached. I obviously need to study how JAI chains work in more detail. Thanks again Michael [Message sent by forum member 'cafeanimal' (cafeanimal)] http://forums.java.net/jive/thread.jspa?messageID=354837 --------------------------------------------------------------------- To unsubscribe, e-mail: interest-unsubscribe@... For additional commands, e-mail: interest-help@... |
|
|
Re: working with custom tilecacheSome operators modify the source tiles in-place, after taking ownership
of them, of course. It's quite possible that's what multiplyconst does, as that's far more efficient than copying everything. I don't recall the details of this process, but that's probably what's happening. You keep picking special-case ops!! ;-) -Bob jai-interest@... wrote: >> Specifically, if you wrap you tilecache as >> a WritableRenderedImage using TiledImage as a >> guideline you should be >> able to adapt quite easily a TiledImageGraphics (its >> a JAI class) >> which would allow you to perform Java2D operations on >> very large >> images, not bound memory bound. >> > > Excellent - thanks very much Simone ! > > Also, based on Bob's advice (above) I added another node to the chain in my demo program (see first post) so that I now have: > > "constant" operation -> op1 -> "multiplyconst" operation -> op2 > > My custom cache is now being used (hurray) and the tiles have the data for the final OpImage in the chain, op2. From Bob's post I'd got the idea that outputs weren't cached. I obviously need to study how JAI chains work in more detail. > > Thanks again > Michael > [Message sent by forum member 'cafeanimal' (cafeanimal)] > > http://forums.java.net/jive/thread.jspa?messageID=354837 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: interest-unsubscribe@... > For additional commands, e-mail: interest-help@... > --------------------------------------------------------------------- To unsubscribe, e-mail: interest-unsubscribe@... For additional commands, e-mail: interest-help@... |
|
|
Re: working with custom tilecache> You keep picking special-case ops!! ;-)
> I seem to, but at least it's forcing me to think more :-) A first attempt at a disk and memory backed tile cache is described here... http://code.google.com/p/jai-tools/wiki/UtilsTileCache You can browse or download the source code from the site. There are also some unit tests and a small demo program for the tile cache. I'm sure there will be bugs to fix and much room for improvement in design and performance so I'd appreciate any comments from folks here. cheers Michael [Message sent by forum member 'cafeanimal' (cafeanimal)] http://forums.java.net/jive/thread.jspa?messageID=355707 --------------------------------------------------------------------- To unsubscribe, e-mail: interest-unsubscribe@... For additional commands, e-mail: interest-help@... |
|
|
Re: working with custom tilecacheHi folks,
I've just improved (I hope) the operation of the disk and memory backed tile cache class that forms part of the jai-tools project. A brief description is here: http://code.google.com/p/jai-tools/wiki/UtilsTileCache You can browse the source code at that site and/or download it with subversion. Any comments, bug reports etc much appreciated. cheers Michael [Message sent by forum member 'cafeanimal' (cafeanimal)] http://forums.java.net/jive/thread.jspa?messageID=360495 --------------------------------------------------------------------- To unsubscribe, e-mail: interest-unsubscribe@... For additional commands, e-mail: interest-help@... |
| Free embeddable forum powered by Nabble | Forum Help |