Adding code to calculate fraction of good pixels. Set a boolean in the output stats indicating whether the result should be accepted.