http://imagej.273.s1.nabble.com/Use-of-LUTS-give-different-results-tp5010726p5010758.html
if you have 16-bit data and a LUT, it depends on the min & max of the display range of the pixels how it appears on the screen. By default, the display range is the full 16-bit range, 0-65535
> Thanks to Wayne and Jerome I have a working (up to a point) section of Java
> code that creates an 16 bit gray scale imagePlus from my raw infrared
> camera data and saves it as a PNG. This image displays correctly in Fiji.
>
> I next load a custom LUT, 256 byte each for RBB, and save that as a PNG.
>
> If I load the gray scale PNG into Fiji and apply the custom LUT it displays
> as I expect (the low values are in tans and the high in red to orange to
> yellow to white).
>
> The other PNG, with the LUT applied in code, is mostly all red.
>
> For technical reasons the raw data start with DN values around 15,000+.
> The target is a black body that I can heat to a precise temperature (I
> don't go above 1,250 C in tests). DN values at the high end are about
> 22,000+ with a range less than 2^14.
>
> Why do the gray scale PNG with the LUT applied post processing and the PNG
> with the LUT applied in code differ and what can I do about it? Is it a
> max/min or a stretch problem?
>
> I can attach examples if that's allowed by the Interest Group rules. My
> Java code is below:
>
> Nate
>
> ImagePlus imp = IJ.createImage("Untitled", imageWidth, imageHeight, 1
> ,imageBitsPerPix ); // 16
> ShortProcessor ip = (ShortProcessor) imp.getProcessor();
> short[] data = (short[]) ip.getPixels();
> imageByteBuffer.position(0);
> int index = 0;
> while(imageByteBuffer.hasRemaining())
> data[index++] = imageByteBuffer.getShort();
> IJ.saveAs(imp, "PNG", imageFullPathName); // looks OK
>
> ip.setLut(Shared.getLUT());
> imp.setProcessor("LUT", ip);
> IJ.saveAs(imp, "PNG", imageDisplayFolderPath);
>
>
> --
> When I was 12 I thought I would live forever.
> So far, so good.
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html