1. A method of designing a permanent magnetic structure for generating a desired magnetic field in a region of interest (ROI) comprising: setting the dimensions of the permanent magnetic structure setting a hypothetical distribution of magnetic material over the surface of said structure for each member of a finite set of spatial frequency harmonics of unit magnetisation amplitude calculating the magnetic field in the ROI from each member of said set calculating amplitudes of said harmonics by the method of least squares in order to achieve the optimum approximation to the desired field in the ROI scaling the members of said set according to said optimised harmonic amplitudes establishing, by summing said scaled members, the required distribution of magnetic material in order to generate the desired magnetic field.