There is provided an x-ray imaging system (100) comprising an x-ray source (10), and an associated x-ray detector (20), wherein the x-ray detector (20) is a photon counting x-ray detector for enabling detection of photon-counting events. The x-ray imaging system (100) is configured for enabling acquisition of at least one phase contrast image based on detected photon-counting events. The x-ray detector (20) is based on a number of x-ray detector sub-modules, also referred to as wafers, each of which comprises detector elements, wherein the x-ray detector sub-modules are oriented in edge-on geometry with their edge directed towards the x-ray source, assuming the x- rays enter through the edge. Each x-ray detector sub-module or wafer has a thickness with two opposite sides of different potentials to enable charge drift towards the side, where the detector elements, also referred to as pixels, are arranged. The x-ray imaging system (100) is further configured to determine an estimate or measure of charge diffusion originating from a Compton interaction or an interaction through photoeffect related to an incident x-ray photon in an x-ray detector sub-module or wafer of the x-ray detector, and to determine an estimate of a point of interaction of the incident x-ray photon in the x-ray detector sub-module based on the determined estimate or measure of charge diffusion.L'invention concerne un système d'imagerie par rayons X (100) comprenant une source de rayons X (10), et un détecteur de rayons X associé (20), le détecteur de rayons X (20) constituant un détecteur de rayons X à comptage de photons permettant la détection d'événements de comptage de photons. Le système d'imagerie par rayons X (100) est configuré pour permettre l'acquisition d'au moins une image de contraste de phase en fonction d'événements de comptage de photons détectés. Le détecteur de rayons X (20) est fondé sur un certain nombre de sous-modules de détecteur de rayons X, également appelés tranches, chac