Elements of Detection Theory