Author: Cinly Ooi (---.psychiatry.cam.ac.uk)
Date: 05-02-08 09:54
My post was never intended to provide better contrast but simply to make sure that you capture the full-range of data correctly. As you had indicated, you read above the 8th bit. With standard C conversion from short->uchar, you will *lose* bit 9 onwards thus corrupting your data. My suggestion is a workaround trying to prevent the lost of data. It is designed to capture the full data range of your short data by scaling the 256 available data value in uchar to fit your data range.
In fact, I just realize that you should store two additional values, i.e. scl_slope and scl_inter on to your header if, as your other posting indicate, you might be interested in the header information as well. This is performed by reformulating the scaling arrangement as y=mx+c where x is your uchar data and y the original short data, then put m as scl_slope and c as scl_inter. In this way, you can recover your actual value if need be later.
IMHO, do not worry about your image having bad contrast when viewed. If you must, you can always manipulate the contrast setting/grey level setting of your viewing program to compensate. What is most important is your data is correct and accurate and is what you wanted.
HTH
|
|