How is Display Range selected for 16Bit Images?

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

How is Display Range selected for 16Bit Images?

James Cheong
Hi Everyone

I've got a burning question about the display range of ImageJ and it would
be great if someone can point me in the right direction.

I've been going through the source code but I still can't figure out how
ImageJ selects min and max to display a 16 bit image in.

I've ran ImageJ in debug mode and opened a 16bit image, but I can't find the
line of code that decides how the display min and max are selected.
Gone through the Opener, TiffDecoder, and FileOpener class but without any
success.

I understand from the ContrastAdjuster code that there is a defaultMin and
defaultMax variable, which are the absolute min and max pixel values of the
image, but not usually the values used for displaying. Instead, the values
of min2 and max2 are used when you first open the image. So my question
is... how is it that
ip.getMin();
ip.getMax();
returns different values before and after ip.resetMinAndMax()?

It surely means that some "tempering" was done to the Min and Max somewhere
in the code when an image is opened...

Would be absolutely great if someone can help me out!

Thanks!
: )

James
Reply | Threaded
Open this post in threaded view
|

Re: How is Display Range selected for 16Bit Images?

Greg Joss
James,
ShortProcessor.findMinAndMax() determines the min and max pixel values
 for ip.resetMinAndMax and ip.getMin(); ip.getMax();.
ContrastAdjuster will lop off progressively greater percentages of
outliers
each time you click Auto
but I suspect that your query arises because 16-bit tif images can be
saved
with user selected min/max display values in the tif header which are
used
on opening rather than ip.getMin(); ip.getMax();

If you experiment with the sample images obtained by run'ing the
macros
run("M51 Galaxy (177K, 16-bits)");
run("CT (420K, signed 16-bits)");

and use the following macro commands by selecting and run'ing you can
perform a variety of tests

run("Misc...", "divide=Infinity debug");

run("Misc...", "divide=Infinity");

getMinAndMax(min,max);
print(min,max);
run("Show Info...");

resetMinAndMax();

run("Enhance Contrast", "saturated=0.5");

The results will show that M51 is uncalibrated and IJ will use the
display range
ip.getMin()=0,  ip.getMax()=10106 on opening.
If you use run("Enhance Contrast", "saturated=0.5");
it will set to 157 1815
and will Save/re'Open displayed at 157<>1815

"CT" is calibrated as can be seen from log of debug and from ShowInfo
FileOpener: name=CT.tif, dir=, url=, width=888, height=495, nImages=1,
type=ushort, offset=768, whiteZero=f, Intel=f, lutSize=0, compression=1
Image Description: ImageJ=1.37k unit=mm cf=0 c0=-32768.0 c1=1.0
vunit=gray value min=32568.0 max=33068.0
which comes from file header (as it was saved) and will display -200<>
300
whereas reset via B&C adjuster will set -719 <> 1402

Greg


--
Greg Joss,
Department of Biological Sciences, Phone: (61)(2) 9850 8212 Fax: 9850
8245
Macquarie University,              Email: [hidden email]
North Ryde, (Sydney,) NSW 2109, Australia


>>> [hidden email] 08/04/06 4:23 pm >>>
Hi Everyone

I've got a burning question about the display range of ImageJ and it
would
be great if someone can point me in the right direction.

I've been going through the source code but I still can't figure out
how
ImageJ selects min and max to display a 16 bit image in.

I've ran ImageJ in debug mode and opened a 16bit image, but I can't
find the
line of code that decides how the display min and max are selected.
Gone through the Opener, TiffDecoder, and FileOpener class but without
any
success.

I understand from the ContrastAdjuster code that there is a defaultMin
and
defaultMax variable, which are the absolute min and max pixel values of
the
image, but not usually the values used for displaying. Instead, the
values
of min2 and max2 are used when you first open the image. So my
question
is... how is it that
ip.getMin();
ip.getMax();
returns different values before and after ip.resetMinAndMax()?

It surely means that some "tempering" was done to the Min and Max
somewhere
in the code when an image is opened...

Would be absolutely great if someone can help me out!

Thanks!
: )

James