[ImageJ-bugs] [Bug 1169] Process-Math-Macro...

bugzilla at fiji.sc bugzilla at fiji.sc
Fri Oct 2 09:16:42 CDT 2015


http://fiji.sc/bugzilla/show_bug.cgi?id=1169

Curtis Rueden <ctrueden at wisc.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |CONFIRMED
                 CC|                            |ctrueden at wisc.edu

--- Comment #1 from Curtis Rueden <ctrueden at wisc.edu> ---
What happens is: the Process > Math > Macro... command iterates over every
pixel, replacing each value in-place as it goes. By referencing previously
processed pixels via getPixel(x-1, y-1) you are subtracting your new pixel
values instead of your original ones.

Interesting that it works in 8-bit, but not 16-bit. Looking at the source, this
is because there is special case logic for 8-bit and RGB images [1] which
copies the pixel buffer before executing in the case where the getPixel
function is used [2, 3]. However, no such thing is done for 16-bit [4].

As a workaround, you can instead write:

  v=getPixel(x+1, y+1)-getPixel(x, y);

Which avoids the issue.

I agree that this is a bug, in that the behavior between 8-bit and 16-bit is
inconsistent.

[1]
https://github.com/imagej/ImageJA/blob/v1.50b/src/main/java/ij/plugin/filter/ImageMath.java#L254-L335
[2]
https://github.com/imagej/ImageJA/blob/v1.50b/src/main/java/ij/plugin/filter/ImageMath.java#L277
[3]
https://github.com/imagej/ImageJA/blob/v1.50b/src/main/java/ij/plugin/filter/ImageMath.java#L319
[4]
https://github.com/imagej/ImageJA/blob/v1.50b/src/main/java/ij/plugin/filter/ImageMath.java#L321-L334

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-bugs/attachments/20151002/728d3dc6/attachment.html>


More information about the Imagej-bugs mailing list