Microscopic description of radiative pion capture in nuclei