Login  Register

Re: setting min, max from histogram

Posted by Karel Jansseune-2 on Apr 16, 2009; 9:48am
URL: http://imagej.273.s1.nabble.com/Re-setting-min-max-from-histogram-tp3692900.html

On Thu, 16 Apr 2009 11:40:00 +0200, Donny George <[hidden email]>
wrote:

>On Thu, Apr 16, 2009 at 11:27 AM, Gluender <[hidden email]> wrote:
>
>> hello
>>>
>>> i would like to set the min and max values for brightness of an image
by
>>> making some calculations from the values like mean and standard
deviation

>>> obtained from the histogram of the image. i wrote the macro in this way
>>>
>>> run("Brightness/Contrast...");
>>>    getStatistics(mean, min, max, std, histogram);
>>>
>>>    setMinAndMax(mean*0.6666,201);
>>>
>>> and this not work. could somehow help me to successfully modify this.
>>>
>>> thank you one and all for the help in advance
>>>
>>> regards
>>>
>>> --
>>> Donny George
>>>
>>
>>
>> I've replied to your question immediately after your first post to the
>> list.
>>
>> ------------------------
>>
>> Here is my reply again:
>>
>> The macro functions manual says:
>> getStatistics(area, mean, min, max, std, histogram)
>>
>> so
>>
>> getStatistics(area, mean);
>> print(mean);
>>
>> should do the trick.
>>
>> HTH
>> --
>>
>>                  Herbie
>>
>>         ------------------------
>>         <http://www.gluender.de>
>>
>
>
>thankyou and sorry i didnt see ur post earlier
>
>i modified it and i could print the values correctly but i am not able to
>make a calculation with it so that i can modify the brightness
>
>run("Brightness/Contrast...");
>    getStatistics(mean, min, max, std, histogram);
>    print(""+mean+", "+min+", "+max+", "+std+"");
>    setMinAndMax("+mean+"*0.6666,201);
>
>could you help me with the syntax for the mulplication
>
>thnkyou again
>
>Donny George
>=========================================================================

Dear Donny,

changing you code to

setMinAndMax("+getStatistics[mean]+"*0.6666,201);

should do the trick


Regards,

Karel