Determination of three-dimensional structure in photon scanning tunnelling microscopy