> The data I need to view is in the following format.
> Image data: short[256][256], Color Table: short[3][256].

If I'm interpreting what you wrote here correctly, this doesn't make sense.

It sounds like you have an array of 256x256 samples each of which is a
16-bit index.

Then you have a color table that is 3 arrays of 256 values, each of which
is a 16-bit value.  I'm assuming that the 3 arrays are the red, green, and
blue components of the corresponding color which is expressed as 0 == no
intensity and 0xffff == full intensity.

What doesn't make sense is why there are 16-bit samples, when there are
only 256 colors in the color table...?

If those assumptions are correct, then you need to create an IndexColorModel
out of the color table.  Since the ICM class only takes 8-bit values for
the red/green/blue components, you need to adjust the color table by
dividing each component by 256 (shift right by 8 bits) and storing them
in 3 byte arrays.  There is an IndexColorModel constructor that takes
3 byte arrays for the red, green, and blue components.

Then, to combine the two into an image, you will need to convert the samples
into a byte[256][256] array by casting to byte (assuming that only the
values 0 to 0xff are used in the image data.

Convert the byte image data array to a Raster and you can construct a
BufferedImage out of it using the appropriate constructor.  Or, for use
in pre-1.2 implementations, you can create a MemoryImageSource out of
the byte image data and the IndexColorModel and use the Toolkit method
createImage(ImageProducer) to turn that into an Image object.

Hope that helps...

                                ...jim

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to