Make sure calculated thresholds fit into image data type

The variables storing thresholds 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>
Merge pull request #1 from tomka/prevent-threshold-overflow

Prevent potential overflow of channel specific thesholds

Note: this is a quick bug fix, but it introduces technical debt: the range check is repeated, violating the DRY principle (i.e. bloating the code and making bug fixes prone to cover only *part* of the copy-edited versions). However, subsequent pull requests can fix this.