Login  Register

Re: Log Math Function

Posted by Jacob Keller-2 on Apr 17, 2018; 9:11pm
URL: http://imagej.273.s1.nabble.com/Log-Math-Function-tp5020510p5020517.html

>
> The key point for the original question is that the final value is scaled,
> but has nothing to do with base.
>
> Just remember that to convert from base a to base b:
>     log_a(x) = log_b(x)/log_b(a).
>
> Apply this to the log quotient in the equation below and you'll see that
> the conversion factors in the
> numerator and denominator cancel, so the base is completely irrelevant.
>


It matters in my case since I want the actual values and not just relative
ones. The documentation says there is no scaling for 32-bit images, so
getting actual values should be doable now that I know "log" here means
base e.

Accordingly, my personal problem is solved, but perhaps it would be good,
as I suggested already, to switch "log" to "ln" in the pull-down menu, and
maybe even a warning window that the values will be scaled if not 32bit? Or
is that overkill?

JPK







>
> On 4/17/18, 4:52 PM, "Jacob Keller" <[hidden email]> wrote:
>
>     I copied and pasted the documentation as found at
>     https://imagej.nih.gov/ij/docs/menus/process.html#math, and it does
> not
>     specify natural log??? Is there another place for documentation? Again,
>     here it is:
>
>     Log...For 8-bit images, applies the function *f(p) = log(p) *
> 255/log(255)* to
>     each pixel (*p*) in the image or selection. For RGB images, this
> function
>     is applied to all three color channels. For 16-bit images, the image
> min
>     and max are used for scaling instead of 255. For float images, no
> scaling
>     is done. To calculate log10 of the image, multiply the result of this
>     operation by 0.4343 (1/log(10).
>
>
>     After a bit of searching, I found this page:
>     http://imagej.net/docs/guide/146-29.html#toc-Subsection-29.9 where it
> seems
>     to have been improved:
>
>
>     29.9.12 Log
>     For 8-bit images, applies the function *f*(*p*) = ln(*p*) × 255 ⁄
> ln(255) to
>     each pixel (*p*) in the image or selection. For RGB images, this
> function
>     is applied to all three color channels. For 16-bit images, the image
> min
>     and max are used for scaling instead of 255. For float images, no
> scaling
>     is done. To calculate log10 of the image, multiply the result of this
>     operation by 0.4343 (1 ⁄ ln(10)).
>
>
>     Anyway, perhaps, as you imply, the term "log" could be changed in
> future
>     process>math> menus to "ln?" It certainly would have helped avoid my
>     confusion. Who knows, there may be some scientific mistakes out there
> due
>     to this notation issue.
>
>     JPK
>
>
>
>
>     On Tue, Apr 17, 2018 at 4:16 PM, Gabriel Landini <[hidden email]
> >
>     wrote:
>
>     > On Tuesday, 17 April 2018 20:55:48 BST [hidden email] wrote:
>     > >  By deductive reasoning from the documentation, the answer is that
> "log"
>     > in
>     > > imagej means base 2.
>     >
>     > No, the documentation specifies "ln", i.e. in base e.
>     > And it works fine and the conversion recipe to log10 is correct too.
>     >
>     > Perhaps you are getting confused because the command is listed in
> the menu
>     > as
>     > "Log".
>     >
>     >
>     > Cheers
>     >
>     > Gabriel
>     >
>     > --
>     > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>     >
>
>     --
>     ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>
> ---
>
> The information in this email, including attachments, may be confidential
> and is intended solely for the addressee(s). If you believe you received
> this email by mistake, please notify the sender by return email as soon as
> possible.
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html