Scaling 16 bit images

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Scaling 16 bit images

simon andrews (BI)
I'm writing a plugin which creates a derived RGB image from a 16 bit  
greyscale image input.  However I'm having trouble getting the scaling  
of the image intensity the same as is shown when ImageJ initially  
renders the 16 bit image.

It seems that for display purposes ImageJ alters the brightness  
scaling of 16 bit images.  I see pixel values of ~200 which are  
clearly visible, but if I scale these down to the equivalent 8-bit  
values then they would be so close to zero as to be effectively black.

How can I convert the values returned by getIntensity() to something  
from which I can infer the actual brightness shown on screen when the  
16 bit image is displayed?

Thanks for any help

Simon.
Reply | Threaded
Open this post in threaded view
|

Re: Scaling 16 bit images

Michael Schmid
Hi Simon,

in ImageJ the minimum and maximum displayed brightness do not  
necessarily correspond to the minimum and maximum value that you can  
have with a given data type (0-255 for 8 bit, 0-65535 for 16 bit).  
You can modify the values that are mapped onto white and black by  
ImageProcessor.setMinAndMax (in a plugin) or simply by  
Image>Adjust>Brightness and Contrast (interactively).
You can get the min&max values by ImageProcessor.getMin(),  
ImageProcessor.getMax().

In Edit>Options>Conversions there is a checkbox for whether  
conversion of the image data from 16 bit to 8 bit uses the displayed  
grayscale range or all of 0-65535 for the final 0-255. If you do this  
in a plugin there is a boolean in the type conversion that does the  
same.

Michael
________________________________________________________________

On 2 Feb 2010, at 09:53, Simon Andrews wrote:

> I'm writing a plugin which creates a derived RGB image from a 16  
> bit greyscale image input.  However I'm having trouble getting the  
> scaling of the image intensity the same as is shown when ImageJ  
> initially renders the 16 bit image.
>
> It seems that for display purposes ImageJ alters the brightness  
> scaling of 16 bit images.  I see pixel values of ~200 which are  
> clearly visible, but if I scale these down to the equivalent 8-bit  
> values then they would be so close to zero as to be effectively black.
>
> How can I convert the values returned by getIntensity() to  
> something from which I can infer the actual brightness shown on  
> screen when the 16 bit image is displayed?
>
> Thanks for any help
>
> Simon.