Caching tiles at beginning of processing chain
I have an application in which I am reading in a variety of images from tiled TIFF-format files, translating these files using the "Translate" operator, and then composing them together into a mosaic image using the "Mosaic" operator. For efficiency, I'd like to specify a particular tile cache to cache the tiles at the beginning of the processing chain, as they are read off disk. How can I make this happen?
I have been reading images as follows:
FileSeekableStream stream = new FileSeekableStream(fileName);
RenderedImage rawImage = JAI.create("stream", stream);
My initial guess was that I could specify a particular tile cache by adding RenderingHints to the JAI.create("stream" ...) call. I've tried doing this via:
RenderedImage rawImage = JAI.create("stream", stream, new TIFFParameterBlock(), renderingHints);
RenderedImage rawImage = JAI.create("stream", stream, null, renderingHints);
However, JAI tries to cast the renderingHints to Integer, and so this fails.
Question: Can one specify RenderingHints (and consequently a TileCache) for the "stream" operator, and if so how? Alternatively, do I need to add an additional stage to the processing chain to accomplish what I want to do, and if so what would that look like?