The heart of an X-ray machine is an electrode pair -- a cathode and an anode -- that sits inside a glass vacuum tube. The cathode is a heated filament, like you might find in an older fluorescent lamp. The machine passes current through the filament, heating it up. The heat sputters electrons off of the filament surface. The positively-charged anode, a flat disc made of tungsten, draws the electrons across the tube.
The voltage difference between the cathode and anode is extremely high, so the electrons fly through the tube with a great deal of force. When a speeding electron collides with a tungsten atom, it knocks loose an electron in one of the atom's lower orbitals. An electron in a higher orbital immediately falls to the lower energy level, releasing its extra energy in the form of a photon. It's a big drop, so the photon has a high energy level -- it is an X-ray photon.
The free electron collides with the tungsten atom, knocking an electron out of a lower orbital. A higher orbital electron fills the empty position, releasing its excess energy as a photon.
Free electrons can also generate photons without hitting an atom. An atom's nucleus may attract a speeding electron just enough to alter its course. Like a comet whipping around the sun, the electron slows down and changes direction as it speeds past the atom. This "braking" action causes the electron to emit excess energy in the form of an X-ray photon.
The free electron is attracted to the tungsten atom nucleus. As the electron speeds past, the nucleus alters its course. The electron loses energy, which it releases as an X-ray photon.
In a normal X-ray picture, most soft tissue doesn't show up clearly. To focus in on organs, or to examine the blood vessels that make up the circulatory system, doctors must introduce contrast media into the body.
Contrast media are liquids that absorb X-rays more effectively than the surrounding tissue. To bring organs in the digestive and endocrine systems into focus, a patient will swallow a contrast media mixture, typically a barium compound. If the doctors want to examine blood vessels or other elements in the circulatory system, they will inject contrast media into the patient's bloodstream.
Contrast media are often used in conjunction with a fluoroscope. In fluoroscopy, the X-rays pass through the body onto a fluorescent screen, creating a moving X-ray image. Doctors may use fluoroscopy to trace the passage of contrast media through the body. Doctors can also record the moving X-ray images on film or video.
The high-impact collisions involved in X-ray production generate a lot of heat. A motor rotates the anode to keep it from melting (the electron beam isn't always focused on the same area). A cool oil bath surrounding the envelope also absorbs heat.
The entire mechanism is surrounded by a thick lead shield. This keeps the X-rays from escaping in all directions. A small window in the shield lets some of the X-ray photons escape in a narrow beam. The beam passes through a series of filters on its way to the patient.
A camera on the other side of the patient records the pattern of X-ray light that passes all the way through the patient's body. The X-ray camera uses the same film technology as an ordinary camera, but X-ray light sets off the chemical reaction instead of visible light. (See How Photographic Film Works to learn about this process.)
Generally, doctors keep the film image as a negative. That is, the areas that are exposed to more light appear darker and the areas that are exposed to less light appear lighter. Hard material, such as bone, appears white, and softer material appears black or gray. Doctors can bring different materials into focus by varying the intensity of the X-ray beam.