Influence of transition radiation and density effect on atomic K-shell excitation