Lower limit in logarithm fixed. The problem was that
for the logarithm cases, I would find the minimum positive
value, then I used that for all zero and smaller than zero
pixels. This caused problems for cases where there was only
one positive pixel in the image. So I subtracted 10% of
minpos from it so that is defined as the lowest value in
the logarithm.