Login  Register

Re: setting min, max from histogram

Posted by donny008 on Apr 17, 2009; 12:50pm
URL: http://imagej.273.s1.nabble.com/Re-setting-min-max-from-histogram-tp3692900p3692905.html

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

> 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
>>
>
> Boy, this won't work as expected!
> Why don't you keep with my working example?
>
> BTW you need not search all the example-macros but learn how to use the
> macro calls by studying the ij-macro manual at:
> <http://rsb.info.nih.gov/ij/developer/macro/functions.html>
>
> --
>
>                  Herbie
>
>         ------------------------
>         <http://www.gluender.de>
>


thankyou herbie

i executed both of them and both yeild the same results. so i guess both
works

and yours does the same thing in lesser number of lines and is less complex
so i would love to stick to ur codes.

thankyou again

have a nice evening
--
Donny George