8 / 16 / 32 bit images

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

8 / 16 / 32 bit images

Alfred Wagner
Hello ImageJ Users,

I'm trying to understand the behavior of 8, 16, and 32 bit images.

I create 3 new images; an 8 bit, a 16 bit, and a 32 bit - all with black
background.
Then draw a region of interest in each image, and invert the ROI.
The ROI in the 8 bit image has a value of 255,  nothing happens to the ROI
in the 16 bit image (i.e. stays at 0), and the ROI in the 32 bit image has
a value of 1.0

Is there a bug or am I missing something.  I'm running Ver 1.46k

Thanks, al.

Al Wagner
IBM Watson Research Center
PO Box 218
Yorktown Heights, NY  10598
Phone:  914-945-1962
Fax:       914-945-2141
Email:   [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: 8 / 16 / 32 bit images

pang
8-bit image (2^8) has a grayscale value from 0-255 (2^8-1)
16-bit image(2^16) has a grayscale value from 0-63353 (2^16-1). I think
there is unsigned 16 bit and signed 16 bit that allows negative values.
32-bit images use a real number using a scale from -1 to 1.

I don't think that there is a standard for converting between those
images, especially on dealing negative values (which can be the case
during image subtraction)
 In your case, apparently when converting from 8-bit to 16 bit, the
grayscale value is kept same.

Zhengyu Pang, Ph.D.
Biochemistry and Bioanalytics Laboratory
Diagnostic and Biomedical Technologies
GE Global Research, K1-5B37A
One Research Circle
Niskayuna, NY 12309
T: 518-387-4015
F: 518-387-7765



-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
Alfred Wagner
Sent: Friday, April 20, 2012 9:50 AM
To: [hidden email]
Subject: 8 / 16 / 32 bit images

Hello ImageJ Users,

I'm trying to understand the behavior of 8, 16, and 32 bit images.

I create 3 new images; an 8 bit, a 16 bit, and a 32 bit - all with black
background.
Then draw a region of interest in each image, and invert the ROI.
The ROI in the 8 bit image has a value of 255,  nothing happens to the
ROI in the 16 bit image (i.e. stays at 0), and the ROI in the 32 bit
image has a value of 1.0

Is there a bug or am I missing something.  I'm running Ver 1.46k

Thanks, al.

Al Wagner
IBM Watson Research Center
PO Box 218
Yorktown Heights, NY  10598
Phone:  914-945-1962
Fax:       914-945-2141
Email:   [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: 8 / 16 / 32 bit images

Cammer, Michael
In reply to this post by Alfred Wagner
It appears that 16 bit images cannot be inverted until there is a pixel range to base the min & max for the inversion.  When all pixels are zero, there is no range.  


________________________________________________________
Michael Cammer, Assistant Research Scientist
Skirball Institute of Biomolecular Medicine
Lab: (212) 263-3208  Cell: (914) 309-3270

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Alfred Wagner
Sent: Friday, April 20, 2012 9:50 AM
To: [hidden email]
Subject: 8 / 16 / 32 bit images

Hello ImageJ Users,

I'm trying to understand the behavior of 8, 16, and 32 bit images.

I create 3 new images; an 8 bit, a 16 bit, and a 32 bit - all with black background.
Then draw a region of interest in each image, and invert the ROI.
The ROI in the 8 bit image has a value of 255,  nothing happens to the ROI in the 16 bit image (i.e. stays at 0), and the ROI in the 32 bit image has a value of 1.0

Is there a bug or am I missing something.  I'm running Ver 1.46k

Thanks, al.

Al Wagner
IBM Watson Research Center
PO Box 218
Yorktown Heights, NY  10598
Phone:  914-945-1962
Fax:       914-945-2141
Email:   [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: 8 / 16 / 32 bit images

ctrueden
In reply to this post by Alfred Wagner
Hi Al,


> I create 3 new images; an 8 bit, a 16 bit, and a 32 bit - all with black
> background.
> Then draw a region of interest in each image, and invert the ROI.
> The ROI in the 8 bit image has a value of 255,  nothing happens to the ROI
> in the 16 bit image (i.e. stays at 0), and the ROI in the 32 bit image has
> a value of 1.0
>

For 16-bit and 32-bit data, the Invert command will use the actual minimum
and maximum data values (rather than the full range of the pixel type) when
inverting.

For 8-bit and RGB, invert always uses min=0 and max=255, regardless of the
data values.

There seems to be a special case for 32-bit only when min=max=0, where it
uses max=1.0 instead, presumably since normalized floating point data over
[0.0, 1.0] is so common.

Relevant source code is at:

https://github.com/fiji/ImageJA/blob/20013d47/src/main/java/ij/process/FloatProcessor.java#L419
https://github.com/fiji/ImageJA/blob/20013d47/src/main/java/ij/process/ShortProcessor.java#L451
https://github.com/fiji/ImageJA/blob/20013d47/src/main/java/ij/process/ImageProcessor.java#L874


> Is there a bug or am I missing something.  I'm running Ver 1.46k
>

I am guessing all these behaviors are by design.

Regards,
Curtis


On Fri, Apr 20, 2012 at 8:49 AM, Alfred Wagner <[hidden email]> wrote:

> Hello ImageJ Users,
>
> I'm trying to understand the behavior of 8, 16, and 32 bit images.
>
> I create 3 new images; an 8 bit, a 16 bit, and a 32 bit - all with black
> background.
> Then draw a region of interest in each image, and invert the ROI.
> The ROI in the 8 bit image has a value of 255,  nothing happens to the ROI
> in the 16 bit image (i.e. stays at 0), and the ROI in the 32 bit image has
> a value of 1.0
>
> Is there a bug or am I missing something.  I'm running Ver 1.46k
>
> Thanks, al.
>
> Al Wagner
> IBM Watson Research Center
> PO Box 218
> Yorktown Heights, NY  10598
> Phone:  914-945-1962
> Fax:       914-945-2141
> Email:   [hidden email]
>
Reply | Threaded
Open this post in threaded view
|

Re: 8 / 16 / 32 bit images

Robert Baer
Alfred's question Curtis's answer to this question would make a nice
addition to the FAQ especially with ImageJ2's new set of image depth
choices.  Any additional help on the thinking behind design choices is
likely to be eye-opening to those of us still getting used to the world of
large bit-depth images.

Thanks for the question and response guys.

Rob

-----Original Message-----
From: Curtis Rueden
Sent: Friday, April 20, 2012 9:36 AM
To: [hidden email]
Subject: Re: 8 / 16 / 32 bit images

Hi Al,


> I create 3 new images; an 8 bit, a 16 bit, and a 32 bit - all with black
> background.
> Then draw a region of interest in each image, and invert the ROI.
> The ROI in the 8 bit image has a value of 255,  nothing happens to the ROI
> in the 16 bit image (i.e. stays at 0), and the ROI in the 32 bit image has
> a value of 1.0
>

For 16-bit and 32-bit data, the Invert command will use the actual minimum
and maximum data values (rather than the full range of the pixel type) when
inverting.

For 8-bit and RGB, invert always uses min=0 and max=255, regardless of the
data values.

There seems to be a special case for 32-bit only when min=max=0, where it
uses max=1.0 instead, presumably since normalized floating point data over
[0.0, 1.0] is so common.

Relevant source code is at:

https://github.com/fiji/ImageJA/blob/20013d47/src/main/java/ij/process/FloatProcessor.java#L419
https://github.com/fiji/ImageJA/blob/20013d47/src/main/java/ij/process/ShortProcessor.java#L451
https://github.com/fiji/ImageJA/blob/20013d47/src/main/java/ij/process/ImageProcessor.java#L874


> Is there a bug or am I missing something.  I'm running Ver 1.46k
>

I am guessing all these behaviors are by design.

Regards,
Curtis


On Fri, Apr 20, 2012 at 8:49 AM, Alfred Wagner <[hidden email]> wrote:

> Hello ImageJ Users,
>
> I'm trying to understand the behavior of 8, 16, and 32 bit images.
>
> I create 3 new images; an 8 bit, a 16 bit, and a 32 bit - all with black
> background.
> Then draw a region of interest in each image, and invert the ROI.
> The ROI in the 8 bit image has a value of 255,  nothing happens to the ROI
> in the 16 bit image (i.e. stays at 0), and the ROI in the 32 bit image has
> a value of 1.0
>
> Is there a bug or am I missing something.  I'm running Ver 1.46k
>
> Thanks, al.
>
> Al Wagner
> IBM Watson Research Center
> PO Box 218
> Yorktown Heights, NY  10598
> Phone:  914-945-1962
> Fax:       914-945-2141
> Email:   [hidden email]
>