In TEM, the electron beam passes through a thin film of the material as illustrated in Figure 10. Before and after the sample the beam is manipulated by the electron optics including magnetic lenses, deflectors and apertures; these act on the electrons similar to how glass lenses focus and control light. Optical elements above the sample are used to control the incident beam which can range from a wide and parallel beam to one which is a converging cone and can be smaller than an atom, 0.1 nm. As it interacts with the sample, part of the beam is diffracted and part is transmitted without changing its direction. This occurs simultaneously as electrons are everywhere until they are detected (wavefunction collapse) according to the Copenhagen interpretation.
Below the sample, the beam is controlled by another set of magnetic lneses and apertures. Each set of initially parallel rays (a plane wave) is focused by the first lens (objective) to a point in the back focal plane of this lens, forming a spot on a detector; a map of these directions, often an array of spots, is the diffraction pattern. Alternatively the lenses can form a magnified image of the sample. Herein the focus is on collecting a diffraction pattern; for other information see the pages on TEM and scanning transmission electron microscopy.