The motion of the contracting heart has made it impossible to study coronary arteries after venous injection of a contrast medium using digital subtraction angiography (DSA), even with cardiac gating. The motion of the heart, as well as that of surrounding bone and tissue, produces artifacts in the difference image that often overlie the contrast-enhanced vessel images. Because the vessels are small and the contrast medium inherent in a venous injection is dilute, the intensity of a vessel image is weak. The motion artifacts typically are strong enough to obscure the vessel images, rendering the images diagnostically useless. A technique for removing motion artifacts is presented that permits removal of motion between a pair of images acquired during mask-mode DSA by geometrically transforming one image so that it is regis-tered with the other. The transformations can handle three-dimensional motion. Genetic optimization algorithms are employed to determine the optimum transformation. A series of phantom images are used to demonstrate the ability of the technique to remove three-dimensional motion.