Login  Register

Re: How to apply auto window/level adjust to a new image from within a plugin?

Posted by Michael Schmid on Jun 26, 2007; 2:42pm
URL: http://imagej.273.s1.nabble.com/How-to-apply-auto-window-level-adjust-to-a-new-image-from-within-a-plugin-tp3699000p3699001.html

Hi Ron,

you can try
   new ContrastEnhancer().stretchHistogram(ip, 0.5);
where ip is the ImageProcessor and 0.5 is the percentage of
saturated pixels. Don't forget imp.updateAndDraw(); thereafter
(where imp is the ImagePlus that contains ip).

Michael
________________________________________________________________


On 26 Jun 2007, at 14:21, Ron Kneusel wrote:

> I am new to ImageJ and am writing a plugin that creates three new  
> images and displays them.  I want to automatically adjust the  
> window/level for each image just as if I had clicked the "Auto"  
> button in the Image/Adjust/Window/Level dialog box.
>
> I'm sure this is straightforward and that I'm just missing some  
> concepts or two, but my searching has not found the right way to do  
> it.
>
> Any help appreciated!
>
> Ron