Proton spin-echo magnetometer: a novel approach for magnetic field measurement in residual field gradient