Three-dimensional imaging in a microscope