Login  Register

ShortPorcessor convert to ByteProcessor

Posted by Daan Zhu on Dec 03, 2007; 5:21pm
URL: http://imagej.273.s1.nabble.com/ShortPorcessor-convert-to-ByteProcessor-tp3697863.html

Dear ImageJ users,
I am sorry for the confusion of my question. I need to use C++ to rewrite
ShortProcessor to ByteProcessor converter.
This function is perfect in imageJ. Only three lines.

ImageProcessor ip = imp.getProcessor; //ip is ShortProcessor, imp is ImagePlus
java.awt.Image img = ip.createImage();
return new ByteProcessor(img);

I am very surprise the output contrast is very closed to the original
contrast in 12-bit. Could you please any people know
how the above code works? Especially how to chop 2 bytes to 1 byte?

My image data is DICOM image in signed 12-bit, the range is from -2048 to
+2048.

Thank you for your time.

Regards,

Daan