The aim of this work is to demonstrate a complete, robust, and time-efficient method for distortion correction of magnetic resonance (MR) images. It is well known that MR images suffer from both machine-related spatial distortions [gradient nonlinearity and main field (B0) inhomogeneity] and patient-related spatial distortions (susceptibility and chemical shift artifacts), and growing interest in the area of MR-based radiotherapy treatment planning has put new requirements on the geometric accuracy of such images. The authors present a two-step method that combines a phantom-based reverse gradient technique for measurement of gradient nonlinearities and a patient-based phase difference mapping technique for measurement of B0 inhomogeneities, susceptibility, and chemical shift distortions. The phase difference mapping technique adds only minutes to the total patient scan time and can be used to correct a variety of images of the same patient and anatomy. The technique was tested on several different phantoms, each designed to isolate one type of distortion. The mean distortion was reduced to 0.2 +/- 0.1 mm in both gradient echo and spin echo images of a grid phantom. For the more difficult case of a highly distorted echo planar image, residual distortion was reduced to subvoxel dimensions. As a final step, the technique was implemented on patient images. The current technique is effective, time efficient, and robust and provides promise for preparing distortion-rectified MR images for use in MR-based treatment planning.