Question: How is the orientation of an MRI image controlled?
About the article "Magnetic resonance imaging", section "How MRI works".

Candidate passages:
To perform a study the patient is positioned within an MRI scanner which forms a strong magnetic field around the area to be imaged.
Most medical applications rely on detecting a radio frequency signal emitted by excited hydrogen atoms in the body (present in any tissue containing water molecules) using energy from an oscillating magnetic field applied at the appropriate resonant frequency.
The orientation of the image is controlled by varying the main magnetic field using gradient coils.
As these coils are rapidly switched on and off they create the characteristic repetitive noises of an MRI scan.
The contrast between different tissues is determined by the rate at which excited atoms return to the equilibrium state.
Exogenous contrast agents may be given intravenously, orally or intra-articularly.MRI requires a magnetic field that is both strong and uniform.
The field strength of the magnet is measured in tesla – and while the majority of systems operate at 1.5T commercial systems are available between 0.2T–7T.
Most clinical magnets are superconducting which requires liquid helium.
The lower field strengths can be achieved with permanent magnets, which are often used in "open" MRI scanners for claustrophobic patients.
To be MRI compatible, a robot needs to safely operate and perform its functions within the magnetic field of the MRI without deteriorating the image quality.
Thus, the development of MRI robots is a very challenging engineering task because MRI scanners use magnetic fields of very high density (3 teslas is now common), and most of the components commonly used in robotics may not be used in close proximity of the magnet.
Researchers have attempted to overcome the difficulties of robotic components in MRI in a variety of ways; some have placed controls and other magnetic sensitive units outside the shielded room of the MRI.
These controls will be connected to the robot by either hydraulic or pneumatic transmission lines.
Aside from the difficulties of robotics use in the large magnetic fields found with MRI, the small gap between the MRI and the patient limits the physical size of robots used as the inner radius of an MRI is typically 55 cm.
In addition to the robot itself, there must be a way to track the position, orientation and force being applied to the instrument.
Though this may potentially be done with continuous MRI, some uses of MRI robots may make continuous MRI undesirable due to potential interference between the MRI robot and the changing magnetic fields used in MRI.
Many times this tracking is done using some sort of optical system which may include fiber optics. 
 Magnetic resonance imaging (MRI), a medical imaging technique *Functional magnetic resonance imaging (fMRI), an MRI technique to measure brain activity *Magnetic resonance neurography (MRN), an MRI technique to image nerves *Cardiac magnetic resonance imaging (CMR), an MRI technique to assess the cardiovascular system *Magnetic resonance angiography (MRA), an MRI technique to image blood vessels *Magnetic resonance cholangiopancreatography (MRCP), an MRI technique to image biliary and pancreatic ducts *Endorectal coil magnetic resonance imaging, an MRI technique to image the area surrounding the rectum *Delayed Gadolinium Enhanced Magnetic Resonance Imaging of Cartilage (dGEMRIC), an MRI technique to image cartilage  *Magnetic resonance elastography (MRE), an MRI technique to measure tissue stiffness *Interventional magnetic resonance imaging (IMRI) a technique using MRI to guide medical interventions *Magnetic resonance spectroscopic imaging, an MRI technique to gather cellular activity and metabolic information Magnetic resonance therapy, a proposed treatment based on the principles of magnetic resonance  
Medical images that are obtained using technologies such as computed tomography (CT) and magnetic resonance imaging (MRI) are two-dimensional, planar, tomographic images of patient anatomy.
Treatment modalities such as stereotactic surgery and radiosurgery operate in the three-dimensional space of the patient.
Hence, the central problem with using CT or MRI to guide stereotactic surgery or radiosurgery is the transfer of patient information from the two-dimensional coordinate system of the planar CT or MRI image into the three-dimensional coordinate system of the stereotactic or radiosurgical instrument.
The N-localizer provides an elegant solution to this problem by creating fiducial marks or landmarks in each tomographic image.
These fiducial marks specify the spatial orientation of the image plane with respect to the N-localizer (Figure 1).
The N-localizer comprises a diagonal rod that extends from the top of one vertical rod to the bottom of a second vertical rod.
This combination of rods creates two circles and one ellipse in a tomographic image.
The ellipse moves away from one circle and towards the other circle as the image plane moves upward with respect to the N-localizer.
Measuring the relative distances between the ellipse and the two circles permits calculation of the point where the image plane intersects the diagonal rod.
The attachment of three N-localizers to a stereotactic instrument (Figure 2) permits calculation of three points where the image plane intersects the three diagonal rods (Figure 3).
Because three points determine a plane in three-dimensional space, these three points of intersection determine the spatial orientation of the image plane relative to the stereotactic instrument.
Therefore, the spatial orientation of any patient anatomy that is seen in the planar image is also determined relative to the stereotactic instrument.
Because the spatial orientation of the patient anatomy is defined relative to the stereotactic instrument, patient information may be transferred from the two-dimensional coordinate system of the planar image into the three-dimensional coordinate system of the stereotactic instrument. 
MRI contrast agents are a group of contrast media used to improve the visibility of internal body structures in magnetic resonance imaging (MRI).
The most commonly used compounds for contrast enhancement are gadolinium-based.
MRI contrast agents alter the relaxation times of atoms within body tissues where they are present after oral or intravenous administration.
In MRI scanners sections of the body are exposed to a very strong magnetic field, then a radiofrequency pulse is applied causing some atoms (including those in contrast agents) to spin and then relax after the pulse stops.
This relaxation emits energy which is detected by the scanner and is mathematically converted into an image.
The MRI image can be weighted in different ways giving a higher or lower signal.