Login  Register

Re: setting min, max from histogram

Posted by donny008 on Apr 16, 2009; 2:28pm
URL: http://imagej.273.s1.nabble.com/Re-setting-min-max-from-histogram-tp3692900p3692904.html

On Thu, Apr 16, 2009 at 1:43 PM, Gluender <[hidden email]> wrote:

> 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>
>



thankyou herbie for guiding

since there were so many macros for ij, i didnt know where to begin with but
the guidance from this list definitely helped me out. thankyou to you too

this is how i have it up and running
getStatistics(pixels, mean, min, max, std, histogram);
    print("Initial-  Mean "+mean+", Min "+min+", Max"+max+", STD"+std+"");
    //getMinAndMax(min, max);
    run("Brightness/Contrast...");
    setMinAndMax(mean*0.6666,mean+0.3333*(255-mean));
    //getMinAndMax(min, max);
    waitForUser("Adjust Brightness/Contrast..., Press (OK)");
    print("Modified Min"+min+", Max"+max+"");


have a nice day
--

Donny George