2-D Raster Rendering

2 messages Options
Embed this post
Permalink
Andrei Aiordachioaie

2-D Raster Rendering

Reply Threaded More More options
Print post
Permalink
Hello,

My name is Andrei, and I recently started working on the 2D raster
rendering part of deegree3, that is going to be used in particular in WMS.

I think I found a off-by-1 bug in the RasterFactory or ImageIO classes.
The test applet (module core)
org.deegree.rendering.r2d.RasterRendererApplet loads an image (car.jpg)
as an AbstractRaster object and tries to apply a Categorize function on
it. The loop over all the pixels reveals an error when trying to
retrieve the last "pixel" of the raster, from the lower-right corner.
Here is a stack trace:
[12:20:35] DEBUG: [Raster2RawData] Raster has size 308 x 400
[12:20:35] ERROR: [Raster2RawData] Error while parsing raster data, @
row=307, col=399
java.lang.IndexOutOfBoundsException
    at java.nio.Buffer.checkIndex(Buffer.java:520)
    at java.nio.HeapByteBuffer.getShort(HeapByteBuffer.java:289)
    at
org.deegree.coverage.raster.data.nio.ByteBufferRasterData.getShortSample(ByteBufferRasterData.java:559)
    at
org.deegree.coverage.raster.data.nio.ByteBufferRasterData.getShortPixel(ByteBufferRasterData.java:553)
    at
org.deegree.rendering.r2d.utils.Raster2RawData.parse(Raster2RawData.java:133)
    at
org.deegree.rendering.r2d.Java2DRasterRenderer.render(Java2DRasterRenderer.java:123)

I am stuck with this. Any ideas? And btw, if I convert the raster to a
BufferedImage and then back to a raster, the error above disappears. So
this is might be a bug in the ImageIO classes or in RasterFactory.

I also have a conceptual question. The SE spec describes that it is
possible to apply a Categorize function to a raster. If the raster has
only one band, then it's simple. But if the raster contains multiple
bands (from a RGB image), what value should I use to search in the
lookup table? (I wrote org.deegree.raster.r2d.utils.Raster2RawData
class, that converts a Raster to a Float matrix)

Cheers,
Andrei

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
deegree-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/deegree-devel
Andreas Schmitz

Re: 2-D Raster Rendering

Reply Threaded More More options
Print post
Permalink
Andrei Aiordachioaie wrote:

Hi,

> I think I found a off-by-1 bug in the RasterFactory or ImageIO classes.
> The test applet (module core)
> org.deegree.rendering.r2d.RasterRendererApplet loads an image (car.jpg)
> as an AbstractRaster object and tries to apply a Categorize function on
> it. The loop over all the pixels reveals an error when trying to
> retrieve the last "pixel" of the raster, from the lower-right corner.
> Here is a stack trace:
> [12:20:35] DEBUG: [Raster2RawData] Raster has size 308 x 400
> [12:20:35] ERROR: [Raster2RawData] Error while parsing raster data, @
> row=307, col=399
> java.lang.IndexOutOfBoundsException
>     at java.nio.Buffer.checkIndex(Buffer.java:520)
>     at java.nio.HeapByteBuffer.getShort(HeapByteBuffer.java:289)
>     at
> org.deegree.coverage.raster.data.nio.ByteBufferRasterData.getShortSample(ByteBufferRasterData.java:559)
>     at
> org.deegree.coverage.raster.data.nio.ByteBufferRasterData.getShortPixel(ByteBufferRasterData.java:553)
>     at
> org.deegree.rendering.r2d.utils.Raster2RawData.parse(Raster2RawData.java:133)
>     at
> org.deegree.rendering.r2d.Java2DRasterRenderer.render(Java2DRasterRenderer.java:123)
are you still getting this error when you update? I think the problem
was fixed some day last week.

> I also have a conceptual question. The SE spec describes that it is
> possible to apply a Categorize function to a raster. If the raster has
> only one band, then it's simple. But if the raster contains multiple
> bands (from a RGB image), what value should I use to search in the
> lookup table? (I wrote org.deegree.raster.r2d.utils.Raster2RawData
> class, that converts a Raster to a Float matrix)

I'm unsure on how to interpret it in this case. I think a possible
interpretation would be to operate on each channel separately. A
straightforward configuration of the user would select one channel, and
operate a color map on this selected channel (ie, the channel selection
occurs before applying the color map). If more than one channel is
selected, they would be color mapped separately, then combined in the
resulting image.

Best regards, Andreas
--
l a t / l o n  GmbH
Aennchenstrasse 19           53177 Bonn, Germany
phone ++49 +228 18496-0      fax ++49 +228 1849629
http://www.lat-lon.de        http://www.deegree.org


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
deegree-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/deegree-devel

signature.asc (204 bytes) Download Attachment