On May 24, 2014, at 12:27 PM, Christophe Leterrier wrote:
> Hi,
>
> From my understanding of the ImageJ manual, when using "Enhance Contrast"
> on a 16-bit stack with the "normalize" and "use histogram" options checked,
> it should adjust and scale all slices to the % saturation based on the
> whole stack histogram, not the currently active slice. Is that right?
That is correct.
> It is
> not what happens though, the output depends on the current active slice.
>
> Consider the following macro code:
> run("Bat Cochlea Renderings (449K)");
> run("16-bit");
> run("Add Slice");
> run("Enhance Contrast...", "saturated=0.1 normalize process_all use");
>
> As the adjustment is made starting from an all-black slice, everything on
> the other slices get saturated.
Enhance Contrast sets the display range to 0-0 because the current slice has a pixel value range of 0-0. This causes the other slices to be saturated. Add
setMinAndMax(0,65535);
to the end of the macro and the other slices will not be saturated.
> By contrast, the same code but shifting the current slice to an non-empty
> slice before calling "Enhance contrast" results in a different output:
>
> run("Bat Cochlea Renderings (449K)");
> run("16-bit");
> run("Add Slice");
> setSlice(1);
> run("Enhance Contrast...", "saturated=0.1 normalize process_all use");
The two macro generate the same output but they display it differently.
> Is this the intended behavior or a bug? If it is, how can I adjust the
> contrast of a whole stack to a given % saturation relative to the whole
> stack histogram, and keeping the intensity relation between slices(like
> when adjusting the contrast of confocal Z-stacks)?
It the latest daily build (1.49b10), Enhance Contrast sets the display range of 16-bit images to 0-65536 when "Normalize" is checked.
-wayne
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html