Fixed an issue when thresholding sequences with empty images