Four-dimensional image formation theory for all optical microscopy including optical coherence tomography