An X-ray imaging system for differential phase contrast imaging, comprising - a differential phase contrast setup with: an X-ray source; an X-ray detector; and a grating arrangement comprising a source grating, a phase grating and an analyser grating, wherein the source grating is arranged between the X-ray source and the phase grating, and the analyser grating is arranged between the phase grating and the detector; - a processing unit; and - a measurement system for determining a misalignment of at least one of the gratings; wherein the X-ray source and the source grating are provided as a rigid X-ray source unit; and wherein the phase grating, the analyser grating and the detector are provided as a rigid X-ray detection unit; and wherein the measurement system is an optical measurement system configured to determine a misalignment of the differential phase contrast setup between the X-ray source unit and the X-ray detection unit; wherein the processing unit is configured to provide a correction signal based on the determined misalignment; wherein the measurement system comprises at least three sensors at different corners of the X-ray detection unit; characterised in that the at least three sensors are provided as at least three 4-quadrant photodiodes; wherein an optical source device is fixedly attached to the X-ray source unit configured to generate a light beam to each of the 4-quadrant photodiodes; and wherein the 4-quadrant photodiodes measure the movement in the plane of the detector and an angular tilt with respect to the light beam. - a differential phase contrast setup with: an X-ray source; an X-ray detector; and a grating arrangement comprising a source grating, a phase grating and an analyser grating, wherein the source grating is arranged between the X-ray source and the phase grating, and the analyser grating is arranged between the phase grating and the detector; an X-ray source; an X-ray detector; and a grating arrangement comprising a source grating, a phase grating and an analyser grating, wherein the source grating is arranged between the X-ray source and the phase grating, and the analyser grating is arranged between the phase grating and the detector; - a processing unit; and - a measurement system for determining a misalignment of at least one of the gratings; wherein the X-ray source and the source grating are provided as a rigid X-ray source unit; and wherein the phase grating, the analyser grating and the detector are provided as a rigid X-ray detection unit; and wherein the measurement system is an optical measurement system configured to determine a misalignment of the differential phase contrast setup between the X-ray source unit and the X-ray detection unit; wherein the processing unit is configured to provide a correction signal based on the determined misalignment; wherein the measurement system comprises at least three sensors at different corners of the X-ray detection unit; characterised in that the at least three sensors are provided as at least three 4-quadrant photodiodes; wherein an optical source device is fixedly attached to the X-ray source unit configured to generate a light beam to each of the 4-quadrant photodiodes; and wherein the 4-quadrant photodiodes measure the movement in the plane of the detector and an angular tilt with respect to the light beam.