1. A method of producing a scalar image from a derivative field and a vector image, the method including the steps of: a) selecting a function class c, wherein all members of the class c are functions which map each vector of the vector image to a unique scalar value; b) selecting a function f from the class c which maps the vector image to a scalar image, the derivative of which is closest to the derivative field; c) generating the scalar image from the vector image by using f to calculate each scalar value in the scalar image from a corresponding vector in the vector image.