Static field inhomogeneity in magnetic resonance (MR) imaging produces geometrical distortions which restrict the clinical applicability of MR images, e.g., for planning of precision radiotherapy. The authors describe a method to compute distortions which are caused by the difference in magnetic susceptibility between the scanned object and the surrounding air. Such a method is useful for understanding how the distortions depend on the object geometry, and for correcting for geometrical distortions, and thereby improving MR/CT registration algorithms. The geometric distortions in MR can be directly computed from the magnetic field inhomogeneity and the applied gradients. The boundary value problem of computing the magnetic field inhomogeneity caused by susceptibility differences is analyzed. It is shown that the boundary element method (BEM) has several advantages over previously applied methods to compute the magnetic field. Starting from the BEM and the assumption that the susceptibilities are very small (typically O(10(-5)) or less), a formula is derived to compute the magnetic field directly, without the need to solve a large system of equations. The method is computationally very efficient when the magnetic field is needed at a limited number of points, e.g., to compute geometrical distortions of a set of markers or a single surface. In addition to its computational advantage the method proves to be efficient to correct for the lack of data outside the scan which normally causes large artifacts in the computed magnetic field. These artifacts can be reduced by assuming that at the scan boundary the object extends to infinity in the form of a generalized cylinder. With the adaptation of the BEM this assumption is equivalent to simply omitting the scan boundary from the computations. To the authors' knowledge, no such simple correction method exists for other computation methods. The accuracy of the algorithm was tested by comparing the BEM solution with the analytical solution for a sphere. When the applied homogeneous field is 1.5 T the agreement between both methods was within 0.11.10(-6) T. As an example, the method was applied to compute the displacement vector field of the surface of a human head, derived from an MR imaging data set. This example demonstrates that the distortions can be as large as 3 mm for points just outside the head when a gradient strength of 3 mT/m is used. It was also observed that distortion within the head can be described accurately as a linear scaling in the axial direction.