Photon Counting Flat Panel Detector For X-Rays