A Photon Counting Pixel Detector For X-Ray Imaging