Login  Register

Re: setting min, max from histogram

Posted by Gluender-2 on Apr 16, 2009; 11:43am
URL: http://imagej.273.s1.nabble.com/Re-setting-min-max-from-histogram-tp3692900p3692909.html

>thankyou everyone for the help
>
>this is how i have it now
>
>run("Brightness/Contrast...");
>     getStatistics(pixels, mean, min, max, std, histogram);
>     print(""+pixels+""+mean+", "+min+", "+max+", "+std+"");
>     setMinAndMax(mean*0.6666,mean+0.3333*(255-mean));
>     waitForUser("Adjust Brightness/Contrast..., Press (OK)");
>     print(""+min+","+max+"");
>
>and even after this has been executed the min and max doesnt seem to chnage.
>below i have the log entries in the order of execution
>
>13579225155.1983, 29, 245, 9.5013
>29,245
>
>could someone tell me why the min and max are chaging ??
>
>thanks
>
>cheers
>
>--
>Donny George




It is always a good idea to read the ij-manuals:

Perhaps this ij-macro does what you want:

resetMinAndMax;
getStatistics(N, mean, min, max);
print(mean);
print(min, max);
setMinAndMax(mean*0.6666,mean+0.3333*(255-mean));
getMinAndMax(min, max);
print(min, max);

HTH
--

                   Herbie

          ------------------------
          <http://www.gluender.de>