Statistics for Design and Optimization of a Stacked Three-Layer X-ray Detector for Multi-Spectral Medical Imaging Applications