A theory of optical coherence tomography