Digital subtraction angiography is used to improve the contrast of images of patient vasculature. A non-contrast image is recorded with no contrast medium injected into the patient, and then a succession of contrast images is captured after the injection of a contrast medium. The non-contrast image is successively registered to the contrast images, and then subtracted. This removes background structures, but leaves the vasculature untouched, making blood vessels easier to see. Artefacts can remain when different motion layers are present in the X-ray image (for example, the spine and the lungs). This application discusses a technique to prevent artefacts occurring when different motion layers are present in an X-ray frame or sequence.