Hello...
I've got and array of shorts, each element of the array containing an
intensity value of a pixel in a gray
scale... but I'm not able to create a BufferedImage with this. (I get
this array from a DICOM image file)
I've tried something like this, but I only get an "all-black" rectangle
when I try to display the image:
int width = 512; int height = 512; // image size
short bufferPixels[] -> I have the image info here. A simple array of
shorts, size 262144 (512*512), each element containing info for just
one pixel. (1 sample per pixel)
BandedSampleModel sm = new BandedSampleModel(DataBuffer.TYPE_USHORT,
width, height, 1);
DataBufferUShort db = new DataBufferUShort(bufferPixels, numeroWords);
Raster raster = Raster.createRaster(sm, db, null);
BufferedImage image = new BufferedImage(width, height,
BufferedImage.TYPE_USHORT_GRAY );
image.setData(raster);
... when I try to display "image", I get all black.
Any help would be sincerely appreciated!!
Kind regards,
Iban
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/