Compact Photon Counting X-ray Detector