  We present a full quantum mechanical three dimensional theory describing an
electromagnetic field interacting with an ensemble of identical atoms. The
theory is constructed such that it describes recent experiments on light-matter
quantum interfaces, where the quantum fluctuations of light are mapped onto the
atoms and back onto light. We show that the interaction of the light with the
atoms may be separated into a mean effect of the ensemble and a deviation from
the mean. The mean effect of the interaction effectively give rise to an index
of refraction of the gas. We formally change to a dressed state picture, where
the light modes are solutions to the diffraction problem, and develop a
perturbative expansion in the fluctuations. The fluctuations are due to quantum
fluctuations as well as the random positions of the atoms. In this perturbative
expansion we show how the quantum fluctuations are mapped between atoms and
light while the random positioning of the atoms give rise to decay due to
spontaneous emission. Furthermore we identify limits, where the full three
dimensional theory reduce to the one dimensional theory typically used to
describe the interaction.
