MRI-guided radiotherapy requires precise image geometric information to target a tumour without unnecessary radiation on healthy surrounding tissue. Due to the imperfections in the gradient system and engineering limitations, however, gradient non-linearity (GNL) inevitably occurs and causes image distortions if not properly accounted for. Here we propose a novel method to estimate the gradient field using stream function methods with a grid phantom. The estimated gradient field was then used for GNL distortion correction and image reconstruction. Initial simulations demonstrated that the image geometric distortion in a combined MRI and linear accelerator (MRI-Linac) system was effectively improved by the proposed method.