Added thresholding for 32-bit grayscale images.
Reformatted source.