Make sure calculated thresholds fit into image data type

The variables storing stresholds for channel one and two are of the same
data type as the image data. It is very well possible, that the auto
threshold regression will calculate thresholds that don't fit into the
data types of the images to colocalize. This is for instance the case
for negative thresholds and a standard eight bit data type. This commit
makes sure the thresholds used for comparison with the actual image data,
are within bounds. Before, too low or to big values could overflow the
threshold variable and lead to wrong threshold values.

Signed-off-by: Tom Kazimiers <tom@voodoo-arts.net>