I have a problem with trying to normalize an image in Java.
My image is 16-bit, so it is stored in a short array.
By normalize I mean that I am trying to set the pixel with lowest intensity to Short.MIN_VALUE and the pixel with the highest intensity to Short.MAX_VALUE and all the other pixels in between somewhere in the middle.
I construct the buffered image like this...
bi = new BufferedImage(width, height, BufferedImage.TYPE_USHORT_GRAY);
Then after I do my normalization code on the short array, I set the buffered image to use the short array like this...
bi.getRaster().setDataElements(0, 0, width, height, shortbuf);
The problem is that BufferedImage is set to be TYPE_USHORT_GRAY. Java doesn't have unsigned shorts, and there is no type defining a grayscale image using signed shorts. So the maximum value I can store in my shorts is half of what I could store in an unsigned short, resulting in a crappy normalization.
Can anyone tell me another way to do this?