updated threshold to use maxVal of image being thresholded and finished minus