Type conversion

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

Type conversion

karo03
Hi,
does anybody know how the 16-bit to 8-bit type conversion is exactly  
done in ImageJ?

Thanks
Karsten
Reply | Threaded
Open this post in threaded view
|

Re: Type conversion

Michael Schmid
Hi Karsten,

have a look at the Browseable Sourcecode under Developer Resources,
http://rsb.info.nih.gov/ij/developer/source/index.html
In TypeConverter
http://rsb.info.nih.gov/ij/developer/source/ij/process/ 
TypeConverter.java.html
you will find convertShortToByte().

Without scaling (Edit/Options/Conversions Scale when converting):

   16-bit values between 0 and 255 are unchanged, larger values  
become 255.

With scaling:

   Gray values as on the screen (i.e., those set by Image/Adjust/
Brightness&Contrast) are used.

Michael
________________________________________________________________

On 5 Mar 2007, at 18:02, Karsten Rodenacker wrote:

> Hi,
> does anybody know how the 16-bit to 8-bit type conversion is  
> exactly done in ImageJ?
>
> Thanks
> Karsten
Reply | Threaded
Open this post in threaded view
|

Re: Type conversion

karo03
Thank you for the quick answer, I could not read it out from the  
mentioned routine (no Java capabilites):
     /** Converts a ShortProcessor to a ByteProcessor. */
     ByteProcessor convertShortToByte() {
         if (doScaling) {
             Image img = ip.createImage();
             return new ByteProcessor(img);
         } else {

Karsten

Am 05.03.2007 um 18:17 schrieb Michael Schmid:

> Hi Karsten,
>
> have a look at the Browseable Sourcecode under Developer Resources,
> http://rsb.info.nih.gov/ij/developer/source/index.html
> In TypeConverter
> http://rsb.info.nih.gov/ij/developer/source/ij/process/ 
> TypeConverter.java.html
> you will find convertShortToByte().
>
> Without scaling (Edit/Options/Conversions Scale when converting):
>
>   16-bit values between 0 and 255 are unchanged, larger values  
> become 255.
>
> With scaling:
>
>   Gray values as on the screen (i.e., those set by Image/Adjust/
> Brightness&Contrast) are used.
>
> Michael
> ________________________________________________________________
>
> On 5 Mar 2007, at 18:02, Karsten Rodenacker wrote:
>
>> Hi,
>> does anybody know how the 16-bit to 8-bit type conversion is  
>> exactly done in ImageJ?
>>
>> Thanks
>> Karsten