Reconstruction of the magnetic perturbation in a toroidal reversed field pinch