Hi Zhengyu,
if you have 32-bit (float) images, negative values are no problem.
For all other data types, ImageJ does clipping to 0 for any values that would be negative as a result of any operation, such as subtraction. In other words, these values are set to 0.
If the result would be higher than the maximum value, which is 255 for 8-bit and the color channels of RGB images (65535 in 16-bit images), ImageJ does clipping to that maximum value.
http://en.wikipedia.org/wiki/Clipping_%28signal_processing%29The built-in "Subtract Background" command is a special case: it adds a slight offset to the result to avoid negative values that would result from subtracting a background from noisy data. Thus, it does not set the background to exactly 0 (or exactly the maximum value).
Michael
________________________________________________________________
On Nov 6, 2012, at 18:07, Pang, Zhengyu (GE Global Research) wrote:
> Dear colleagues,
>
> I have a question "How imageJ handles with negative value during image subtraction?" In reality when we perform image subtraction, we could have some negative value.
>
> Could anyone points me to the original code for this?
>
> As a biologist, I prefer to set those negative values to zero or one.
>
> Thanks,
>
> Zhengyu
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html