Relativistic theory of spectra of pionic atoms with account of the radiative and nuclear corrections