Posted by
Michael Ellis on
URL: http://imagej.273.s1.nabble.com/Brightness-contrast-selection-in-grayscale-images-tp3689259p3689262.html
Joachim Wesner,
Ah I only tried 8-bit grey scale! Any other higher bit depth greyscale
gives the message below when you click on the "Apply" button
"apply requires and 8-bit greyscale image or RGB stack"
I stand corrected!
FWIW though, 16 or 32 bit source data can be rendered efficiently with
"small" LUTs too. Naturally you don't want to have giant LUTs with
2^32 entries, but you acceptably optimise this where the output domain
is 8 bit . I tackled this problem in the past by calculating from the
data min and max a suitable bitwise sift that would scale the source
data into a 9 bit quantity. These 9 bits are then used to index a 9
bit LUT. This method is a good compromise and a fast brightness and
contrast on 16 or 32 bit data can be achieved with a lookup like so:
LUT[sample >> mNormRangeBitShift]
Much cheaper than the full brightness and contrast arithmetic that you
would otherwise use.
The extra ninth bit is there to avoid loss of resolution that you
would get by using the fast bit shift in place of the slow necessary
scale and translate that you would require for mapping with maximum
resolution to 8 bits (defeating much of the advantage of using a LUT
at all)
To the OP, what you attempting to achieve that prevents you converting
the data to 8 bit? The Process->Math-> operations work on the ROI. Any
use?
Michael Ellis
On 21 Feb 2010, at 22:49, Joachim Wesner wrote:
> Hi Michael,
>
>> With a greyscale image, the brightness/contrast adjustment provides
>> the live feedback by adjusting the LUT associated the image. The LUT
>> applies to the whole image and not just the ROI. However, you need
>> only press the "Apply" button on the "Brightness & Contrast" palette
>> for the changes to be applied to the ROI (changing the pixel values
>> within the ROI). The LUT then gets reset and the pixels outside the
>> ROI are thus unaltered.
>
> Did you actually try this? This does only work for 8-bit grayscale
> data,
> not for the probably more
> interesting 16 and 32 bit cases. As fas as I can see, this is
> because in
> the former case the
> effect of the modified LUT (which itself is based on only 8 bits)
> can be
> exactly duplicated by
> rewriting the data within the ROI, having to stick with any "rounding
> errors" caused by it.
> However, for 16 and higher bit cases it probably should be possible to
> duplicate the effect
> by a more complicated calculation without loosing too much of the
> extra
> resolution... Hmmmm!
>
> Mit freundlichen Grüßen / Best regards
>
> Joachim Wesner
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit
http://www.messagelabs.com/email> ______________________________________________________________________
Michael Ellis
Managing Director
Digital Scientific UK Ltd.
http://www.digitalscientific.co.uk[hidden email]
tel: +44(0)1223 329993
fax: +44(0)1223 370040
Sheraton House
Castle Park
Cambridge
CB3 0AX
The contents of this e-mail may be privileged and are confidential.
It may not be disclosed to or used by anyone other than the
addressee(s), nor copied in any way. If received in error, please
advise the sender and delete it from your system.