Reconstructing phase aberrations for high-precision dimensional microscopy