loading 16 bit images from other java code, ImageJ 1.28

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

loading 16 bit images from other java code, ImageJ 1.28

Zummy
ImageJ list:

I'm trying to load 16 bit grayscale images from other java code, and
they are coming out in RGB (8bit-8bit-8bit):

ImageJ imagej = new ImageJ(applet);
imagej.setVisible(true);
BufferedImage bi = new BufferedImage(imageWidth, imageHeight,
BufferedImage.TYPE_USHORT_GRAY);
bi.getRaster().setDataElements(0,0,imageWidth, imageHeight,shortDataBuffer);
new ij.ImagePlus("Filename", bi).show();

This is with ImageJ 1.28 (I think) on a Windows XP SP2 machine.  This is a
reconstruction
of code found in many places, I haven't actually tested this code yet.

Please let me know if I am doing something wrong, or it's fixed in a more
recent release.

We really want the 16bit value displayed under the toolbar, if we can't
have full 16bit grayscale.

John